小编Kan*_*n P的帖子

从 UWP 中的 IconElement 或 IconSourceElement 派生

我正在尝试创建与 MS SymbolIcon 相同的自定义符号图标控件,它将获取枚举符号值作为输入,并且将从字典<Symbol, string> 集合中检索等效路径数据值。但是从 IconElement 继承的符号图标类以及我的应用程序中面临的以下相同问题。

“IconElement 不采用带有 0 个参数的构造函数”

从 UWP 中的 IconElement 派生

但我已将我的构造函数标记为 extern 并用分号括起来以解决构造函数问题。

public class CustomSymbolIcon : IconElement
{ 
   public extern CustomSymbolIcon(); 
}
Run Code Online (Sandbox Code Playgroud)

But my question is, I can get input from the end user as Symbol Enum and retrieved equivalent path geometry based on input from the stored dictionary. But I couldn't bind the path geometry to the path element(Targeted Custom icon class)and I can't write the template style for this class. …

c# uwp uwp-xaml winui winui-3

5
推荐指数
1
解决办法
126
查看次数

如何获取 WinUI 3 桌面应用程序的屏幕边界?

我需要在 WinUI 3 桌面应用程序中实现以下要求。

  1. 如何获得屏幕边界?
  2. 如何在运行时更改 Windows 光标类型?

我已经在 WinUI UWP 应用程序中这样做了。

对于屏幕边界,

var visibleBounds = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().VisibleBounds;
var scaleFactor = Windows.Graphics.Display.DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel;
Size screenSize = new Size((visibleBounds.Width * scaleFactor), (visibleBounds.Height * scaleFactor));
Run Code Online (Sandbox Code Playgroud)

对于光标:

Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.SizeNorthwestSoutheast, 0);
Run Code Online (Sandbox Code Playgroud)

有人请建议如何在 WinUI 桌面应用程序中实现相同的要求?

desktop .net-5 winui-3

5
推荐指数
1
解决办法
176
查看次数

标签 统计

winui-3 ×2

.net-5 ×1

c# ×1

desktop ×1

uwp ×1

uwp-xaml ×1

winui ×1