-
Notifications
You must be signed in to change notification settings - Fork 200
【入门】这是一个配置主窗口示例
HeBianGu edited this page Jul 15, 2024
·
2 revisions
HeBianGu.Window.Main
<h:MainWindow x:Class="HeBianGu.Demo.Demo4.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:h="https://github.com/HeBianGu"
xmlns:local="clr-namespace:HeBianGu.Demo.Demo4"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="这是一个最简单的MainWindow窗口示例"
mc:Ignorable="d">
<!--配置窗口显示和隐藏动画-->
<h:TransitionService.VisibleActions>
<h:TransitionCollection>
<!--<h:HorizontalTransition/>
<h:OpacityTransition/>
<h:ScaleTransition/>-->
<h:NoneTransition/>
</h:TransitionCollection>
</h:TransitionService.VisibleActions>
</h:MainWindow>
public partial class App : ApplicationBase
{
protected override MainWindowBase CreateMainWindow(StartupEventArgs e)
{
return new MainWindow();
}
protected override void ConfigureServices(IServiceCollection services)
{
base.ConfigureServices(services);
// Do :注册动画
services.AddWindowAnimation();
// Do :注册消息,如果不注册则使用弹窗
services.AddMessageProxy();
}
protected override void Configure(IApplicationBuilder app)
{
base.Configure(app);
// Do:设置默认主题
app.UseLocalTheme(l =>
{
// Do :设置默认主色调
l.AccentColor = (Color)ColorConverter.ConvertFromString("#FF0093FF");
// Do :设置默认字体大小
l.DefaultFontSize = 14D;
// Do :设置默认字体大小模式
l.FontSize = FontSize.Small;
// Do :控件默认高度
l.ItemHeight = 36;
// Do :设置行默认高度
l.RowHeight = 40;
// Do :设置控件默认圆角
l.ItemCornerRadius = 5;
// Do :设置启用动态主色调后动态变化的时间间隔
l.AnimalSpeed = 5000;
// Do :设置主色调列表默认选择项
l.AccentColorSelectType = 0;
// Do :设置是否启用动态主色调
l.IsUseAnimal = false;
// Do :设置主题颜色,深色调,浅色调等
l.ThemeType = ThemeType.Light;
// Do :设置控件的默认显示样式,Default、Light、Single等
l.StyleType = StyleType.Default;
// Do :设置默认语言(目前不起作用)
l.Language = Language.Chinese;
// Do :设置主色调类型,渐变方式等
l.AccentBrushType = AccentBrushType.LinearGradientBrush;
});
}
}
<h:ApplicationBase x:Class="HeBianGu.Demo.Demo4.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:h="https://github.com/HeBianGu"
xmlns:local="clr-namespace:HeBianGu.Demo.Demo4">
</h:ApplicationBase>