Hi,
following your MVVM samples, I have a few tool windows and document windows.
Also following your samples, I created a style to bind the properties of Actipro DockingWindow to my own class, which is called DockingWindowViewModelBase.
The style is stored in a resource dictionary and looks like
<Style x:Key="DockingWindowStyle" x:Name="DockingWindowStyle" TargetType="docking:DockingWindow">
<Setter Property="Background" Value="{Binding Path=Background, Mode=TwoWay}"/>
<Setter Property="BorderBrush" Value="{Binding Path=BorderBrush, Mode=TwoWay}"/>
<Setter Property="BorderThickness" Value="{Binding Path=BorderThickness, Mode=TwoWay}"/>
<Setter Property="CanAttach" Value="{Binding Path=CanAttach, Mode=TwoWay}"/>
... many other properties
</Style>
The DockingWindowViewModelBase replicates the most original properties of the Actipro DockingWindow:
Public MustInherit Class DockingWindowViewModelBase
Inherits ObservableObjectBase
Private _background As Brush
Private _borderBrush As Brush
Private _borderThickness As Thickness
Private _canAttach As Boolean?
...
Public Overridable Property Background As Brush
Get
Return Me._background
End Get
Set(value As Brush)
If Me._background IsNot value Then
Me._background = value
Me.NotifyPropertyChanged("Background")
End If
End Set
End Property
Public Overridable Property BorderBrush As Brush
Get
Return Me._borderBrush
End Get
Set(value As Brush)
If Me._borderBrush IsNot value Then
Me._borderBrush = value
Me.NotifyPropertyChanged("BorderBrush")
End If
End Set
End Property
Public Overridable Property BorderThickness As Thickness
Get
Return Me._borderThickness
End Get
Set(value As Thickness)
If Me._borderThickness <> value Then
Me._borderThickness = value
Me.NotifyPropertyChanged("BorderThickness")
End If
End Set
End Property
Public Overridable Property CanAttach As Boolean?
Get
Return Me._canAttach
End Get
Set(value As Boolean?)
If Me._canAttach <> value Then
Me._canAttach = value
Me.NotifyPropertyChanged("CanAttach")
End If
End Set
End Property
...
End Class
The tool windows and document windows are displayed at runtime, but their contents (the ViewModels) are just small rectangles and doesn't fill the whole range of the windows. Please have a look here.
Note: everything was working fine, before I created the style - but I need to access the properties.
Where do I go wrong?
Thank you in advance.
Michael
EDIT
I found out, that modifying the MinWidth/MaxWidth properties changes the size of the DocumentWindow content.
But how can I determine the correct values to ensure that the content (the ViewModel) fit closely in the Document Windows bounds - even if solution or the Document Window size is changed? Should I take a exaggerated value like 100,000 to keep out of harm's way or what is the best practice?
Thank you.
Michael
EDIT 2
MinWidth isn't the solution.At the first glance it seems to work. But if I dock a ToolWindow at the left side, place a Grid in it with ColumnWidth="Auto", the width of the controls inside the Grid will be set to MinWidth.
More detailed:
I set MinWidth to 2000. I dock a ToolWindow on the left side and place a Grid in it. The Width-Property of the ColumnDefinition is "Auto". In this column, I place a ComboBox.
At runtime, I cannot see the Button of the ComboBox. If I open the ComboBox, I see, that its width exceeds the width of the ToolBox. The width of the ComboBox is the same as MinWidth -> 2000. Please look here.
So my question is again: how can I fit a DocumentWindows content to the bounds of this window?
Thank you.
Michael
[Modified 8 years ago]