<Grid>
<CheckBox Content="Select All" IsChecked="{Binding Path=SelectAll}"/>
<TextBlock Grid.Column="1" Text="Filter by:" />
<RadioButton IsChecked="{Binding Path=All}" GroupName="filterGroup" Content="All" />
<RadioButton IsChecked="{Binding Path=NShared}" GroupName="filterGroup" Content="Not Shared" />
</Grid>
<GroupBox Header="Members" Style="{StaticResource CenteredHeaderGroupBoxStyle}" Width="330">
<GroupBox.HeaderTemplate>
<DataTemplate>
<Border Width="320">
<Grid HorizontalAlignment="Center" Width="320">
<ToggleButton Name="LeftButton" Command="{Binding Path=MemeberButtonSelected}"/>
<ToggleButton Name="RightButton" IsChecked="{Binding Path=GroupSelected}"/>
</Grid>
</Border>
</DataTemplate>
</GroupBox.HeaderTemplate>
<GroupItem>
<Border>
<ListBox Name="GroupMemberList">
<ListBox.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=GroupSelected}" Value="True">
<Setter Property="ListBox.ItemsSource" Value="{Binding Path=GroupsoftheCase}"/>
<Setter Property="ListBox.ItemTemplate" Value="{StaticResource GroupListTemplate}"/>
<Setter Property="ListBox.SelectedValue" Value="{Binding Path=SelectedGroups}"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=MemberSelected}" Value="True">
<Setter Property="ListBox.ItemsSource" Value="{Binding Path=MembersoftheCase}"/>
<Setter Property="ListBox.ItemTemplate" Value="{StaticResource MembersListTemplate}"/>
<Setter Property="ListBox.SelectedValue" Value="{Binding Path=SelectedMembers}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</ListBox.Style>
</ListBox>
</Border>
</GroupItem>
</GroupBox>
The ToggleButton Binding is Not working the Properties/Commands are existing in the DataContext of the View
but the output says
System.Windows.Data Error: 40 : BindingExpression path error: 'MemeberButtonSelected' property not found on 'object' ''String' (HashCode=-1399923548)'. BindingExpression:Path=MemeberButtonSelected; DataItem='String' (HashCode=-1399923548); target element is 'ToggleButton' (Name=''); target property is 'Command' (type 'ICommand')
System.Windows.Data Error: 40 : BindingExpression path error: 'GroupSelected' property not found on 'object' ''String' (HashCode=-1399923548)'. BindingExpression:Path=GroupSelected; DataItem='String' (HashCode=-1399923548); target element is 'ToggleButton' (Name=''); target property is 'IsChecked' (type 'Nullable`1')
i have also tried the Relative Source
as
IsChecked="{Binding Path=MemberSelected, RelativeSource={RelativeSource AncestorType={x:Type GroupBox}}}"
for one of the Toggle buttons and its of no Use only the String in the output will change to object thats all
MemeberButtonSelected
looks like a typo. Also, in the relative path example, you called itMemberSelected
. – Daniel Hilgarth