我有一个ListBox,当一个事件发生在ListBox之外时(点击一个按钮)我需要申请
CategoriesUnselectedDataTemplate
到CategoriesListBox
Anyidea如何解决这个问题?
<Custom:SurfaceListBox
x:Name="CategoriesListBox"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Hidden"
ManipulationDelta="CategoriesListBox_ManipulationDelta"
IsManipulationEnabled="True"
SelectionChanged="CategoriesListBox_SelectionChanged"
ItemTemplate="{DynamicResource CategoriesUnselectedDataTemplate}"
VerticalContentAlignment="Stretch"
HorizontalContentAlignment="Stretch"
SelectionMode="Single"
Margin="115,131,-117,-49">
</Custom:SurfaceListBox>
<DataTemplate x:Key="CategoriesUnselectedDataTemplate">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Name="titleCategory" TextWrapping="Wrap"
Text="{Binding CapitalizedDescription, FallbackValue=CategoryName}"
Foreground="#2fb8dc"
FontFamily="/GateeClientWPF;component/Fonts/#Letter Gothic L"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="30"
Margin="0,10"/>
<Image Source="Assets/common/right_grey.png" Width="20" Height="20" Visibility="Visible" HorizontalAlignment="Left" VerticalAlignment="Center" d:LayoutOverrides="Height" Grid.Column="1" Margin="10,0,0,0"/>
</Grid>
</DataTemplate>