WPF ListView column selection -


I have a ListView when I select a line, then I want to have only one cell not the whole line Chosen How can I get this? Here are my styles and templates

  & lt; ListView X:. Name = "list" itemsSource = "{binding}" ItemContainerStyle = "{DynamicResource ListItemStyle}" & gt; & Lt; ListView.View & gt; & Lt; GridViewColumnReorder = "False" & gt; & Lt; GridViewColumn HeaderContainerStyle = "{StaticResource myHeaderStyle}" Header = "1" CellTemplate = "{StaticResource myCellTemplate1}" & gt; & Lt; / GridViewColumn & gt; & Lt; GridViewColumn Header = "2" HeaderContainerStyle = "{StaticResource myHeaderStyle}" HeaderTemplate = "{StaticResource myHeaderTemplate}" CellTemplate = "{StaticResource cellTemplate2}" & gt; & Lt; / GridViewColumn & gt; & Lt; GridViewColumn Header = "3" HeaderContainerStyle = "{StaticResource myHeaderStyle}" HeaderTemplate = "{StaticResource myHeaderTemplate}" CellTemplate = "{StaticResource cellTemplate3}" /> & Lt; GridViewColumn Header = "4" HeaderContainerStyle = "{StaticResource myHeaderStyle}" HeaderTemplate = "{StaticResource myHeaderTemplate}" CellTemplate = "{StaticResource cellTemplate4}" /> & Lt; / GridView & gt; & Lt; /ListView.View> & Lt; / ListView & gt; & Lt; Style x: key = "ListItemStyle" TargetType = "{x: type list viewItem}" & gt; & Lt; Setter Estates = "Template" & gt; & Lt; Setter.Value & gt; & Lt; ControlTemplate TargetType = "{x: type list viewitivity}" & gt; & Lt; Grid snap toolwise pixel = "true" margin = "0" width = "410" x: name = "grid miniature" & gt; & Lt; BorderThickness = "{TemplateBinding BorderThickness}" CornerRadius = "0" /> & Lt; GridViewRowPresenter x: Name = "Rows" /> & Lt; / Grid & gt; & Lt; / ControlTemplate & gt; & Lt; /Setter.Value> & Lt; / Setter & gt; & Lt; Style.Triggers & gt; & Lt; Trigger Property = "Iceded" value = "true" & gt; & Lt; Setter property = "background" value = "yellow" /> & Lt; Setter property = "foreground" value = "black" /> & Lt; / Catalyst & gt; & Lt; Trigger property = "isleded" value = "wrong" & gt; & Lt; Setter Property = "Background" Value = "Black" /> & Lt; Setter property = "foreground" value = "green" /> & Lt; / Catalyst & gt; & Lt; /Style.Triggers> & Lt; / Style & gt; & Lt; DataTemplate x: key = "myCellTemplate1" & gt; & Lt; DataTemplate.Resources & gt; & Lt; Local: NullIdConverter x: key = "NullIdConverterKey" /> & Lt; /DataTemplate.Resources> & Lt; DocPanel X: Name = "RR" & gt; & Lt; TextBlock FontSize = "18" x: name = "TxtBl" horizontal align = "center" text = "{binding path = id}" /> & Lt; / DockPanel & gt; & Lt; / DataTemplate & gt;  

Thanks.

If you are using .NET 3.5 SP1 or .NET 4, Instead of suggesting to search for a datagrid.

I think this gives you more flexibility on your data and has a property in it called the selection utility which you call "cell" which gives you the functionality you want.

Unfortunately, I do not think there is an easy way to do this with list view.


Comments