How to customize the WindowChrome
class while using MvvmCross?
I've got this:
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="{x:Static SystemParameters.CaptionHeight}" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
</WindowChrome.WindowChrome>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
Grid.Column="0"
FontSize="32"
Text="SOME UPPER CASE TEXT THAT WILL NEVER BE DISPLAYED" />
</Grid>
inside my MvxWindow
and the WindowStyle
is set to none
.
The problem is that MvxWindow
doesn't seem to display anything. That means I can't create the buttons I need either. I don't know if MvvmCross expects every UI element to be part of a View
or what else is going on. Resizing and even right-clicking the invisible border works just fine. Is there any way to do this without having to rebuild the entire WindowChrome
functionality inside a View
?
I will answer this myself;
while there is little difference in creating a custom
WindowChrome
with MvvmCross, I'll keep this question up in the hope that it could help someone else.Not being able to display UI elements in
MvxWindow
is actually no problem at all. Just create the UI in yourView
and set theWindowChrome.IsHitTestVisibleInChrome
property totrue
for each element you need.There is basically no difference between doing this within a
Window
or aView
. You just have to keep an eye on yourCaptionHeight
as yourWindowChrome
and your UI are now in two different scripts.It could look like this:
Inside your MvxWindow:
Inside the view displayed by that window: