开发者

listbox itemtemplate for selected item

开发者 https://www.devze.com 2022-12-11 01:57 出处:网络
I am using Listbox with ItemTemplate, and when I select an item from the list, it 开发者_JS百科shows blue background

I am using Listbox with ItemTemplate, and when I select an item from the list, it 开发者_JS百科shows blue background How can I style the selected item, to be similar to non-selected one?


I hope you are looking for to remove the blue default ListBox selection. That color is coming from the IsSelected DataTrigger on the ListBoxItem style. You can override that by creating a copy of ListBoxItemStyle, which is ListBox.ItemContainerStyle

Just a little more inside information about a ListBox customization. Basically a ListBox customization includes overriding below styles and templates

  • ListBox.Style - if you want to change the Way the outer shell looks and feel
  • ListBox.ItemTemplate - Set the appropriate DataTemplate to display the Individual properties of a type T, where ListBox.ItemsSource is bind to IEnumerable
  • ListBox.ItemsPanel - Set the ItemsPanelTemplate which contains a Panel so that the items get laid out by the panel. By default it is a StackPanel with orientation is vertical.
  • ListBox.ItemContainerStyle - set the style of the ListBoxItem
0

精彩评论

暂无评论...
验证码 换一张
取 消