我有一个带有一些字符串和整数项目的列表框。当按ALT键时,列表项未加行。我已经以ContentPresenter
的样式设置过RecognizesAccessKey="False"
。但这是行不通的。请任何人建议我解决此问题。列表框的值是这样的T1_1。
MainWindow
<ListBox
x:Name="dropListBox"
Grid.Row="1"
Margin="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
AllowDrop="True"
Background="#F8F8F8"
BorderThickness="0"
ItemContainerStyle="{StaticResource ListBoxItemStyle}"
ItemsSource="{Binding DetailsCollection}"
Style="{StaticResource ListBoxStyle}">
<ListBox.ItemTemplate>
<DataTemplate>
<ItemsControl ItemsSource="{Binding Values}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image
Grid.Column="0"
Width="23"
Height="23"
Source="{Binding State, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource IntToImageSourceConverter}}" />
<Label
Grid.Column="1"
Content="{Binding Name}"
FontSize="12" />
<Label
Grid.Column="2"
HorizontalAlignment="Right"
HorizontalContentAlignment="Right"
Content="{Binding CurrentValue}"
FontSize="12" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>