<GroupBox BorderThickness="0" Grid.Row="1" Header="Members" Style="{StaticResource CenteredHeaderGroupBoxStyle}">
<GroupBox.HeaderTemplate>
<DataTemplate>
<Border>
<Grid HorizontalAlignment="Center">
<ToggleButton Name="LButton" Content="Members" Style="{StaticResource TabL}" />
<ToggleButton Name="RButton" Content="Groups" Style="{StaticResource TabR}" />
</Grid>
</Border>
</DataTemplate>
</GroupBox.HeaderTemplate>
<GroupItem>
<Border>
<ListBox Name="GroupMemberList" ItemsSource="{Binding Path=MembersoftheCase}">
<ListBox.Triggers>
<Trigger SourceName="LButton" Property="IsChecked" Value="True">
<Setter Property="ListBox.ItemsSource" Value="{Binding Path=MembersoftheCase}"/>
<Setter Property="ListBox.ItemTemplate" Value="{StaticResource MListTemplate}"/>
</Trigger>
<Trigger SourceName="RButton" Property="IsChecked" Value="True">
<Setter Property="ListBox.ItemsSource" Value="{Binding Path=Groupsof开发者_StackOverflowtheCase}"/>
<Setter Property="ListBox.ItemTemplate" Value="{StaticResource GListTemplate}"/>
</Trigger>
</ListBox.Triggers>
</ListBox>
</Border>
i am Getting Exception at Compile Time the Designer is Not getting Loaded because of this Error
The property 'SourceName' does not represent a valid target for the 'Trigger' because an element named 'LButton' was not found. Make sure that the target is declared before any Setters, Triggers or Conditions that use it.
i have also tried putting the Triggers at Buttons itself making GroupmembersList as the Target
then the TargetName Could not be found is coming
F1 F1
The objects are out of scope, from the documentation:
You can set this property to the name of any element within the scope of where the trigger collection (the collection that this Trigger is part of) is applied. This is typically a named element that is within the template that contains this Trigger.
You can name an object using the x:Name Directive syntax.
If you want to trigger on foreign objects use a DataTrigger
. (Use the ListBox.Style.Triggers
rather than the immediate triggers.)
精彩评论