Rasika Shah

Rasika Shah

  • NA
  • 12
  • 2.4k

How to put background color in window title bar

Jun 18 2015 3:01 AM
Hi, 
 
i want to change window form title bar background color.

my code is

  <Window x:Class="DMS.MainApp.Views.AdvanceSearchView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="clr-namespace:DMS.MainApp.HelperClasses"
xmlns:my="clr-namespace:AdvancedSearchControlLibrary;assembly=AdvancedSearchControlLibrary"
mc:Ignorable="d" Title="Phoenix DMS Search" Height="595" MinHeight="500" MinWidth="650"
Icon="/Images/PhoenixLogo.jpg" Background="White"
WindowStartupLocation="CenterScreen" ShowInTaskbar="False" ResizeMode="CanResize"
Loaded="Window_Loaded" PreviewKeyDown="Window_PreviewKeyDown" KeyDown="Window_KeyDown">
<Grid Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="0" />
<RowDefinition Height="AUTO" />
<RowDefinition Height="50" />
<RowDefinition Height="*" />
<RowDefinition Height="40" />
<RowDefinition Height="35" />
</Grid.RowDefinitions>
<!-- Row 0 -->
<!-- Row 1 -->
<ScrollViewer Grid.Row="1" Height="Auto" Name="scrMain" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<StackPanel Name="spMain" Orientation="Vertical" HorizontalAlignment="Stretch" Grid.Row="1" >
<my:AdvancedSearchView HorizontalAlignment="Center" Name="advancedSearchView1" VerticalAlignment="Top" Width="Auto" HorizontalContentAlignment="Center" Margin="0,0,0,15" Grid.Row="0"/>
</StackPanel>
</ScrollViewer>
<!-- Row 2 -->
<StackPanel Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Center">
<Grid Name="grid22" Margin="0,5" VerticalAlignment="Center" HorizontalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="75" />
<ColumnDefinition Width="75" />
</Grid.ColumnDefinitions>
<Button Content="Cancel" Height="23" Name="btnCancel" Click="btnCancel_Click" Style="{StaticResource Secondarybtn}" Grid.Column="1" VerticalAlignment="Top" HorizontalAlignment="Center" TabIndex="125" />
<Button Content="Search"
Height="23"
Name="btnSearch"
Click="btnSearch_Click"
Style="{StaticResource Primarybtn}"
VerticalAlignment="Top"
IsDefault="True"
TabIndex="120" HorizontalAlignment="Center" />
</Grid>
</StackPanel>
<!-- Row 3 -->
<Grid Grid.Row="3" >
<ScrollViewer Name="scrlviewer" VerticalScrollBarVisibility="Disabled" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalScrollBarVisibility="Disabled"></ScrollViewer>
<DataGrid Name="gridData" ItemsSource="{Binding dtData}" Visibility="Visible" AutoGenerateColumns="True"
MouseDoubleClick="gridData_MouseDoubleClick" IsReadOnly="True" PreviewKeyDown="gridData_PreviewKeyDown_1"
VirtualizingStackPanel.VirtualizationMode="Standard" HorizontalAlignment="Stretch"
ScrollViewer.ScrollChanged="gridData_ScrollChanged" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"
AutoGeneratingColumn="gridData_AutoGeneratingColumn" HeadersVisibility="Column"></DataGrid>
</Grid>
<!-- Row 4 -->
<StackPanel Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Stretch" Visibility="Visible" Margin="5,5,0,5">
<Button Content="Ok" Width="75" Height="23" Name="btnOk" Click="btnOk_Click" Style="{StaticResource Primarybtn}" TabIndex="130" />
</StackPanel>
<Grid Name="grid21" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,5,0,0"
Visibility="Collapsed">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="130" />
<ColumnDefinition Width="75" />
</Grid.ColumnDefinitions>
<Button Content="Reset" Height="23" Name="btnReset" ToolTip="Reset all search parameters" Click="btnReset_Click" Style="{StaticResource Secondarybtn}" Grid.Column="1" VerticalAlignment="Top" HorizontalAlignment="Center" TabIndex="15" />
<Button Content="Add Search Criterion" Height="23" Name="btnAdd" ToolTip="Add new search parameter row" Click="Add_Click" Style="{StaticResource Primarybtn}" VerticalAlignment="Top" HorizontalAlignment="Left" TabIndex="10" Width="120" Margin="7,0,0,0" />
</Grid>
<Grid Style="{StaticResource Bottomgrid}" Grid.Row="5" Height="30" HorizontalAlignment="Stretch" Margin="0" Name="grid23" VerticalAlignment="Top">
<Label Name="lblTotal" Content="Total Records : " HorizontalAlignment="Left" Style="{StaticResource Totalrecords}" VerticalAlignment="Center" VerticalContentAlignment="Center" />
<Label Name="lblTotalRecord" Height="30" HorizontalAlignment="Left" Margin="90,0,0,0" Padding="1" Style="{StaticResource Totalrecords}" VerticalAlignment="Center" VerticalContentAlignment="Center" Width="110" />
</Grid>
</Grid>
</Window>
 
 

Answers (1)