【发布时间】:2015-12-21 19:12:13
【问题描述】:
我想知道为什么我可以在列表框中选择一个项目,但不能在文本上选择。所以我可以选择空白区域中的项目,但是当我单击文本或图像时它没有突出显示,我想知道为什么?
<Popup IsOpen="{Binding IsChecked, ElementName=toggleButtonAdd}" x:Name="Popup" StaysOpen="False" Placement="Right">
<Border BorderBrush="Black" BorderThickness="1" Background="Gainsboro">
<StackPanel Margin="5,10,5,5">
<TextBlock Text="Add Existing Property:"></TextBlock>
<ListBox BorderBrush="Black" BorderThickness="1" Background="White" Margin="5" Padding="4" Width="130"
ItemsSource="{Binding Path=AvailableProperties}" ><!--SelectionChanged="Selector_OnSelectionChanged">-->
<ListBox.ItemTemplate>
<DataTemplate>
<ListBoxItem Margin="2">
<StackPanel Orientation="Horizontal">
<Image Source="{Binding Icon, Converter={StaticResource ImageToSourceConverter}}" Width="12" Height="12" Margin="3" VerticalAlignment="Center"/>
<TextBlock Text="{Binding Name}" VerticalAlignment="Center"></TextBlock>
</StackPanel>
</ListBoxItem>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</Border>
</Popup>
【问题讨论】: