AvaloniaUI材料设计的演变

图片



Material.Avalonia是一种样式化使用AvaloniaUI(用于.NET的跨平台XAML框架)编写的Material Design应用程序的快速方法。



, : , .



:



图片



, Material.Avalonia






Nuget :



dotnet add package Material.Avalonia


App.xaml, . , , Application.Styles (Application.Resources) Window.Styles UserControl.Styles .



<Application ...
             xmlns:themes="clr-namespace:Material.Styles.Themes;assembly=Material.Styles"
             ...>
    <Application.Resources>
        <themes:BundledTheme BaseTheme="Light" PrimaryColor="Teal" SecondaryColor="Amber"/>
    </Application.Resources>
    <Application.Styles>
        <StyleInclude Source="avares://Material.Avalonia/Material.Avalonia.Templates.xaml" />
    </Application.Styles>
</Application>


, Material Design.

, . , Application.Styles :



<Application.Styles>
    <StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml"/>
    <StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseLight.xaml"/>
    <StyleInclude Source="avares://Material.Avalonia/Material.Avalonia.Templates.xaml" />
</Application.Styles>


Avalonia "" Material.Avalonia.





2 , , .



BundledTheme App.xaml.



Light, — DarkInherit. , , .



BundledTheme , Material Design, "" .



, Teal, :



var paletteHelper = new PaletteHelper();
var theme = paletteHelper.GetTheme();
theme.SetPrimaryColor(SwatchHelper.Lookup[(MaterialColor) PrimaryColor.Teal]);
paletteHelper.SetTheme(theme);


, RGBA.

.





Card


Material Design



图片



Card Attached Property:



<styles:Card assists:ShadowAssist.ShadowDepth="Depth1">
...
</styles:Card>


ColorZone


Material Design .



图片



<styles:ColorZone Margin="4" Padding="8" Mode="Accent">Accent</styles:ColorZone>


FloatingButton


图片



<styles:FloatingButton Content="+"  />
<styles:FloatingButton Content="My long text" />




Avalonia " " BoxShadows Border.

AttachedProperty ShadowAssist, Card, FloatingButton Border.



Border ShadowAssist.ShadowDepth BoxShadows ShadowDepth.



- ShadowAssist.Darken, . , .



Card ShadowDepth



图片



, — .

GitHub

NuGet



非常欢迎Issue / PR和公正的评论。

可从Telegram(ru)Gitter(en)中找到Avalonia开发人员和所有支持者的支持,有关样式控制的文档可在此处获得




All Articles