如何将前景显示点改为长条?进度条

问题描述 投票:0回答:1

官方UWP ProgressBar控件:https://learn.microsoft.com/zh-cn/windows/apps/design/controls/progress-controls

演示秀: enter image description here

但是我得到的是这样的:

我怎样才能改变它?

uwp winui
1个回答
0
投票

我可以重现你的问题。所以有两个进度条:默认一个(虚线)是原生uwp,另一个(你想得到的)是Winui2 nuget包自带的。

如何安装和添加nuget:

  1. 在解决方案资源管理器中右键单击您的项目
  2. 点击管理 nuget 包
  3. 搜索 Microsoft.Ui.Xaml nuget 并安装它
  4. 将此代码添加到应用程序标签内的 app.xaml 中以引用 winui2 控件:
<Application.Resources>
     <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
</Application.Resources>
  1. 将对 Microsoft.UI.Xaml.Controls 命名空间的引用作为 muxc 添加到您的主页:
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
  1. 从 muxc 命名空间添加进度条:
<muxc:ProgressBar Width="150" IsIndeterminate="True"/>
© www.soinside.com 2019 - 2024. All rights reserved.