• RadControl使用相同的Theme


    我們僅須對兩個地方加一些程式碼,就可使所有的RadControl擁用相的Theme,如此一下不但可使Ap內布景主題一致,設計者亦不需要對每個控件做字型,顏色,大小等等瑣碎的設計。

    App.Xaml.cs

            public App()
            {
                StyleManager.ApplicationTheme = new Windows8Theme();
            }
            static App()
            {
                //FontSize Style
                Windows8Palette.Palette.FontSize = 15;
                Windows8Palette.Palette.FontSizeS = 14;
                Windows8Palette.Palette.FontSizeL = 15;
                Windows8Palette.Palette.FontSizeXL = 20;
                Windows8Palette.Palette.FontSizeXXL = 24;
    
                //FontFamily Style
                Windows8Palette.Palette.FontFamily = new FontFamily("Segoe UI Light, Microsoft JhengHei, Microsoft YaHei");
                Windows8Palette.Palette.FontFamilyLight = new FontFamily("Segoe UI Light, Microsoft JhengHei, Microsoft YaHei");
                Windows8Palette.Palette.FontFamilyStrong = new FontFamily("Segoe UI Light, Microsoft JhengHei, Microsoft YaHei");
                
                //Colors Style
                Windows8Palette.Palette.MainColor = Colors.Black;
                Windows8Palette.Palette.AccentColor = Colors.Orange;
                Windows8Palette.Palette.BasicColor = Colors.DarkGray;
                Windows8Palette.Palette.StrongColor = Colors.Gray;
                Windows8Palette.Palette.MarkerColor = Colors.LightGray;
                Windows8Palette.Palette.ValidationColor = Colors.Red;
                
            }
           
    App.Xaml
        <Application.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <telerik:Windows8ResourceDictionary/>
                    <telerik:Windows8TouchResourceDictionary/>
                </ResourceDictionary.MergedDictionaries>
            </ResourceDictionary>
        </Application.Resources>
     
    加入這兩部份程式碼所有的RadControl都會套用成Windows8的Theme,來看看修改後的RadDatePicker,
     
    ScreenClip
     
    參考資料:
    RadControl For WPF:Windows8 and Windows8Touch colors and fonts

    [WPF]快速為WPF換裝 - 使用WPF Themes


     
  • 相关阅读:
    DEV勾选框按钮呈现
    C#事务
    C#调用python脚本
    centos 磁盘满
    PostgreSQL库表字段信息
    Nginx Configuration for windows
    .NET Core 6.0之读取配置文件
    WinUI迁移到即将"过时"的.NET MAUI个人体验
    客户案例Husqvarna AB
    客户案例SES S.A.
  • 原文地址:https://www.cnblogs.com/YangMark/p/3171760.html
Copyright © 2020-2023  润新知