2025年8月8日
摘要:
实现自定义DataCommands类,让其支持空Command。 public class DataCommands : IRelayCommand { public string? Name { get; set; } public KeyGesture? Gesture { get; set;
阅读全文
posted @ 2025-08-08 13:48
dalgleish
阅读(40)
推荐(0)
摘要:
自定义Command,默认继承于ICommand,之后的扩展会继承IRelayCommand,这样可以使用属性。[NotifyCanExecuteChangedFor(nameof(XXXX))] CustomCommand.axaml代码 <Window xmlns="https://github
阅读全文
posted @ 2025-08-08 10:44
dalgleish
阅读(46)
推荐(0)
摘要:
ToolBar就用Github开源的组件,请大家务必尊重开源精神,如果使用了,请贴出出处。 https://github.com/Tulesha/Avalonia.Controls.ToolBar 稍微整理了下代码,把组件整合到了项目里,其中我的App.axaml配置如下,改成了FluentThem
阅读全文
posted @ 2025-08-08 09:55
dalgleish
阅读(30)
推荐(0)
2025年8月6日
摘要:
扩展已更新 TestNewCommand.axaml代码 <Window xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://sche
阅读全文
posted @ 2025-08-06 11:56
dalgleish
阅读(14)
推荐(0)
2025年8月5日
摘要:
C# avalonia没有内置FontChooser,自己实现一个就行了。增加了预览功能。 FontChooser类 public class FontChooser : UserControl { public static readonly StyledProperty<FontFamily>
阅读全文
posted @ 2025-08-05 13:51
dalgleish
阅读(15)
推荐(0)
摘要:
例子也绑定了自定义类,系统类同理,目前Avalonia不支持绑定结构。 BindToFont.axaml代码 <Window xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/
阅读全文
posted @ 2025-08-05 12:50
dalgleish
阅读(32)
推荐(0)
摘要:
C# avalonia的绑定,是预编译绑定,所以比Maui会强很多。采用Avalonia支持的绑定语法。 MultipleBindings.axaml代码 <Window xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.mi
阅读全文
posted @ 2025-08-05 07:58
dalgleish
阅读(69)
推荐(0)
摘要:
MVVM开发的优势就是绑定,所以大家要好好运用绑定。我已经帮大家写好了AvaloniaObject的扩展用于解除和判断绑定。 https://www.cnblogs.com/dalgleish/p/19022485 ElementToElementBinding.axaml代码 <Window xm
阅读全文
posted @ 2025-08-05 07:24
dalgleish
阅读(12)
推荐(0)
摘要:
C# avalonia没有内置判断属性是否绑定的代码,所以我们自己扩展实现一个。这个扩展可以用于动态解绑和绑定属性。基于我写的自定义扩展。 https://www.cnblogs.com/dalgleish/p/18972924 AvaloniaObjectExtensions代码 using Av
阅读全文
posted @ 2025-08-05 07:04
dalgleish
阅读(54)
推荐(0)
2025年8月2日
摘要:
C# avalonia没有内置Mdi,继承Canvas实现一个。增加了选中虚线框功能。Fluent主题中,OnApplyTemplate获取的副本closeButton,无法像Simple主题那样,直接修改属性,因为Fluent主题样式会覆盖。所以,我们可以通过css或者代码产生css样式来控制cl
阅读全文
posted @ 2025-08-02 10:06
dalgleish
阅读(98)
推荐(0)