修复Win10上ListView样式不正确的问题

news/2024/10/5 8:31:46/文章来源:https://www.cnblogs.com/BettaFish/p/18274832

在Windows 11下,使用WinUI2.6以上版本的ListView长这样:

然而到了Win10上,尽管其他控件的样式没有改变,但ListViewItem变成了默认样式(初代Fluent)
最重大的问题是,Win10上的HorizontalAlignment未被设置成Stretch,可能造成严重的UI错位(隔壁livelyweather也有这个问题)。

这疑似是Win10上未使用正确的资源造成的。


为了解决此问题,我们可以在App.xaml中的App.Resources中添加以下样式(从VS Blender复制),并将其作为ListViewItem的默认样式即可
注:此处使用了条件XAML语句,这样在Win11上就可以使用自带的样式(似乎多一点动画),将contract13NotPresent删去问题也不大

xmlns:contract13NotPresent="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractNotPresent(Windows.Foundation.UniversalApiContract,13)">
    <contract13NotPresent:Style BasedOn="{StaticResource Win11ListViewItemStyle}" TargetType="ListViewItem" /><Thickness x:Key="ListItemMargin">4</Thickness><Style x:Key="Win11ListViewItemStyle"  TargetType="ListViewItem"><Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/><Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/><Setter Property="BorderBrush" Value="{x:Null}"/><Setter Property="BorderThickness" Value="0"/><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,0,12,0"/><Setter Property="HorizontalContentAlignment" Value="Stretch"/><Setter Property="VerticalContentAlignment" Value="Center"/><Setter Property="MinWidth" Value="{ThemeResource ListViewItemMinWidth}"/><Setter Property="MinHeight" Value="{ThemeResource ListViewItemMinHeight}"/><Setter Property="MaxWidth" Value="1224"/><Setter Property="AllowDrop" Value="False"/><Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}"/><Setter Property="FocusVisualMargin" Value="0"/><Setter Property="CornerRadius" Value="{StaticResource ControlCornerRadius}"/><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="ListViewItem"><Grid x:Name="ContentBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}" FocusVisualMargin="{TemplateBinding FocusVisualMargin}" Control.IsTemplateFocusTarget="True" Margin="{StaticResource ListItemMargin}" RenderTransformOrigin="0.5,0.5"><Grid.RenderTransform><ScaleTransform x:Name="ContentBorderScale"/></Grid.RenderTransform><VisualStateManager.VisualStateGroups><VisualStateGroup x:Name="CommonStates"><VisualState x:Name="Normal"><Storyboard><PointerUpThemeAnimation Storyboard.TargetName="ContentPresenter"/></Storyboard></VisualState><VisualState x:Name="PointerOver"><Storyboard><DoubleAnimation Duration="0" Storyboard.TargetName="BorderBackground" To="0.6" Storyboard.TargetProperty="Opacity"/><ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderBackground" Storyboard.TargetProperty="Background"><DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightListLowBrush}"/></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground"><DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}"/></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="MultiSelectSquare" Storyboard.TargetProperty="BorderBrush"><DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}"/></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="MultiSelectCheck" Storyboard.TargetProperty="Foreground"><DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}"/></ObjectAnimationUsingKeyFrames><PointerUpThemeAnimation Storyboard.TargetName="ContentPresenter"/></Storyboard></VisualState><VisualState x:Name="Pressed"><Storyboard><DoubleAnimation Duration="0" Storyboard.TargetName="BorderBackground" To="0.6" Storyboard.TargetProperty="Opacity"/><ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderBackground" Storyboard.TargetProperty="Background"><DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightListLowBrush}"/></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground"><DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}"/></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="MultiSelectSquare" Storyboard.TargetProperty="BorderBrush"><DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}"/></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="MultiSelectCheck" Storyboard.TargetProperty="Foreground"><DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}"/></ObjectAnimationUsingKeyFrames><PointerDownThemeAnimation TargetName="ContentPresenter"/></Storyboard></VisualState><VisualState x:Name="Selected"><Storyboard><DoubleAnimation Duration="0:0:0" Storyboard.TargetName="MultiSelectCheck" To="1" Storyboard.TargetProperty="Opacity"/><DoubleAnimation Duration="0" Storyboard.TargetName="BorderBackground" To="0.6" Storyboard.TargetProperty="Opacity"/><ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderBackground" Storyboard.TargetProperty="Background"><DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightListLowBrush}"/></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderSelected" Storyboard.TargetProperty="Background"><DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemAccentColorLight2}"/></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground"><DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}"/></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="MultiSelectSquare" Storyboard.TargetProperty="BorderBrush"><DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}"/></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="MultiSelectCheck" Storyboard.TargetProperty="Foreground"><DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}"/></ObjectAnimationUsingKeyFrames><PointerUpThemeAnimation Storyboard.TargetName="ContentPresenter"/></Storyboard></VisualState><VisualState x:Name="PointerOverSelected"><Storyboard><DoubleAnimation Duration="0:0:0" Storyboard.TargetName="MultiSelectCheck" To="1" Storyboard.TargetProperty="Opacity"/><DoubleAnimation Duration="0" Storyboard.TargetName="BorderBackground" To="0.5" Storyboard.TargetProperty="Opacity"/><ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderBackground" Storyboard.TargetProperty="Background"><DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightListMediumBrush}"/></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderSelected" Storyboard.TargetProperty="Background"><DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemAccentColorLight2}"/></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground"><DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}"/></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="MultiSelectSquare" Storyboard.TargetProperty="BorderBrush"><DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}"/></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="MultiSelectCheck" Storyboard.TargetProperty="Foreground"><DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}"/></ObjectAnimationUsingKeyFrames><PointerUpThemeAnimation Storyboard.TargetName="ContentPresenter"/></Storyboard></VisualState><VisualState x:Name="PressedSelected"><Storyboard><DoubleAnimation Duration="0:0:0" Storyboard.TargetName="MultiSelectCheck" To="1" Storyboard.TargetProperty="Opacity"/><DoubleAnimation Duration="0" Storyboard.TargetName="BorderBackground" To="0.6" Storyboard.TargetProperty="Opacity"/><ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderBackground" Storyboard.TargetProperty="Background"><DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightListMediumBrush}"/></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderSelected" Storyboard.TargetProperty="Background"><DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemAccentColorLight2}"/></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground"><DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}"/></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="MultiSelectSquare" Storyboard.TargetProperty="BorderBrush"><DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}"/></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="MultiSelectCheck" Storyboard.TargetProperty="Foreground"><DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}"/></ObjectAnimationUsingKeyFrames><PointerDownThemeAnimation TargetName="ContentPresenter"/></Storyboard></VisualState></VisualStateGroup><VisualStateGroup x:Name="DisabledStates"><VisualState x:Name="Enabled"/><VisualState x:Name="Disabled"><Storyboard><DoubleAnimation Duration="0" Storyboard.TargetName="ContentBorder" To="{ThemeResource ListViewItemDisabledThemeOpacity}" Storyboard.TargetProperty="Opacity"/></Storyboard></VisualState></VisualStateGroup><VisualStateGroup x:Name="MultiSelectStates"><VisualState x:Name="MultiSelectDisabled"><Storyboard><DoubleAnimationUsingKeyFrames Storyboard.TargetName="MultiSelectCheckBoxTransform" Storyboard.TargetProperty="X"><EasingDoubleKeyFrame KeyTime="0:0:0" Value="0"/><SplineDoubleKeyFrame KeyTime="0:0:0.333" KeySpline="0.1,0.9,0.2,1" Value="-32"/></DoubleAnimationUsingKeyFrames><DoubleAnimationUsingKeyFrames Storyboard.TargetName="MultiSelectClipTransform" Storyboard.TargetProperty="X"><EasingDoubleKeyFrame KeyTime="0:0:0" Value="0"/><SplineDoubleKeyFrame KeyTime="0:0:0.333" KeySpline="0.1,0.9,0.2,1" Value="32"/></DoubleAnimationUsingKeyFrames><DoubleAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenterTranslateTransform" Storyboard.TargetProperty="X"><EasingDoubleKeyFrame KeyTime="0:0:0" Value="32"/><SplineDoubleKeyFrame KeyTime="0:0:0.333" KeySpline="0.1,0.9,0.2,1" Value="0"/></DoubleAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="MultiSelectSquare" Storyboard.TargetProperty="Visibility"><DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/><DiscreteObjectKeyFrame KeyTime="0:0:0.333" Value="Collapsed"/></ObjectAnimationUsingKeyFrames></Storyboard></VisualState><VisualState x:Name="MultiSelectEnabled"><Storyboard><DoubleAnimationUsingKeyFrames Storyboard.TargetName="MultiSelectCheckBoxTransform" Storyboard.TargetProperty="X"><EasingDoubleKeyFrame KeyTime="0:0:0" Value="-32"/><SplineDoubleKeyFrame KeyTime="0:0:0.333" KeySpline="0.1,0.9,0.2,1" Value="0"/></DoubleAnimationUsingKeyFrames><DoubleAnimationUsingKeyFrames Storyboard.TargetName="MultiSelectClipTransform" Storyboard.TargetProperty="X"><EasingDoubleKeyFrame KeyTime="0:0:0" Value="32"/><SplineDoubleKeyFrame KeyTime="0:0:0.333" KeySpline="0.1,0.9,0.2,1" Value="0"/></DoubleAnimationUsingKeyFrames><DoubleAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenterTranslateTransform" Storyboard.TargetProperty="X"><EasingDoubleKeyFrame KeyTime="0:0:0" Value="-32"/><SplineDoubleKeyFrame KeyTime="0:0:0.333" KeySpline="0.1,0.9,0.2,1" Value="0"/></DoubleAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="MultiSelectSquare" Storyboard.TargetProperty="Visibility"><DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="MultiSelectCheck" Storyboard.TargetProperty="Visibility"><DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenterGrid" Storyboard.TargetProperty="Margin"><DiscreteObjectKeyFrame KeyTime="0" Value="32,0,0,0"/></ObjectAnimationUsingKeyFrames></Storyboard></VisualState></VisualStateGroup><VisualStateGroup x:Name="DataVirtualizationStates"><VisualState x:Name="DataAvailable"/><VisualState x:Name="DataPlaceholder"><Storyboard><ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextBlock" Storyboard.TargetProperty="Visibility"><DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderRect" Storyboard.TargetProperty="Visibility"><DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/></ObjectAnimationUsingKeyFrames></Storyboard></VisualState></VisualStateGroup><VisualStateGroup x:Name="ReorderHintStates"><VisualStateGroup.Transitions><VisualTransition GeneratedDuration="0:0:0.2" To="NoReorderHint"/></VisualStateGroup.Transitions><VisualState x:Name="NoReorderHint"/><VisualState x:Name="BottomReorderHint"><Storyboard><DragOverThemeAnimation Direction="Bottom" ToOffset="{ThemeResource ListViewItemReorderHintThemeOffset}" TargetName="ContentBorder"/></Storyboard></VisualState><VisualState x:Name="TopReorderHint"><Storyboard><DragOverThemeAnimation Direction="Top" ToOffset="{ThemeResource ListViewItemReorderHintThemeOffset}" TargetName="ContentBorder"/></Storyboard></VisualState><VisualState x:Name="RightReorderHint"><Storyboard><DragOverThemeAnimation Direction="Right" ToOffset="{ThemeResource ListViewItemReorderHintThemeOffset}" TargetName="ContentBorder"/></Storyboard></VisualState><VisualState x:Name="LeftReorderHint"><Storyboard><DragOverThemeAnimation Direction="Left" ToOffset="{ThemeResource ListViewItemReorderHintThemeOffset}" TargetName="ContentBorder"/></Storyboard></VisualState></VisualStateGroup><VisualStateGroup x:Name="DragStates"><VisualStateGroup.Transitions><VisualTransition GeneratedDuration="0:0:0.2" To="NotDragging"/></VisualStateGroup.Transitions><VisualState x:Name="NotDragging"/><VisualState x:Name="Dragging"><Storyboard><DoubleAnimation Duration="0" Storyboard.TargetName="ContentBorder" To="{ThemeResource ListViewItemDragThemeOpacity}" Storyboard.TargetProperty="Opacity"/><DragItemThemeAnimation TargetName="ContentBorder"/></Storyboard></VisualState><VisualState x:Name="DraggingTarget"/><VisualState x:Name="MultipleDraggingPrimary"><Storyboard><DoubleAnimation Duration="0" Storyboard.TargetName="MultiArrangeOverlayText" To="1" Storyboard.TargetProperty="Opacity"/><DoubleAnimation Duration="0" Storyboard.TargetName="MultiArrangeOverlayTextBorder" To="1" Storyboard.TargetProperty="Opacity"/><DoubleAnimation Duration="0" Storyboard.TargetName="MultiSelectSquare" To="0" Storyboard.TargetProperty="Opacity"/><DoubleAnimation Duration="0" Storyboard.TargetName="MultiSelectCheck" To="0" Storyboard.TargetProperty="Opacity"/><DoubleAnimation Duration="0" Storyboard.TargetName="ContentBorder" To="{ThemeResource ListViewItemDragThemeOpacity}" Storyboard.TargetProperty="Opacity"/><FadeInThemeAnimation TargetName="MultiArrangeOverlayText"/><FadeInThemeAnimation TargetName="MultiArrangeOverlayTextBorder"/><DragItemThemeAnimation TargetName="ContentBorder"/></Storyboard></VisualState><VisualState x:Name="MultipleDraggingSecondary"/><VisualState x:Name="DraggedPlaceholder"/><VisualState x:Name="Reordering"><Storyboard><DoubleAnimation Duration="0:0:0.240" Storyboard.TargetName="ContentBorder" To="{ThemeResource ListViewItemReorderThemeOpacity}" Storyboard.TargetProperty="Opacity"/></Storyboard></VisualState><VisualState x:Name="ReorderingTarget"><Storyboard><DoubleAnimation Duration="0:0:0.240" Storyboard.TargetName="ContentBorder" To="{ThemeResource ListViewItemReorderTargetThemeOpacity}" Storyboard.TargetProperty="Opacity"/><DoubleAnimation Duration="0:0:0.240" Storyboard.TargetName="ContentBorderScale" To="{ThemeResource ListViewItemReorderTargetThemeScale}" Storyboard.TargetProperty="ScaleX"/><DoubleAnimation Duration="0:0:0.240" Storyboard.TargetName="ContentBorderScale" To="{ThemeResource ListViewItemReorderTargetThemeScale}" Storyboard.TargetProperty="ScaleY"/></Storyboard></VisualState><VisualState x:Name="MultipleReorderingPrimary"><Storyboard><DoubleAnimation Duration="0" Storyboard.TargetName="MultiArrangeOverlayText" To="1" Storyboard.TargetProperty="Opacity"/><DoubleAnimation Duration="0" Storyboard.TargetName="MultiArrangeOverlayTextBorder" To="1" Storyboard.TargetProperty="Opacity"/><DoubleAnimation Duration="0" Storyboard.TargetName="MultiSelectSquare" To="0" Storyboard.TargetProperty="Opacity"/><DoubleAnimation Duration="0" Storyboard.TargetName="MultiSelectCheck" To="0" Storyboard.TargetProperty="Opacity"/><DoubleAnimation Duration="0:0:0.240" Storyboard.TargetName="ContentBorder" To="{ThemeResource ListViewItemDragThemeOpacity}" Storyboard.TargetProperty="Opacity"/><FadeInThemeAnimation TargetName="MultiArrangeOverlayText"/><FadeInThemeAnimation TargetName="MultiArrangeOverlayTextBorder"/></Storyboard></VisualState><VisualState x:Name="ReorderedPlaceholder"><Storyboard><FadeOutThemeAnimation TargetName="ContentBorder"/></Storyboard></VisualState><VisualState x:Name="DragOver"><Storyboard><DropTargetItemThemeAnimation TargetName="ContentBorder"/></Storyboard></VisualState></VisualStateGroup></VisualStateManager.VisualStateGroups><Border x:Name="BorderBackground" Background="{ThemeResource SystemAccentColorDark1}" CornerRadius="{TemplateBinding CornerRadius}" IsHitTestVisible="False" Control.IsTemplateFocusTarget="True" Opacity="0"/><Border x:Name="BorderSelected" Background="Transparent" CornerRadius="2" HorizontalAlignment="Left" IsHitTestVisible="False" Control.IsTemplateFocusTarget="True" Margin="0,20" Width="3"/><Grid x:Name="ContentPresenterGrid" Background="Transparent" Margin="0,0,0,0"><Grid.RenderTransform><TranslateTransform x:Name="ContentPresenterTranslateTransform"/></Grid.RenderTransform><ContentPresenter x:Name="ContentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentTransitions="{TemplateBinding ContentTransitions}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/></Grid><TextBlock x:Name="PlaceholderTextBlock" AutomationProperties.AccessibilityView="Raw" Foreground="{x:Null}" IsHitTestVisible="False" Margin="{TemplateBinding Padding}" Opacity="0" Text="Xg"/><Rectangle x:Name="PlaceholderRect" Fill="{ThemeResource ListViewItemPlaceholderBackground}" Visibility="Collapsed"/><Border x:Name="MultiSelectSquare" BorderBrush="{ThemeResource SystemControlForegroundBaseMediumHighBrush}" BorderThickness="2" HorizontalAlignment="Left" Height="20" Margin="12,0,0,0" VerticalAlignment="Center" Visibility="Collapsed" Width="20"><Border.Clip><RectangleGeometry Rect="0,0,20,20"><RectangleGeometry.Transform><TranslateTransform x:Name="MultiSelectClipTransform"/></RectangleGeometry.Transform></RectangleGeometry></Border.Clip><Border.RenderTransform><TranslateTransform x:Name="MultiSelectCheckBoxTransform"/></Border.RenderTransform><FontIcon x:Name="MultiSelectCheck" Foreground="{ThemeResource SystemControlForegroundBaseMediumHighBrush}" FontFamily="{ThemeResource SymbolThemeFontFamily}" FontSize="16" Glyph="&#xE73E;" Opacity="0" Visibility="Collapsed"/></Border><Border x:Name="MultiArrangeOverlayTextBorder" Background="{ThemeResource SystemControlBackgroundAccentBrush}" BorderBrush="{ThemeResource SystemControlBackgroundChromeWhiteBrush}" BorderThickness="2" HorizontalAlignment="Left" Height="20" IsHitTestVisible="False" Margin="12,0,0,0" MinWidth="20" Opacity="0" VerticalAlignment="Center"><TextBlock x:Name="MultiArrangeOverlayText" AutomationProperties.AccessibilityView="Raw" HorizontalAlignment="Center" IsHitTestVisible="False" Opacity="0" Style="{ThemeResource CaptionTextBlockStyle}" Text="{Binding TemplateSettings.DragItemsCount, RelativeSource={RelativeSource Mode=TemplatedParent}}" VerticalAlignment="Center"/></Border></Grid></ControlTemplate></Setter.Value></Setter></Style>

