1
ItemsControlにSingle Selectionモードを使用しようとしています。だから私はItemsControlをListBoxに変更しましたが、例外が発生しました。 "'ContentPresenter'型のスタイルは 'ListBoxItem'の型には適用できません。ここに何がありますか? ListBoxにContentPresenterを使用できないのですか?ListBox付きContentPresenter
<ListBox SelectionMode="Single" ItemsSource="{Binding}" MinHeight="200" MinWidth="200">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid></UniformGrid>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemContainerStyle>
<Style TargetType="ContentPresenter">
<Setter Property="Grid.Row" Value="{Binding X}" />
<Setter Property="Grid.Column" Value="{Binding Y}" />
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate DataType="ObservableCollection">
<Border BorderBrush="Black" BorderThickness="0.5" Background="Beige">
<clr:Cell Content="{Binding Character}"></clr:Cell>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
質問がVisual Studio自体と関係がない場合は、タグを使用しないでください。 –