Skip to content

Instantly share code, notes, and snippets.

@sphingu
Created June 14, 2013 12:00
Show Gist options
  • Save sphingu/5781303 to your computer and use it in GitHub Desktop.
Save sphingu/5781303 to your computer and use it in GitHub Desktop.
Style, Radio Button, DataGrid in WPF
// How to set Style to All Same Type of Controls
<Window.Resources>
//GroupBox,TextBox,Button,Grid
//Set background Black of all GroupBox in current Window
<Style TargetType="{x:Type GroupBox}">
<Setter Property="Background" Value="Black"/>
</Style>
</Window.Resources>
//Use of Radio Button
<RadioButton Content="Male" Name="rbMale" IsChecked="True" GroupName="Gender" Checked="rbMale_Checked"/>
<RadioButton Content="Female" Name="rbFemale" GroupName="Gender" Checked="rbFemale_Checked"/>
//Use of Data Grid with Checkbox Check for Selected Row
<DataGrid Name="dgSource" CanUserSortColumns="False" IsReadOnly="True" CanUserAddRows="False" CanUserDeleteRows="False" AlternatingRowBackground="AliceBlue"
AlternationCount="2" AutoGenerateColumns="False" VerticalScrollBarVisibility="Visible" MinHeight="100" MaxHeight="250" Visibility="Collapsed" >
<DataGrid.Columns>
<DataGridCheckBoxColumn Header="Select" Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=DataGridRow}}" />
<DataGridTextColumn Binding="{Binding Path=TABLE_NAME}" Header="Table Name" />
</DataGrid.Columns>
</DataGrid>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment