Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ItemsControl的单一选择模式_C#_Wpf_User Interface_Xaml_Selection - Fatal编程技术网

C# ItemsControl的单一选择模式

C# ItemsControl的单一选择模式,c#,wpf,user-interface,xaml,selection,C#,Wpf,User Interface,Xaml,Selection,有没有办法让WPF C#SingleSelect中的ItemsControl与列表框中的类似 谢谢如果您想要选择,请使用列表框,这就是它的用途。ListBox不能做ItemsControl所能做的事情。ListBox是ItemsControl。既然它已经是单选的,你为什么不直接使用它呢?您可以让ListBox显示任意的WPF对象,使用DataTemplate来形成它的项,等等。我试过了,但它似乎不能很好地接受……样式需要以ListBoxItem类型为目标。示例:如果希望将内容放入ListBoxI

有没有办法让WPF C#SingleSelect中的ItemsControl与列表框中的类似


谢谢

如果您想要选择,请使用列表框,这就是它的用途。ListBox不能做ItemsControl所能做的事情。

ListBox是ItemsControl。既然它已经是单选的,你为什么不直接使用它呢?您可以让ListBox显示任意的WPF对象,使用DataTemplate来形成它的项,等等。我试过了,但它似乎不能很好地接受……样式需要以ListBoxItem类型为目标。示例:如果希望将内容放入ListBoxItems,请使用DataTemplate,如以下示例:问题是我希望ListBoxItems是三态ToggleButtons,其中ItemsSource绑定到ToggleButton的ToggleButton.content属性