|
<Window x:Class="CustomChromeSample.Window4"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:shell="http://schemas.microsoft.com/winfx/2006/xaml/presentation/shell"
xmlns:ccl="clr-namespace:CustomChromeLibrary;assembly=CustomChromeLibrary"
xmlns:local="clr-namespace:CustomChromeSample"
Title="Custom Chrome Sample"
Height="350" Width="525">
<shell:WindowChrome.WindowChrome>
<shell:WindowChrome
ResizeBorderThickness="6"
CaptionHeight="43"
CornerRadius="25,25,10,10"
GlassFrameThickness="0">
</shell:WindowChrome>
</shell:WindowChrome.WindowChrome>
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources\GlassButton.xaml"/>
<ResourceDictionary Source="Resources\GlassIcon.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--provide the background for the entire form. In practice, this appears as the window's resize border, because the title and window content obscure the rest-->
<Border CornerRadius="10,10,5,5" Grid.RowSpan="2" BorderThickness="3" BorderBrush="LightSteelBlue">
<Border.Background>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#99bbbbff" Offset="0" />
<GradientStop Color="#ff7777bb" Offset="1" />
</LinearGradientBrush>
</Border.Background>
</Border>
<!--title bar-->
<Border CornerRadius="10,10,0,0" BorderThickness="3,3,3,1" BorderBrush="LightSteelBlue" Margin="{Binding Path=CaptionButtonMargin}">
<Border.Background>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#ffbbbbff" Offset="0" />
<GradientStop Color="#ff7777bb" Offset="1" />
</LinearGradientBrush>
</Border.Background>
<!--<Border.BitmapEffect>
<DropShadowBitmapEffect Direction="305" Opacity="1" ShadowDepth="5" Color="White" />
</Border.BitmapEffect>-->
<!--Window Icon and Title-->
<StackPanel Orientation="Horizontal" Margin="0" VerticalAlignment="Top">
<ContentControl Width="35" Height="35" Background="#ff0000bb" Margin="7,3,5,5" Style="{StaticResource GlassIcon}" shell:WindowChrome.IsHitTestVisibleInChrome="True" />
<TextBlock Text="Window 4 - Custom Chrome" FontFamily="Calibri" FontWeight="Bold" FontSize="26" Foreground="#FF000044" VerticalAlignment="Center"/>
</StackPanel>
</Border>
<!--Content-->
<Grid Grid.Row="1">
<TextBlock Grid.Row="1" Margin="10" FontFamily="Verdana" FontSize="14">
Click-and-drag to move window.<LineBreak/>
Drag to top to maximize.<LineBreak/>
Double-click to maximize.<LineBreak/>
Right-click for system menu.<LineBreak/>
But no caption buttons (min/max/close).<LineBreak/>
<LineBreak/>
<Button Click="CloseButton_Click">Close Window (Alt-F4)</Button>
</TextBlock>
</Grid>
</Grid>
</Window>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Greg has been working in software development in a variety of roles since 1990.