Skip to content

Instantly share code, notes, and snippets.

@damianh
Created June 26, 2013 12:04
Show Gist options
  • Select an option

  • Save damianh/5866882 to your computer and use it in GitHub Desktop.

Select an option

Save damianh/5866882 to your computer and use it in GitHub Desktop.
The XAML in http://msdn.microsoft.com/en-us/library/system.windows.shell.windowchrome.aspx is copied from the Microsoft.Windows.Shell project but hasn't been updated to reflect the new namespace in .net 4.5. This is the correct XAML.
<Style TargetType="{x:Type local:MainWindow}">
<Setter Property="WindowChrome.WindowChrome">
<Setter.Value>
<WindowChrome />
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:MainWindow}">
<Grid>
<Border Background="White"
Margin="{Binding Source={x:Static SystemParameters.WindowNonClientFrameThickness}}">
<ContentPresenter Content="{TemplateBinding Content}" />
</Border>
<TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Title}"
VerticalAlignment="Top"
HorizontalAlignment="Left"
Margin="36,8,0,0" />
<Image Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Icon}"
VerticalAlignment="Top" HorizontalAlignment="Left"
Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(WindowChrome.WindowChrome).ResizeBorderThickness}"
Width="{Binding Source={x:Static SystemParameters.SmallIconWidth }}"
WindowChrome.IsHitTestVisibleInChrome="True" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment