Is there a way to determine if ToggleButton checked or not checked using DelegateCommand s?
TIA, microphone
The XAML code is below. I use ItemsControl and bind to the collection. I basically want to get the switching status of each button when pressed.
<ScrollViewer VerticalScrollBarVisibility="Auto"> <ItemsControl ItemsSource="{Binding Modifiers, Mode=TwoWay}"> <ItemsControl.Template> <ControlTemplate> <ScrollViewer ScrollViewer.VerticalScrollBarVisibility="Auto"> <WrapPanel Margin="10" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" FlowDirection="LeftToRight" IsItemsHost="true"> </WrapPanel> </ScrollViewer> </ControlTemplate> </ItemsControl.Template> <ItemsControl.ItemTemplate> <DataTemplate> <ToggleButton FontSize="18" Opacity="0.8" Command="{Binding DataContext.ModifierToggleCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Views:ModifiersView}}}" CommandParameter="{Binding}" Height="80" Width="200" Margin="5" Content="{Binding Path=ModifierName}" /> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </ScrollViewer>
source share