1
<StackPanel Grid.Column="0" >
<ToggleButton Name="buttonEditListBoxItem"
Content="Edit"
IsChecked="False"
Click="buttonEditListBoxItem_Click"></ToggleButton>
<ListBox Name="ListBoxTriggers"
SelectedValuePath="TriggerId"
IsSynchronizedWithCurrentItem="True"
SelectionChanged="Triggers_SelectionChanged"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
HorizontalContentAlignment="Stretch">
<ListBox.ItemTemplate>
<DataTemplate> <Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="AUTO"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<CheckBox Visibility="{Binding ElementName=buttonEditListBoxItem, Path=IsChecked, Converter={StaticResource visibilityConverter}}" Grid.Column="0" VerticalAlignment="Center" x:Name="checkBoxTriggers" ></CheckBox>
<Button Grid.Column="1" Style="{StaticResource GlassButton}"
Uid="{Binding Path=TriggerId}"
Margin="5"
x:Name="ButtonTrigger"
GotFocus="ButtonTrigger_GotFocus"
>
<Button.Content>
<TextBlock Foreground="White" TextAlignment="Justify"
TextWrapping="Wrap" Margin="6" Text="{Binding Path=Name}"/>
</Button.Content>
</Button>
</Grid>
</DataTemplate> </ListBox.ItemTemplate>
</ListBox>
我對其中有一個按鈕和一個複選框。有一個列表框數據模板是決定複選框的visbility列表框外的切換按鈕。 問題是如果我點擊了ToggleButton並且複選框是可見的,並且當我再次單擊ToggleButton時我檢查了一些複選框,但複選框已隱藏,但我希望複選框重置;就像在他們再次可見時一樣,我不想點擊任何複選框。如何重置複選框的財產器isChecked中的DataTemplate一個列表框