WPF ListView turn off selection -
I have a simple WPF ListView and a simple question:
Is it possible to turn off the selection? , When the user clicks on the line, the row is not highlighted?
me 1 Looks like a row, looks like row 1.
Probably related: can I show hover / selection form? for example. I have found to replace the blue shield hover look (line 3) with a custom solid color and unfortunately not.
is acceptable to achieve it without using (ListView. I just want to do as Suchiiwu use logical scrolling and UI virtualization I)
lot for your help thanks a lot.
There is XAML for the list view:
& lt; ListView Height = "280" name = "list view" & gt; & Lt; ListView.Resources & gt; & Lt ;! - Attempt to override selection color - & gt; & Lt; Solid Coiler Brush x: Key = "{x: Static System Colors.} Highlight Calls" "Color =" Green "/> & Lt; /ListView.Resources> & Lt; ListView.View & gt; & Lt; GridView & gt; & Lt; GridView.Columns & gt; & Lt; GridViewColumn header = "name" DisplayMemberBinding = "{binding name}" /> & Lt ;! - more columns - & gt; & Lt; /GridView.Columns> & Lt; / GridView & gt; & Lt; /ListView.View> & Lt; / ListView & gt; After text "itemprop =" text "> comment per Martin Konasek, in order to disable the selection of items in a completely straightforward way.
To:
& lt; ListView & gt; & Lt; ListView.ItemContainerStyle & gt; & Lt; Style TargetType = "ListViewItem" & gt; & Lt; Setter Property = "Focusable" value = "False" /> & Lt; / Style & gt; & Lt; /ListView.ItemContainerStyle> ... & lt; / ListView & gt;
However if you still need the functionality of ListView, like being able to select an item, then you can visually disable the styling of selected items like:
You can do this in many ways, by changing the listing settings, just to set a style (very easy). . ListView & gt; You can create a style for ListViewItems using the background and border brush 'Close'
& lt; & Lt; ListView.ItemContainerStyle & gt; & Lt; Style TargetType = "{x: Type List ViewItem}" & gt; & Lt; Style.Triggers & gt; & Lt; Trigger Property = "Iceded" value = "true" & gt; & Lt; Setter property = "background" value = "{x: faucet}" /> & Lt; Setter Property = "Borderbrush" Value = "{x: Faucet}" /> & Lt; / Catalyst & gt; & Lt; /Style.Triggers> & Lt; / Style & gt; & Lt; /ListView.ItemContainerStyle> ... & lt; / ListView & gt;
Also, unless you select a item when you can add a column (or simply to test) to represent the value in another way of notifying the user Is for:
& lt; GridViewColumn header = "IsSelected" DisplayMemberBinding = "{Binding RelativeSource = {RelativeSource mode = FindAncestor, AncestorType = {x: Type ListViewItem}}, path = IsSelected}" / & gt;
Comments
Post a Comment