最终效果(Win10):

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/733486.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Asp.Net Core 使用IBrowserFile完成图片上传

Asp.Net Core 使用IBrowserFile完成图片上传 写在开头 前几天弄自己的项目时遇到的问题,发现了asp.net core 新增的IBrowserFile接口,事实上他可以满足大多数文件的上传,此处我仅以图片作为示例。 实现 添加一个帮助类FileHelper,遵循一种规范,即将静态文件资源存放至wwwro…

Transformer 能代替图神经网络吗?

当Transformer模型发布时,它彻底革新了机器翻译领域。虽然最初是为特定任务设计的,但这种革命性的架构显示出它可以轻松适应不同的任务。随后成为了Transformer一个标准,甚至用于它最初设计之外的数据(如图像和其他序列数据)。 然后人们也开始优化和寻找替代方案,主要是为…

从零开始的 DP 学习记录

为了补上我dp的短板(其实说真的dp约等于没学过,板都没有的那种),也为了以后复习dp不会再忘记dp怎么写,dp的各种思想是怎么来的,从零开始学习 dp ,并记录在此博客。 因为要补的东西也挺多的,就不多开文章了,直接在这里记录了。 当然也会记录日常生活 大概是首发于洛谷博…

【Linux系列】 Bash 重定向中 file 21 和 21 file 的区别

