Listview UWP更改列表视图项目高度
如何在Windows 10 UWP应用程序中更改ListView控件中项目的高度 例如,在UWP中,以下内容不会使行高度为20。(WPF问题可能表明这一点,但在UWP XAML中似乎不起作用):Listview UWP更改列表视图项目高度,listview,win-universal-app,uwp,listviewitem,Listview,Win Universal App,Uwp,Listviewitem,如何在Windows 10 UWP应用程序中更改ListView控件中项目的高度 例如,在UWP中,以下内容不会使行高度为20。(WPF问题可能表明这一点,但在UWP XAML中似乎不起作用): 您还需要设置MinHeight属性: <Style TargetType="ListViewItem"> <Setter Property="Height" Value="20" /> <
您还需要设置
MinHeight
属性:
<Style TargetType="ListViewItem">
<Setter Property="Height" Value="20" />
<Setter Property="MinHeight" Value="20" />
</Style>
您还可以覆盖数据模板的样式
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<x:Double x:Key="ListViewItemMinHeight">20</x:Double>
<x:Double x:Key="ListViewItemHeight">20</x:Double>
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</Page.Resources>
20
20
现在删除“高度”属性。
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<x:Double x:Key="ListViewItemMinHeight">20</x:Double>
<x:Double x:Key="ListViewItemHeight">20</x:Double>
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</Page.Resources>