Peter Gustafsson

Is thera a way to use ListView to view one of the columns on a single row

I want to move the content of col3 to a single row:

orignal:


Re: Windows Presentation Foundation (WPF) ListView, span over multiple columns

lee d

you can change the template of the ListViewItem, the Listview is bound to a datatable in this sample, you are going to use appropriate binding expression in your case for the highlighted row

<Style TargetType="{x:Type ListViewItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListViewItem}">
<StackPanel>
<GridViewRowPresenter Content="{TemplateBinding Content}" Columns="{TemplateBinding GridView.ColumnCollection}"
/>
<TextBlock Text="{Binding Path=Row[2]}"></TextBlock>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>






Re: Windows Presentation Foundation (WPF) ListView, span over multiple columns

Rod Yager

Is there a way rearrange all the columns into a cardview of the row I tried using the example you gave here Lee and had some success, but some of my values were not appearing. My guess is the path is not right. I tried creating a stack panel with six textblocks all using a different indexes for each one. ie

<TextBlock Text="{Binding Path=Row[0]}"></TextBlock>
<TextBlock Text="{Binding Path=Row[1]}"></TextBlock>
<TextBlock Text="{Binding Path=Row[2]}"></TextBlock>
<TextBlock Text="{Binding Path=Row[3]}"></TextBlock>
<TextBlock Text="{Binding Path=Row[4]}"></TextBlock>
<TextBlock Text="{Binding Path=Row[5]}"></TextBlock>

I am trying to provide a method for viewing the listviewitem in a way that the user would not have to scroll to view all the columns. Something like the HealthCareDemo but allowing for the template to be dynamic for all listviews regardless of how many columns or their xpaths. Perhaps by using a wrappanel or something.

Any ideas





Re: Windows Presentation Foundation (WPF) ListView, span over multiple columns

Anonymous

Have you found the solution




Re: Windows Presentation Foundation (WPF) ListView, span over multiple columns