一、 写在前面 在 Bash 脚本和命令行操作中,输出重定向是一项基本且强大的功能。 它允许用户控制命令的输出流,将数据从一个地方转移到另一个地方,实现更加灵活和高效的工作流程。 本文旨在记录 Bash 中几种常见的输出重定向方法,包括:> file>file 2>&1 vs 2&…

c#实现定时从外部服务器获取文件并查重(MD5)

需求:需要定时去请求外部服务器的文件,看看每天是否有新的文件上传,如果有就下载到本地服务器,并记录数据。原来的文件重命名。 方案:这里通过文件的MD5和其他条件来判断文件是否存在。因为文件量过大,所以批量下载的时候有时候会出现部分文件没能下载成功,但是数据入库…

Qt开发笔记:Qt3D三维开发笔记(一):Qt3D三维开发基础概念介绍

前言Qt3D是qt的三维,Q3D是Qt的三维图表,Qt3D是qt的自带的三维开发框架,Qt的3D开发分为opengl、Qt3D然后是第三方三维框架(OSG、vtk等等)多个技术流。  本篇描述Qt3D的基础概念,有一个基本知识。 个人经验,仅供参考(持续更新)通过深入研究和实践,从中长期看采取第三方…

VuePress日常使用

本篇来讲解下更多关于 VuePress 的基本用法本篇来讲解下更多关于 VuePress 的基本用法 ‍ 配置首页 现在的页面太简单了,我们可以对项目首页进行配置,修改 docs/README.md (这些配置是什么后面会说): --- home: true heroImage: https://s3.bmp.ovh/imgs/2022/12/02/bc742…

