Answer the question
In order to leave comments, you need to log in
How to combine ListView and GridView when setting style for ListView in WPF (C#)?
There is a ListView in which the content from the ObservableCollection is displayed in columns. To display content in columns, a GridView is attached to the ListView, declared in Window.Resources as a static resource:
<GridView x:Key="GridView1">
<GridView.Columns>
<GridViewColumn Header="Имя" DisplayMemberBinding="{Binding Path=Name}"></GridViewColumn>
<GridViewColumn Header="Тип" DisplayMemberBinding="{Binding Path=Type}" Width="60"></GridViewColumn>
<GridViewColumn Header="Размер" DisplayMemberBinding="{Binding Path=Size}" Width="60"></GridViewColumn>
<GridViewColumn Header="Дата" DisplayMemberBinding="{Binding Path=Date}" Width="130"></GridViewColumn>
</GridView.Columns>
</GridView>
<ListView View="{StaticResource GridView1}" Name="folderPanel1"></ListView>
<Style TargetType="{x:Type ListView}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListView}">
<Border
Name="Button"
Background="{StaticResource ListViewBackgroundBrush}"
BorderBrush="{StaticResource StandartBorderBrush}"
BorderThickness="1" CornerRadius="3">
<ScrollViewer Focusable="False">
<ItemsPresenter Margin="2"></ItemsPresenter>
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Answer the question
In order to leave comments, you need to log in
Try
<ScrollViewer Style="{DynamicResource {x:Static GridView.GridViewScrollViewerStyleKey}}" Focusable="False">
<ItemsPresenter Margin="2"/>
</ScrollViewer>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question