Permalink
Cannot retrieve contributors at this time
Fetching contributors…
| <Window x:Class="GroupBoxSnippet.Window1" | |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
| Title="GroupBoxSnippet" | |
| > | |
| <Window.Resources> | |
| <!--<SnippetGroupBoxTemplate>--> | |
| <!--================================================================= | |
| GroupBox Template Example | |
| ==================================================================--> | |
| <BorderGapMaskConverter x:Key="BorderGapMaskConverter"/> | |
| <Style x:Key="{x:Type GroupBox}" | |
| TargetType="{x:Type GroupBox}"> | |
| <Setter Property="BorderBrush" | |
| Value="Gray"/> | |
| <Setter Property="Foreground" | |
| Value="White"/> | |
| <Setter Property="BorderThickness" | |
| Value="1"/> | |
| <Setter Property="Template"> | |
| <Setter.Value> | |
| <ControlTemplate TargetType="{x:Type GroupBox}"> | |
| <Grid> | |
| <Grid.ColumnDefinitions> | |
| <ColumnDefinition Width="4"/> | |
| <ColumnDefinition Width="Auto"/> | |
| <ColumnDefinition Width="*"/> | |
| <ColumnDefinition Width="4"/> | |
| </Grid.ColumnDefinitions> | |
| <Grid.RowDefinitions> | |
| <RowDefinition Height="Auto"/> | |
| <RowDefinition Height="Auto"/> | |
| <RowDefinition Height="*"/> | |
| <RowDefinition Height="4"/> | |
| </Grid.RowDefinitions> | |
| <Border CornerRadius="4" | |
| Grid.Row="1" | |
| Grid.RowSpan="3" | |
| Grid.Column="0" | |
| Grid.ColumnSpan="4" | |
| BorderThickness="{TemplateBinding BorderThickness}" | |
| BorderBrush="Transparent" | |
| Background="{TemplateBinding Background}"/> | |
| <!-- ContentPresenter for the header --> | |
| <Border x:Name="Header" | |
| Padding="6,0,6,0" | |
| Grid.Row="0" | |
| Grid.RowSpan="2" | |
| Grid.Column="1"> | |
| <ContentPresenter ContentSource="Header" | |
| RecognizesAccessKey="True" /> | |
| </Border> | |
| <!-- Primary content for GroupBox --> | |
| <ContentPresenter Grid.Row="2" | |
| Grid.Column="1" | |
| Grid.ColumnSpan="2" | |
| Margin="{TemplateBinding Padding}"/> | |
| <Border CornerRadius="0" | |
| Grid.Row="1" | |
| Grid.RowSpan="3" | |
| Grid.ColumnSpan="4" | |
| BorderThickness="{TemplateBinding BorderThickness}" | |
| BorderBrush="{TemplateBinding BorderBrush}"> | |
| <Border.OpacityMask> | |
| <MultiBinding Converter= | |
| "{StaticResource BorderGapMaskConverter}" | |
| ConverterParameter="6"> | |
| <Binding ElementName="Header" | |
| Path="ActualWidth"/> | |
| <Binding RelativeSource="{RelativeSource Self}" | |
| Path="ActualWidth"/> | |
| <Binding RelativeSource="{RelativeSource Self}" | |
| Path="ActualHeight"/> | |
| </MultiBinding> | |
| </Border.OpacityMask> | |
| </Border> | |
| </Grid> | |
| </ControlTemplate> | |
| </Setter.Value> | |
| </Setter> | |
| </Style> | |
| <!--</SnippetGroupBoxTemplate>--> | |
| </Window.Resources> | |
| <DockPanel> | |
| <!--<Snippet1>--> | |
| <GroupBox Margin="0,20,0,0" Width="150" Height="200"> | |
| <GroupBox.Header> | |
| My Favorite City | |
| </GroupBox.Header> | |
| <StackPanel> | |
| <TextBlock Margin="0,10,0,0">Type your name:</TextBlock> | |
| <TextBox Width="100"/> | |
| <TextBlock Margin="0,5,0,0">Select your favorite city:</TextBlock> | |
| <TextBlock>Select your name</TextBlock> | |
| <ListBox Name="empName"> | |
| <ListBoxItem IsSelected="true">Paris</ListBoxItem> | |
| <ListBoxItem>Beijing</ListBoxItem> | |
| <ListBoxItem>Buenos Aires</ListBoxItem> | |
| <ListBoxItem>Chicago</ListBoxItem> | |
| </ListBox> | |
| <Button Margin="0,20,0,0" Width="50" | |
| Click="SubmitCode">Submit</Button> | |
| </StackPanel> | |
| </GroupBox> | |
| <!--</Snippet1>--> | |
| <!--<SnippetToolTipString>--> | |
| <Button ToolTip="Click to submit your information" | |
| Click="SubmitCode" Height="20" Width="50">Submit</Button> | |
| <!--</SnippetToolTipString>--> | |
| <!--<SnippetToolTipDockPanel>--> | |
| <TextBox> | |
| ToolTip with image and text | |
| <TextBox.ToolTip> | |
| <StackPanel> | |
| <Image Source="data\flower.jpg"/> | |
| <TextBlock>Useful information goes here.</TextBlock> | |
| </StackPanel> | |
| </TextBox.ToolTip> | |
| <!--</SnippetToolTipDockPanel>--> | |
| </TextBox> | |
| </DockPanel> | |
| </Window> |