win10系统新建文件夹需刷新才能显示?原因及解决方法

在Win10操作系统中,一些用户可能会遇到这样一个问题:新建的文件夹在资源管理器中不会立即显示,需要刷新后才能看到。这给用户的日常操作带来了一定的困扰。接下来,系统世界官网将为您解析这一问题的原因以及相应的解决方法。一、原因分析1. 资源管理器缓存问题:在Win10系统…

【YOLOv8改进-损失函数】SlideLoss损失函数,解决样本不平衡问题

YOLO-FaceV2是基于YOLOv5的实时人脸检测模型,采用RFE模块增强小人脸检测,NWD损失处理定位偏差,SEAM注意力模块应对遮挡,Slide Loss解决样本不平衡,提升对难样本的关注。在WiderFace数据集上超越YOLO系列。论文和代码已公开。Slide Loss通过IoU加权,优化边界样本,提高模型…

使用Device Mapper创建线性阵列

​ 在之前的文章:《QEMU/KVM启动物理分区的Windows并调优》中笔者使用mdadm创建线性阵列,使VM启动物理硬盘分区上的Windows系统。这个做法思路清晰且具有实操性,但根据这个issue,Linux内核上游已将CONFIG_MD_LINEAR编译参数弃置了,这意味着在6.8及以后的内核中将无法使用m…

【YOLOv8改进-卷积Conv】DualConv( Dual Convolutional):用于轻量级深度神经网络的双卷积核

**摘要:**我们提出DualConv,一种融合$3\times3$和$1\times1$卷积的轻量级DNN技术,适用于资源有限的系统。它通过组卷积结合两种卷积核,减少计算和参数量,同时增强准确性。在MobileNetV2上,参数减少54%,CIFAR-100精度仅降0.68%。在YOLOv3中,DualConv提升检测速度并增4.4…

达梦数据库图形化安装

图形化安装(官网https://eco.dameng.com/document/dm/zh-cn/start/dm-instance-linux.html)启用图形化安装界面前需要通过如下命令将图形界面权限放开: Copy[root@localhost mnt]# xhost + access control disabled, clients can connect from any host [root@localhost mnt…