Checked GroupBox

Here's a bit of code that i'm using in an application to give this result (Checked GroupBox)

 

[code:c#]

<GroupBox Grid.Row="3" Grid.Column="1" BorderBrush="Black" Margin="0,0,116,0">
<GroupBox.Header>
    <CheckBox x:Name="cbValidity" IsChecked="{Binding Path=HasValidity}" >Validity</CheckBox>
</GroupBox.Header>

<StackPanel>
    <StackPanel.Style>
        <Style>
            <Style.Triggers>
                <DataTrigger Binding ="{Binding ElementName=cbValidity, Path=IsChecked}" Value="false">
                    <Setter Property="Button.IsEnabled" Value="false"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </StackPanel.Style>
    <TextBlock Margin="10,10,0,0" Text="This job is valid from" />
    <wfi:WindowsFormsHost x:Name="propertiesCtrlHost" SnapsToDevicePixels="True" Background="Transparent" Height="22" Margin="10" Width="200" HorizontalAlignment="Left">
        <wf:DateTimePicker x:Name="dtpFrom" Format="Custom" CustomFormat="dd MMMM yyyy  HH:mm" ValueChanged="dtpFrom_ValueChanged" />
    </wfi:WindowsFormsHost>

    <TextBlock Margin="10,10,0,0" Text="This job is valid to" />
    <wfi:WindowsFormsHost SnapsToDevicePixels="True" Background="Transparent" Height="22" Margin="10" Width="200" HorizontalAlignment="Left">
        <wf:DateTimePicker x:Name="dtpTo" Format="Custom" CustomFormat="dd MMMM yyyy  HH:mm" ValueChanged="dtpTo_ValueChanged" />
    </wfi:WindowsFormsHost>
</StackPanel>
</GroupBox>

 

[/code]

Comments are closed