Looking for a little insight.
I have a checkbox that I have set to a style because I needed to make the actual box match with the text size and position. The style code is as follows:
Style TargetType="{x:Type CheckBox}" x:Key="recogCheckbox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type CheckBox}">
<StackPanel Orientation="Horizontal">
<CheckBox Margin="130,4,0,0"/>
<BulletDecorator Name="customBullet" Margin="2,0,0,0" Grid.Column="0" Grid.Row="0" VerticalAlignment="Center">
<TextBlock Width="100" TextWrapping="Wrap" HorizontalAlignment="Left" Foreground="White" Margin="5,0,0,0" Text="Recognition Call"/>
</BulletDecorator>
<ContentPresenter/>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
The xaml code for the checkbox is this:
<CheckBox FontFamily="Microsoft Sans Serif" FontSize="12" FontWeight="Bold" Height="20" HorizontalAlignment="Left" HorizontalContentAlignment="Center" Margin="717,193,0,0"
Name="recognitionCheckBox" Style="{StaticResource recogCheckbox}" VerticalAlignment="Top" Width="384" >
</CheckBox>
I am trying to use a clear button on my application so that it unchecks the checkbox but when I reference the checkbox name 'recognitionCheckBox' by using recognitionCheckBox.isChecked = false
it does not uncheck the checkbox which I think is because the actual box is inside the style which I am having trouble referencing in the C# code behind.
Does anyone know of a way to uncheck the checkbox within the style. I have been searching several sites but not found anything that has helped me yet.
Aucun commentaire:
Enregistrer un commentaire