xaml – 如何在Win10 Universal应用程序中禁用GridView / ListVi
发布时间:2020-12-14 05:44:57 所属栏目:Windows 来源:网络整理
导读:过去我可以通过编辑项目容器样式并删除故事板动画来取消GridView / ListView上的倾斜效果. 但是,当我在Win10 Universal应用程序上编辑模板时,我没有看到任何故事板.我在哪里可以取消动画? 这是为我生成的样式(使用时,不会禁用动画): Style x:Key="ListView
过去我可以通过编辑项目容器样式并删除故事板动画来取消GridView / ListView上的倾斜效果.
但是,当我在Win10 Universal应用程序上编辑模板时,我没有看到任何故事板.我在哪里可以取消动画? 这是为我生成的样式(使用时,不会禁用动画): <Style x:Key="ListViewItemStyle1" TargetType="ListViewItem"> <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/> <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/> <Setter Property="Background" Value="Transparent"/> <Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/> <Setter Property="TabNavigation" Value="Local"/> <Setter Property="IsHoldingEnabled" Value="True"/> <Setter Property="Padding" Value="12,12,0"/> <Setter Property="HorizontalContentAlignment" Value="Left"/> <Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="MinWidth" Value="{ThemeResource ListViewItemMinWidth}"/> <Setter Property="MinHeight" Value="{ThemeResource ListViewItemMinHeight}"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ListViewItem"> <ListViewItemPresenter CheckBrush="{ThemeResource SystemControlForegroundBaseMediumHighBrush}" ContentMargin="{TemplateBinding Padding}" CheckMode="Inline" ContentTransitions="{TemplateBinding ContentTransitions}" CheckBoxBrush="{ThemeResource SystemControlForegroundBaseMediumHighBrush}" DragForeground="{ThemeResource ListViewItemDragForegroundThemeBrush}" DragOpacity="{ThemeResource ListViewItemDragThemeOpacity}" DragBackground="{ThemeResource ListViewItemDragBackgroundThemeBrush}" DisabledOpacity="{ThemeResource ListViewItemDisabledThemeOpacity}" FocusBorderBrush="{ThemeResource SystemControlForegroundAltHighBrush}" FocusSecondaryBorderBrush="{ThemeResource SystemControlForegroundBaseHighBrush}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" PointerOverForeground="{ThemeResource SystemControlHighlightAltBaseHighBrush}" PressedBackground="{ThemeResource SystemControlHighlightListMediumBrush}" PlaceholderBackground="{ThemeResource ListViewItemPlaceholderBackgroundThemeBrush}" PointerOverBackground="{ThemeResource SystemControlHighlightListLowBrush}" ReorderHintOffset="{ThemeResource ListViewItemReorderHintThemeOffset}" SelectedPressedBackground="{ThemeResource SystemControlHighlightListAccentHighBrush}" SelectionCheckMarkVisualEnabled="True" SelectedForeground="{ThemeResource SystemControlHighlightAltBaseHighBrush}" SelectedPointerOverBackground="{ThemeResource SystemControlHighlightListAccentMediumBrush}" SelectedBackground="{ThemeResource SystemControlHighlightListAccentLowBrush}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/> </ControlTemplate> </Setter.Value> </Setter> </Style> 解决方法
一种方法是通过插入另一个Control来阻止ListViewItem的交互.
例如,使用具有以下几乎为空的样式的Button将内容包装在ItemTemplate中. <Style x:Key="EmptyButtonStyle" TargetType="Button"> <Setter Property="Background" Value="Transparent" /> <Setter Property="HorizontalAlignment" Value="Stretch" /> <Setter Property="VerticalAlignment" Value="Stretch" /> <Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="VerticalContentAlignment" Value="Stretch" /> <Setter Property="UseSystemFocusVisuals" Value="False" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Grid x:Name="RootGrid" Background="{TemplateBinding Background}"> <ContentPresenter x:Name="ContentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" /> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> <DataTemplate x:Name="ListViewItemTemplate"> <Button Style="{StaticResource EmptyButtonStyle}"> <!-- Put your original stuff here --> </Button> </DataTemplate> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- windows-phone-7 – 具有相同GUID的Windows手机应用程序 –
- 如何在.NET自定义操作中使用企业库日志记录
- windows-installer – 有没有办法强制“随机”MSI进行单个用
- Windows/Linux命令查看文件MD5,SHA1,SHA256 文件校验
- windows – 太字节数据的异地备份
- cmd – 如何记录Windows XP命令行应用程序中显示的文本
- windows – 向管理员组外的用户授予服务控制管理员访问权限
- laravel homestead共享文件夹的主机路径在Windows 7上丢失错
- Windows – 通过LAN从另一台机器访问虚拟主机
- 如何使用Aurelia Fetch Client查询受Windows身份验证保护的
推荐文章
站长推荐
- windows-server-2008-r2 – Win2k8R2获取DHCPv6地
- GCP - Running Windows Server Failover Cluster
- Microsoft BizTalk Server与Azure AppFabric Ser
- windows-server-2008-r2 – 解决Windows EAP / R
- Serv-U报“许可侵犯”的解决办法
- win7即将停止服务,升级到win10最详细的图文教程
- windows系统编辑过的脚本文件,在linxu上执行报错
- 20164301 Exp2 后门原理与实践
- winapi – 如何将密钥笔划发送到窗口而不必使用W
- 39 路径分析小练习
热点阅读