mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-04-25 10:56:35 +08:00
@@ -5,8 +5,8 @@ namespace Semi.Avalonia.Demo.Constant;
|
|||||||
|
|
||||||
public static class ColorTokens
|
public static class ColorTokens
|
||||||
{
|
{
|
||||||
public static IReadOnlyList<Tuple<string, string>> PrimaryTokens { get; } = new List<Tuple<string, string>>
|
public static IReadOnlyList<Tuple<string, string>> PrimaryTokens { get; } =
|
||||||
{
|
[
|
||||||
new("SemiColorPrimary", "Primary"),
|
new("SemiColorPrimary", "Primary"),
|
||||||
new("SemiColorPrimaryPointerover", "Primary Pointerover"),
|
new("SemiColorPrimaryPointerover", "Primary Pointerover"),
|
||||||
new("SemiColorPrimaryActive", "Primary Active"),
|
new("SemiColorPrimaryActive", "Primary Active"),
|
||||||
@@ -14,130 +14,130 @@ public static class ColorTokens
|
|||||||
new("SemiColorPrimaryLight", "Primary Light"),
|
new("SemiColorPrimaryLight", "Primary Light"),
|
||||||
new("SemiColorPrimaryLightPointerover", "Primary Light Pointerover"),
|
new("SemiColorPrimaryLightPointerover", "Primary Light Pointerover"),
|
||||||
new("SemiColorPrimaryLightActive", "Primary Light Active"),
|
new("SemiColorPrimaryLightActive", "Primary Light Active"),
|
||||||
};
|
];
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> SecondaryTokens { get; } = new List<Tuple<string, string>>
|
public static IReadOnlyList<Tuple<string, string>> SecondaryTokens { get; } =
|
||||||
{
|
[
|
||||||
new("SemiColorSecondary", "Secondary"),
|
new("SemiColorSecondary", "Secondary"),
|
||||||
new("SemiColorSecondaryPointerover", "Secondary Pointerover"),
|
new("SemiColorSecondaryPointerover", "Secondary Pointerover"),
|
||||||
new("SemiColorSecondaryActive", "Secondary Active"),
|
new("SemiColorSecondaryActive", "Secondary Active"),
|
||||||
new("SemiColorSecondaryDisabled", "Secondary Disabled"),
|
new("SemiColorSecondaryDisabled", "Secondary Disabled"),
|
||||||
new("SemiColorSecondaryLight", "Secondary Light"),
|
new("SemiColorSecondaryLight", "Secondary Light"),
|
||||||
new("SemiColorSecondaryLightPointerover", "Secondary Light Pointerover"),
|
new("SemiColorSecondaryLightPointerover", "Secondary Light Pointerover"),
|
||||||
new("SemiColorSecondaryLightActive", "Secondary Light Active"),
|
new("SemiColorSecondaryLightActive", "Secondary Light Active")
|
||||||
};
|
];
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> TertiaryTokens { get; } = new List<Tuple<string, string>>
|
public static IReadOnlyList<Tuple<string, string>> TertiaryTokens { get; } =
|
||||||
{
|
[
|
||||||
new("SemiColorTertiary", "Tertiary"),
|
new("SemiColorTertiary", "Tertiary"),
|
||||||
new("SemiColorTertiaryPointerover", "Tertiary Pointerover"),
|
new("SemiColorTertiaryPointerover", "Tertiary Pointerover"),
|
||||||
new("SemiColorTertiaryActive", "Tertiary Active"),
|
new("SemiColorTertiaryActive", "Tertiary Active"),
|
||||||
new("SemiColorTertiaryLight", "Tertiary Light"),
|
new("SemiColorTertiaryLight", "Tertiary Light"),
|
||||||
new("SemiColorTertiaryLightPointerover", "Tertiary Light Pointerover"),
|
new("SemiColorTertiaryLightPointerover", "Tertiary Light Pointerover"),
|
||||||
new("SemiColorTertiaryLightActive", "Tertiary Light Active"),
|
new("SemiColorTertiaryLightActive", "Tertiary Light Active")
|
||||||
};
|
];
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> InformationTokens { get; } = new List<Tuple<string, string>>
|
public static IReadOnlyList<Tuple<string, string>> InformationTokens { get; } =
|
||||||
{
|
[
|
||||||
new("SemiColorInformation", "Information"),
|
new("SemiColorInformation", "Information"),
|
||||||
new("SemiColorInformationPointerover", "Information Pointerover"),
|
new("SemiColorInformationPointerover", "Information Pointerover"),
|
||||||
new("SemiColorInformationActive", "Information Active"),
|
new("SemiColorInformationActive", "Information Active"),
|
||||||
new("SemiColorInformationDisabled", "Information Disabled"),
|
new("SemiColorInformationDisabled", "Information Disabled"),
|
||||||
new("SemiColorInformationLight", "Information Light"),
|
new("SemiColorInformationLight", "Information Light"),
|
||||||
new("SemiColorInformationLightPointerover", "Information Light Pointerover"),
|
new("SemiColorInformationLightPointerover", "Information Light Pointerover"),
|
||||||
new("SemiColorInformationLightActive", "Information Light Active"),
|
new("SemiColorInformationLightActive", "Information Light Active")
|
||||||
};
|
];
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> SuccessTokens { get; } = new List<Tuple<string, string>>
|
public static IReadOnlyList<Tuple<string, string>> SuccessTokens { get; } =
|
||||||
{
|
[
|
||||||
new("SemiColorSuccess", "Success"),
|
new("SemiColorSuccess", "Success"),
|
||||||
new("SemiColorSuccessPointerover", "Success Pointerover"),
|
new("SemiColorSuccessPointerover", "Success Pointerover"),
|
||||||
new("SemiColorSuccessActive", "Success Active"),
|
new("SemiColorSuccessActive", "Success Active"),
|
||||||
new("SemiColorSuccessDisabled", "Success Disabled"),
|
new("SemiColorSuccessDisabled", "Success Disabled"),
|
||||||
new("SemiColorSuccessLight", "Success Light"),
|
new("SemiColorSuccessLight", "Success Light"),
|
||||||
new("SemiColorSuccessLightPointerover", "Success Light Pointerover"),
|
new("SemiColorSuccessLightPointerover", "Success Light Pointerover"),
|
||||||
new("SemiColorSuccessLightActive", "Success Light Active"),
|
new("SemiColorSuccessLightActive", "Success Light Active")
|
||||||
};
|
];
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> WarningTokens { get; } = new List<Tuple<string, string>>
|
public static IReadOnlyList<Tuple<string, string>> WarningTokens { get; } =
|
||||||
{
|
[
|
||||||
new("SemiColorWarning", "Warning"),
|
new("SemiColorWarning", "Warning"),
|
||||||
new("SemiColorWarningPointerover", "Warning Pointerover"),
|
new("SemiColorWarningPointerover", "Warning Pointerover"),
|
||||||
new("SemiColorWarningActive", "Warning Active"),
|
new("SemiColorWarningActive", "Warning Active"),
|
||||||
new("SemiColorWarningLight", "Warning Light"),
|
new("SemiColorWarningLight", "Warning Light"),
|
||||||
new("SemiColorWarningLightPointerover", "Warning Light Pointerover"),
|
new("SemiColorWarningLightPointerover", "Warning Light Pointerover"),
|
||||||
new("SemiColorWarningLightActive", "Warning Light Active"),
|
new("SemiColorWarningLightActive", "Warning Light Active")
|
||||||
};
|
];
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> DangerTokens { get; } = new List<Tuple<string, string>>
|
public static IReadOnlyList<Tuple<string, string>> DangerTokens { get; } =
|
||||||
{
|
[
|
||||||
new("SemiColorDanger", "Danger"),
|
new("SemiColorDanger", "Danger"),
|
||||||
new("SemiColorDangerPointerover", "Danger Pointerover"),
|
new("SemiColorDangerPointerover", "Danger Pointerover"),
|
||||||
new("SemiColorDangerActive", "Danger Active"),
|
new("SemiColorDangerActive", "Danger Active"),
|
||||||
new("SemiColorDangerLight", "Danger Light"),
|
new("SemiColorDangerLight", "Danger Light"),
|
||||||
new("SemiColorDangerLightPointerover", "Danger Light Pointerover"),
|
new("SemiColorDangerLightPointerover", "Danger Light Pointerover"),
|
||||||
new("SemiColorDangerLightActive", "Danger Light Active"),
|
new("SemiColorDangerLightActive", "Danger Light Active")
|
||||||
};
|
];
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> TextTokens { get; } = new List<Tuple<string, string>>
|
public static IReadOnlyList<Tuple<string, string>> TextTokens { get; } =
|
||||||
{
|
[
|
||||||
new("SemiColorText0", "Text 0"),
|
new("SemiColorText0", "Text 0"),
|
||||||
new("SemiColorText1", "Text 1"),
|
new("SemiColorText1", "Text 1"),
|
||||||
new("SemiColorText2", "Text 2"),
|
new("SemiColorText2", "Text 2"),
|
||||||
new("SemiColorText3", "Text 3"),
|
new("SemiColorText3", "Text 3")
|
||||||
};
|
];
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> LinkTokens { get; } = new List<Tuple<string, string>>
|
public static IReadOnlyList<Tuple<string, string>> LinkTokens { get; } =
|
||||||
{
|
[
|
||||||
new("SemiColorLink", "Link"),
|
new("SemiColorLink", "Link"),
|
||||||
new("SemiColorLinkPointerover", "Link Pointerover"),
|
new("SemiColorLinkPointerover", "Link Pointerover"),
|
||||||
new("SemiColorLinkActive", "Link Active"),
|
new("SemiColorLinkActive", "Link Active"),
|
||||||
new("SemiColorLinkVisited", "Link Visited"),
|
new("SemiColorLinkVisited", "Link Visited")
|
||||||
};
|
];
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> BackgroundTokens { get; } = new List<Tuple<string, string>>
|
public static IReadOnlyList<Tuple<string, string>> BackgroundTokens { get; } =
|
||||||
{
|
[
|
||||||
new("SemiColorBackground0", "Background 0"),
|
new("SemiColorBackground0", "Background 0"),
|
||||||
new("SemiColorBackground1", "Background 1"),
|
new("SemiColorBackground1", "Background 1"),
|
||||||
new("SemiColorBackground2", "Background 2"),
|
new("SemiColorBackground2", "Background 2"),
|
||||||
new("SemiColorBackground3", "Background 3"),
|
new("SemiColorBackground3", "Background 3"),
|
||||||
new("SemiColorBackground4", "Background 4"),
|
new("SemiColorBackground4", "Background 4")
|
||||||
};
|
];
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> FillTokens { get; } = new List<Tuple<string, string>>
|
public static IReadOnlyList<Tuple<string, string>> FillTokens { get; } =
|
||||||
{
|
[
|
||||||
new("SemiColorFill0", "Fill 0"),
|
new("SemiColorFill0", "Fill 0"),
|
||||||
new("SemiColorFill1", "Fill 1"),
|
new("SemiColorFill1", "Fill 1"),
|
||||||
new("SemiColorFill2", "Fill 2"),
|
new("SemiColorFill2", "Fill 2")
|
||||||
};
|
];
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> BorderTokens { get; } = new List<Tuple<string, string>>
|
public static IReadOnlyList<Tuple<string, string>> BorderTokens { get; } =
|
||||||
{
|
[
|
||||||
new("SemiColorBorder", "Border"),
|
new("SemiColorBorder", "Border"),
|
||||||
new("SemiColorFocusBorder", "Focus Border"),
|
new("SemiColorFocusBorder", "Focus Border")
|
||||||
};
|
];
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> DisabledTokens { get; } = new List<Tuple<string, string>>
|
public static IReadOnlyList<Tuple<string, string>> DisabledTokens { get; } =
|
||||||
{
|
[
|
||||||
new("SemiColorDisabledText", "Disabled Text"),
|
new("SemiColorDisabledText", "Disabled Text"),
|
||||||
new("SemiColorDisabledBorder", "Disabled Border"),
|
new("SemiColorDisabledBorder", "Disabled Border"),
|
||||||
new("SemiColorDisabledBackground", "Disabled Background"),
|
new("SemiColorDisabledBackground", "Disabled Background"),
|
||||||
new("SemiColorDisabledFill", "Disabled Fill"),
|
new("SemiColorDisabledFill", "Disabled Fill")
|
||||||
};
|
];
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> OtherTokens { get; } = new List<Tuple<string, string>>
|
public static IReadOnlyList<Tuple<string, string>> OtherTokens { get; } =
|
||||||
{
|
[
|
||||||
new("SemiColorWhite", "White"),
|
new("SemiColorWhite", "White"),
|
||||||
new("SemiColorBlack", "Black"),
|
new("SemiColorBlack", "Black"),
|
||||||
new("SemiColorNavBackground", "Navigation Background"),
|
new("SemiColorNavBackground", "Navigation Background"),
|
||||||
new("SemiColorOverlayBackground", "Overlay Background"),
|
new("SemiColorOverlayBackground", "Overlay Background"),
|
||||||
new("SemiColorHighlightBackground", "Highlight Background"),
|
new("SemiColorHighlightBackground", "Highlight Background"),
|
||||||
new("SemiColorHighlight", "Highlight Text"),
|
new("SemiColorHighlight", "Highlight Text")
|
||||||
};
|
];
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> ShadowTokens { get; } = new List<Tuple<string, string>>
|
public static IReadOnlyList<Tuple<string, string>> ShadowTokens { get; } =
|
||||||
{
|
[
|
||||||
new("SemiColorShadow", "Shadow"),
|
new("SemiColorShadow", "Shadow"),
|
||||||
new("SemiShadowElevated", "Shadow Elevated"),
|
new("SemiShadowElevated", "Shadow Elevated")
|
||||||
};
|
];
|
||||||
}
|
}
|
||||||
@@ -6,8 +6,8 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:iri="https://irihi.tech/shared"
|
xmlns:iri="https://irihi.tech/shared"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:pages="clr-namespace:Semi.Avalonia.Demo.Pages"
|
xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels"
|
||||||
x:DataType="pages:AboutUsViewModel"
|
x:DataType="vm:AboutUsViewModel"
|
||||||
x:CompileBindings="True"
|
x:CompileBindings="True"
|
||||||
d:DesignHeight="450"
|
d:DesignHeight="450"
|
||||||
d:DesignWidth="800"
|
d:DesignWidth="800"
|
||||||
|
|||||||
@@ -1,14 +1,6 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.Markup.Xaml;
|
using Semi.Avalonia.Demo.ViewModels;
|
||||||
using Avalonia.Platform.Storage;
|
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
|
||||||
using CommunityToolkit.Mvvm.Input;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
@@ -30,31 +22,3 @@ public partial class AboutUs : UserControl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial class AboutUsViewModel: ObservableObject
|
|
||||||
{
|
|
||||||
public ICommand NavigateCommand { get; set; }
|
|
||||||
|
|
||||||
internal ILauncher? Launcher { get; set; }
|
|
||||||
|
|
||||||
public AboutUsViewModel()
|
|
||||||
{
|
|
||||||
NavigateCommand = new AsyncRelayCommand<string>(OnNavigateAsync);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static readonly IReadOnlyDictionary<string, string> _keyToUrlMapping = new Dictionary<string, string>()
|
|
||||||
{
|
|
||||||
["semi"] = "https://github.com/irihitech/Semi.Avalonia",
|
|
||||||
["ursa"] = "https://github.com/irihitech/Ursa.Avalonia",
|
|
||||||
["mantra"] = "https://www.bilibili.com/video/BV15pfKYbEEQ",
|
|
||||||
};
|
|
||||||
|
|
||||||
private async Task OnNavigateAsync(string? arg)
|
|
||||||
{
|
|
||||||
if (Launcher is not null && arg is not null && _keyToUrlMapping.TryGetValue(arg.ToLower(), out var uri))
|
|
||||||
{
|
|
||||||
await Launcher.LaunchUriAsync(new Uri(uri));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,15 +3,15 @@
|
|||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:Semi.Avalonia.Demo.Pages"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels"
|
||||||
d:DesignHeight="450"
|
d:DesignHeight="450"
|
||||||
d:DesignWidth="800"
|
d:DesignWidth="800"
|
||||||
x:CompileBindings="False"
|
x:CompileBindings="False"
|
||||||
x:DataType="local:AutoCompleteBoxDemoViewModel"
|
x:DataType="vm:AutoCompleteBoxDemoViewModel"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<Design.DataContext>
|
<Design.DataContext>
|
||||||
<local:AutoCompleteBoxDemoViewModel />
|
<vm:AutoCompleteBoxDemoViewModel />
|
||||||
</Design.DataContext>
|
</Design.DataContext>
|
||||||
<StackPanel HorizontalAlignment="Left" Spacing="20">
|
<StackPanel HorizontalAlignment="Left" Spacing="20">
|
||||||
<StackPanel.Styles>
|
<StackPanel.Styles>
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
<Binding Path="States" />
|
<Binding Path="States" />
|
||||||
</Setter>
|
</Setter>
|
||||||
<Setter Property="ItemTemplate">
|
<Setter Property="ItemTemplate">
|
||||||
<DataTemplate DataType="local:StateData">
|
<DataTemplate DataType="vm:StateData">
|
||||||
<TextBlock Text="{Binding Name}" />
|
<TextBlock Text="{Binding Name}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
using System.Collections.ObjectModel;
|
|
||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
using Semi.Avalonia.Demo.ViewModels;
|
||||||
using System.Collections.Generic;
|
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
@@ -15,85 +11,3 @@ public partial class AutoCompleteBoxDemo : UserControl
|
|||||||
this.DataContext = new AutoCompleteBoxDemoViewModel();
|
this.DataContext = new AutoCompleteBoxDemoViewModel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AutoCompleteBoxDemoViewModel: ObservableObject
|
|
||||||
{
|
|
||||||
public ObservableCollection<StateData> States { get; set; }
|
|
||||||
|
|
||||||
public AutoCompleteBoxDemoViewModel()
|
|
||||||
{
|
|
||||||
States = new ObservableCollection<StateData>(GetStates());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<StateData> GetStates()
|
|
||||||
{
|
|
||||||
return new List<StateData>
|
|
||||||
{
|
|
||||||
new StateData("Alabama", "AL", "Montgomery"),
|
|
||||||
new StateData("Alaska", "AK", "Juneau"),
|
|
||||||
new StateData("Arizona", "AZ", "Phoenix"),
|
|
||||||
new StateData("Arkansas", "AR", "Little Rock"),
|
|
||||||
new StateData("California", "CA", "Sacramento"),
|
|
||||||
new StateData("Colorado", "CO", "Denver"),
|
|
||||||
new StateData("Connecticut", "CT", "Hartford"),
|
|
||||||
new StateData("Delaware", "DE", "Dover"),
|
|
||||||
new StateData("Florida", "FL", "Tallahassee"),
|
|
||||||
new StateData("Georgia", "GA", "Atlanta"),
|
|
||||||
new StateData("Hawaii", "HI", "Honolulu"),
|
|
||||||
new StateData("Idaho", "ID", "Boise"),
|
|
||||||
new StateData("Illinois", "IL", "Springfield"),
|
|
||||||
new StateData("Indiana", "IN", "Indianapolis"),
|
|
||||||
new StateData("Iowa", "IA", "Des Moines"),
|
|
||||||
new StateData("Kansas", "KS", "Topeka"),
|
|
||||||
new StateData("Kentucky", "KY", "Frankfort"),
|
|
||||||
new StateData("Louisiana", "LA", "Baton Rouge"),
|
|
||||||
new StateData("Maine", "ME", "Augusta"),
|
|
||||||
new StateData("Maryland", "MD", "Annapolis"),
|
|
||||||
new StateData("Massachusetts", "MA", "Boston"),
|
|
||||||
new StateData("Michigan", "MI", "Lansing"),
|
|
||||||
new StateData("Minnesota", "MN", "St. Paul"),
|
|
||||||
new StateData("Mississippi", "MS", "Jackson"),
|
|
||||||
new StateData("Missouri", "MO", "Jefferson City"),
|
|
||||||
new StateData("Montana", "MT", "Helena"),
|
|
||||||
new StateData("Nebraska", "NE", "Lincoln"),
|
|
||||||
new StateData("Nevada", "NV", "Carson City"),
|
|
||||||
new StateData("New Hampshire", "NH", "Concord"),
|
|
||||||
new StateData("New Jersey", "NJ", "Trenton"),
|
|
||||||
new StateData("New Mexico", "NM", "Santa Fe"),
|
|
||||||
new StateData("New York", "NY", "Albany"),
|
|
||||||
new StateData("North Carolina", "NC", "Raleigh"),
|
|
||||||
new StateData("North Dakota", "ND", "Bismarck"),
|
|
||||||
new StateData("Ohio", "OH", "Columbus"),
|
|
||||||
new StateData("Oklahoma", "OK", "Oklahoma City"),
|
|
||||||
new StateData("Oregon", "OR", "Salem"),
|
|
||||||
new StateData("Pennsylvania", "PA", "Harrisburg"),
|
|
||||||
new StateData("Rhode Island", "RI", "Providence"),
|
|
||||||
new StateData("South Carolina", "SC", "Columbia"),
|
|
||||||
new StateData("South Dakota", "SD", "Pierre"),
|
|
||||||
new StateData("Tennessee", "TN", "Nashville"),
|
|
||||||
new StateData("Texas", "TX", "Austin"),
|
|
||||||
new StateData("Utah", "UT", "Salt Lake City"),
|
|
||||||
new StateData("Vermont", "VT", "Montpelier"),
|
|
||||||
new StateData("Virginia", "VA", "Richmond"),
|
|
||||||
new StateData("Washington", "WA", "Olympia"),
|
|
||||||
new StateData("West Virginia", "WV", "Charleston"),
|
|
||||||
new StateData("Wisconsin", "WI", "Madison"),
|
|
||||||
new StateData("Wyoming", "WY", "Cheyenne"),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class StateData
|
|
||||||
{
|
|
||||||
public string Name { get; private set; }
|
|
||||||
public string Abbreviation { get; private set; }
|
|
||||||
public string Capital { get; private set; }
|
|
||||||
|
|
||||||
public StateData(string name, string abbreviation, string capital)
|
|
||||||
{
|
|
||||||
Name = name;
|
|
||||||
Abbreviation = abbreviation;
|
|
||||||
Capital = capital;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
|
|||||||
@@ -112,14 +112,14 @@
|
|||||||
IsEnabled="False" />
|
IsEnabled="False" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||||
<DropDownButton Content="Default" Classes="Success"/>
|
<DropDownButton Content="Default" Classes="Success" />
|
||||||
<DropDownButton Content="Solid" Theme="{DynamicResource SolidDropDownButton}" Classes="Success"/>
|
<DropDownButton Content="Solid" Theme="{DynamicResource SolidDropDownButton}" Classes="Success" />
|
||||||
<DropDownButton Content="Outline" Theme="{DynamicResource OutlineDropDownButton}" Classes="Success"/>
|
<DropDownButton Content="Outline" Theme="{DynamicResource OutlineDropDownButton}" Classes="Success" />
|
||||||
<DropDownButton Content="Borderless" Theme="{DynamicResource BorderlessDropDownButton}" Classes="Success"/>
|
<DropDownButton Content="Borderless" Theme="{DynamicResource BorderlessDropDownButton}" Classes="Success" />
|
||||||
<DropDownButton Content="Default" Classes="Success" IsEnabled="False"/>
|
<DropDownButton Content="Default" Classes="Success" IsEnabled="False" />
|
||||||
<DropDownButton Content="Solid" Theme="{DynamicResource SolidDropDownButton}" Classes="Success" IsEnabled="False"/>
|
<DropDownButton Content="Solid" Theme="{DynamicResource SolidDropDownButton}" Classes="Success" IsEnabled="False" />
|
||||||
<DropDownButton Content="Outline" Theme="{DynamicResource OutlineDropDownButton}" Classes="Success" IsEnabled="False"/>
|
<DropDownButton Content="Outline" Theme="{DynamicResource OutlineDropDownButton}" Classes="Success" IsEnabled="False" />
|
||||||
<DropDownButton Content="Borderless" Theme="{DynamicResource BorderlessDropDownButton}" Classes="Success" IsEnabled="False"/>
|
<DropDownButton Content="Borderless" Theme="{DynamicResource BorderlessDropDownButton}" Classes="Success" IsEnabled="False" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||||
<DropDownButton Classes="Small" Content="Small" />
|
<DropDownButton Classes="Small" Content="Small" />
|
||||||
@@ -139,7 +139,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||||
<SplitButton Content="Default" Classes="Success" />
|
<SplitButton Content="Default" Classes="Success" />
|
||||||
<SplitButton Content="Solid" Theme="{DynamicResource SolidSplitButton}" Classes="Success" />
|
<SplitButton Content="Solid" Theme="{DynamicResource SolidSplitButton}" Classes="Success" />
|
||||||
<SplitButton Content="Outline" Theme="{DynamicResource OutlineSplitButton}" Classes="Success" />
|
<SplitButton Content="Outline" Theme="{DynamicResource OutlineSplitButton}" Classes="Success" />
|
||||||
<SplitButton Content="Borderless" Theme="{DynamicResource BorderlessSplitButton}" Classes="Success" />
|
<SplitButton Content="Borderless" Theme="{DynamicResource BorderlessSplitButton}" Classes="Success" />
|
||||||
<SplitButton Content="Default" Classes="Success" IsEnabled="False" />
|
<SplitButton Content="Default" Classes="Success" IsEnabled="False" />
|
||||||
@@ -165,7 +165,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||||
<ToggleSplitButton Content="Default" Classes="Success" />
|
<ToggleSplitButton Content="Default" Classes="Success" />
|
||||||
<ToggleSplitButton Content="Checked" Classes="Success" IsChecked="True" />
|
<ToggleSplitButton Content="Checked" Classes="Success" IsChecked="True" />
|
||||||
<ToggleSplitButton Content="Default" Classes="Success" IsEnabled="False" />
|
<ToggleSplitButton Content="Default" Classes="Success" IsEnabled="False" />
|
||||||
<ToggleSplitButton Content="Checked" Classes="Success" IsChecked="True" IsEnabled="False" />
|
<ToggleSplitButton Content="Checked" Classes="Success" IsChecked="True" IsEnabled="False" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
@@ -31,7 +29,6 @@ public partial class ButtonSpinnerDemo : UserControl
|
|||||||
|
|
||||||
txtBox.Text = _mountains[value];
|
txtBox.Text = _mountains[value];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly string[] _mountains = new[]
|
private readonly string[] _mountains = new[]
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
@@ -10,9 +8,4 @@ public partial class CalendarDemo : UserControl
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
AvaloniaXamlLoader.Load(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Interactivity;
|
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:pages="clr-namespace:Semi.Avalonia.Demo.Pages"
|
xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels"
|
||||||
d:DesignHeight="800"
|
d:DesignHeight="800"
|
||||||
d:DesignWidth="800"
|
d:DesignWidth="800"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<Design.DataContext>
|
<Design.DataContext>
|
||||||
<pages:ComboBoxDemoViewModel />
|
<vm:ComboBoxDemoViewModel />
|
||||||
</Design.DataContext>
|
</Design.DataContext>
|
||||||
<StackPanel Spacing="20">
|
<StackPanel Spacing="20">
|
||||||
<StackPanel.Styles>
|
<StackPanel.Styles>
|
||||||
@@ -28,13 +28,13 @@
|
|||||||
<ComboBox Classes="Bordered" />
|
<ComboBox Classes="Bordered" />
|
||||||
<ComboBox Classes="Bordered" IsEnabled="False" />
|
<ComboBox Classes="Bordered" IsEnabled="False" />
|
||||||
<ComboBox>
|
<ComboBox>
|
||||||
<ComboBox.SelectionBoxItemTemplate>
|
<ComboBox.SelectionBoxItemTemplate>
|
||||||
<DataTemplate DataType="x:String">
|
<DataTemplate DataType="x:String">
|
||||||
<ContentControl BorderThickness="1"
|
<ContentControl BorderThickness="1"
|
||||||
BorderBrush="Gold"
|
BorderBrush="Gold"
|
||||||
Content="{Binding}" />
|
Content="{Binding}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ComboBox.SelectionBoxItemTemplate>
|
</ComboBox.SelectionBoxItemTemplate>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using System.Collections.ObjectModel;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using Semi.Avalonia.Demo.ViewModels;
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
@@ -12,8 +11,3 @@ public partial class ComboBoxDemo : UserControl
|
|||||||
this.DataContext = new ComboBoxDemoViewModel();
|
this.DataContext = new ComboBoxDemoViewModel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ComboBoxDemoViewModel : ObservableObject
|
|
||||||
{
|
|
||||||
public ObservableCollection<string> Items { get; set; } = ["Ding", "Otter", "Husky", "Mr.17", "Cass"];
|
|
||||||
}
|
|
||||||
@@ -12,54 +12,54 @@
|
|||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<TabControl>
|
<TabControl>
|
||||||
<TabItem Header="DataGrid">
|
<TabItem Header="DataGrid">
|
||||||
<Grid RowDefinitions="Auto, *">
|
<Grid RowDefinitions="Auto, *">
|
||||||
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
||||||
<ToggleSwitch Content="Enable" Name="enable" IsChecked="True" />
|
<ToggleSwitch Content="Enable" Name="enable" IsChecked="True" />
|
||||||
<ToggleSwitch Content="Inset Content" Name="inset" />
|
<ToggleSwitch Content="Inset Content" Name="inset" />
|
||||||
<ToggleSwitch Content="ScrollBar Auto Hide" Name="autohide" />
|
<ToggleSwitch Content="ScrollBar Auto Hide" Name="autohide" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<DataGrid Grid.Row="1"
|
<DataGrid Grid.Row="1"
|
||||||
Margin="8"
|
Margin="8"
|
||||||
CanUserReorderColumns="True"
|
CanUserReorderColumns="True"
|
||||||
CanUserResizeColumns="True"
|
CanUserResizeColumns="True"
|
||||||
CanUserSortColumns="True"
|
CanUserSortColumns="True"
|
||||||
HeadersVisibility="All"
|
HeadersVisibility="All"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
Classes.InsetContent="{Binding #inset.IsChecked}"
|
Classes.InsetContent="{Binding #inset.IsChecked}"
|
||||||
ScrollViewer.AllowAutoHide="{Binding #autohide.IsChecked}"
|
ScrollViewer.AllowAutoHide="{Binding #autohide.IsChecked}"
|
||||||
IsEnabled="{Binding #enable.IsChecked}"
|
IsEnabled="{Binding #enable.IsChecked}"
|
||||||
ItemsSource="{Binding GridData1}">
|
ItemsSource="{Binding GridData1}">
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn
|
<DataGridTextColumn
|
||||||
Width="6*"
|
Width="6*"
|
||||||
x:DataType="vm:Song"
|
x:DataType="vm:Song"
|
||||||
Binding="{Binding Title}"
|
Binding="{Binding Title}"
|
||||||
Header="Title" />
|
Header="Title" />
|
||||||
<DataGridTextColumn
|
<DataGridTextColumn
|
||||||
Width="6*"
|
Width="6*"
|
||||||
x:DataType="vm:Song"
|
x:DataType="vm:Song"
|
||||||
Binding="{Binding Artist}"
|
Binding="{Binding Artist}"
|
||||||
Header="Artist" />
|
Header="Artist" />
|
||||||
<DataGridTextColumn
|
<DataGridTextColumn
|
||||||
Width="6*"
|
Width="6*"
|
||||||
x:DataType="vm:Song"
|
x:DataType="vm:Song"
|
||||||
Binding="{Binding Album}"
|
Binding="{Binding Album}"
|
||||||
Header="Album" />
|
Header="Album" />
|
||||||
<DataGridTemplateColumn Header="Duration" SortMemberPath="Duration">
|
<DataGridTemplateColumn Header="Duration" SortMemberPath="Duration">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Margin="8,0,0,0"
|
Margin="8,0,0,0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Text="{Binding Duration}" />
|
Text="{Binding Duration}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
|
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="Grouping">
|
<TabItem Header="Grouping">
|
||||||
<DataGrid
|
<DataGrid
|
||||||
|
|||||||
@@ -1,18 +1,4 @@
|
|||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Linq;
|
|
||||||
using Avalonia;
|
|
||||||
using Avalonia.Collections;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Controls.Primitives;
|
|
||||||
using Avalonia.Data;
|
|
||||||
using Avalonia.Input;
|
|
||||||
using Avalonia.Input.Raw;
|
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
using Avalonia.Threading;
|
|
||||||
using Semi.Avalonia.Demo.ViewModels;
|
using Semi.Avalonia.Demo.ViewModels;
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
@@ -10,9 +8,4 @@ public partial class DataValidationErrorsDemo : UserControl
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
AvaloniaXamlLoader.Load(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
using Avalonia.Media;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
@@ -11,14 +8,4 @@ public partial class DatePickerDemo : UserControl
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
AvaloniaXamlLoader.Load(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Render(DrawingContext context)
|
|
||||||
{
|
|
||||||
base.Render(context);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.LogicalTree;
|
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
@@ -9,9 +8,4 @@ public partial class GridSplitterDemo : UserControl
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
AvaloniaXamlLoader.Load(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,4 @@
|
|||||||
using System;
|
|
||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
ColumnDefinitions="Auto, *"
|
ColumnDefinitions="Auto, *"
|
||||||
RowDefinitions="*,*,*,*,*,*,*,*,*,*,*">
|
RowDefinitions="*,*,*,*,*,*,*,*,*,*,*">
|
||||||
<TextBlock Grid.Row="0" Grid.Column="0">Classes</TextBlock>
|
<TextBlock Grid.Row="0" Grid.Column="0">Classes</TextBlock>
|
||||||
<TextBlock Grid.Row="1" Grid.Column="0">-</TextBlock>
|
<TextBlock Grid.Row="1" Grid.Column="0">-</TextBlock>
|
||||||
<TextBlock Grid.Row="2" Grid.Column="0">Secondary</TextBlock>
|
<TextBlock Grid.Row="2" Grid.Column="0">Secondary</TextBlock>
|
||||||
<TextBlock Grid.Row="3" Grid.Column="0">Tertiary</TextBlock>
|
<TextBlock Grid.Row="3" Grid.Column="0">Tertiary</TextBlock>
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
Header="Default">
|
Header="Default">
|
||||||
<ScrollViewer>
|
<ScrollViewer>
|
||||||
<StackPanel Spacing="20">
|
<StackPanel Spacing="20">
|
||||||
<TextBlock Text="Theme: Default"/>
|
<TextBlock Text="Theme: Default" />
|
||||||
<ListBox ItemsSource="{Binding $parent[local:ListBoxDemo].Items}" />
|
<ListBox ItemsSource="{Binding $parent[local:ListBoxDemo].Items}" />
|
||||||
<ListBox IsEnabled="False">
|
<ListBox IsEnabled="False">
|
||||||
<ListBoxItem IsSelected="True">Avalonia</ListBoxItem>
|
<ListBoxItem IsSelected="True">Avalonia</ListBoxItem>
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
Theme="{DynamicResource GroupBox}"
|
Theme="{DynamicResource GroupBox}"
|
||||||
Header="RadioGroupListBox">
|
Header="RadioGroupListBox">
|
||||||
<StackPanel Spacing="20">
|
<StackPanel Spacing="20">
|
||||||
<TextBlock Text="Theme: RadioGroupListBox"/>
|
<TextBlock Text="Theme: RadioGroupListBox" />
|
||||||
<ListBox
|
<ListBox
|
||||||
Theme="{DynamicResource RadioGroupListBox}"
|
Theme="{DynamicResource RadioGroupListBox}"
|
||||||
ItemsSource="{Binding $parent[local:ListBoxDemo].Items}" />
|
ItemsSource="{Binding $parent[local:ListBoxDemo].Items}" />
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
<ListBoxItem IsSelected="True">WPF</ListBoxItem>
|
<ListBoxItem IsSelected="True">WPF</ListBoxItem>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
|
|
||||||
<TextBlock Text="Theme: ButtonRadioGroupListBox"/>
|
<TextBlock Text="Theme: ButtonRadioGroupListBox" />
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Border HorizontalAlignment="Left" Theme="{StaticResource RadioButtonGroupBorder}">
|
<Border HorizontalAlignment="Left" Theme="{StaticResource RadioButtonGroupBorder}">
|
||||||
<ListBox Theme="{DynamicResource ButtonRadioGroupListBox}">
|
<ListBox Theme="{DynamicResource ButtonRadioGroupListBox}">
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
</Border>
|
</Border>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<TextBlock Text="Theme: CardRadioGroupListBox"/>
|
<TextBlock Text="Theme: CardRadioGroupListBox" />
|
||||||
<ListBox Theme="{DynamicResource CardRadioGroupListBox}"
|
<ListBox Theme="{DynamicResource CardRadioGroupListBox}"
|
||||||
ItemsSource="{Binding $parent[local:ListBoxDemo].Items}" />
|
ItemsSource="{Binding $parent[local:ListBoxDemo].Items}" />
|
||||||
<ListBox Theme="{DynamicResource CardRadioGroupListBox}" IsEnabled="False">
|
<ListBox Theme="{DynamicResource CardRadioGroupListBox}" IsEnabled="False">
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
<ListBoxItem>WPF</ListBoxItem>
|
<ListBoxItem>WPF</ListBoxItem>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
|
|
||||||
<TextBlock Text="Theme: PureCardRadioGroupListBox"/>
|
<TextBlock Text="Theme: PureCardRadioGroupListBox" />
|
||||||
<ListBox Theme="{DynamicResource PureCardRadioGroupListBox}"
|
<ListBox Theme="{DynamicResource PureCardRadioGroupListBox}"
|
||||||
ItemsSource="{Binding $parent[local:ListBoxDemo].Items}" />
|
ItemsSource="{Binding $parent[local:ListBoxDemo].Items}" />
|
||||||
<ListBox Theme="{DynamicResource PureCardRadioGroupListBox}" IsEnabled="False">
|
<ListBox Theme="{DynamicResource PureCardRadioGroupListBox}" IsEnabled="False">
|
||||||
@@ -117,7 +117,7 @@
|
|||||||
Header="CheckGroupListBox">
|
Header="CheckGroupListBox">
|
||||||
<ScrollViewer>
|
<ScrollViewer>
|
||||||
<StackPanel Spacing="20">
|
<StackPanel Spacing="20">
|
||||||
<TextBlock Text="Theme: CheckGroupListBox"/>
|
<TextBlock Text="Theme: CheckGroupListBox" />
|
||||||
<ListBox
|
<ListBox
|
||||||
SelectionMode="Multiple,Toggle"
|
SelectionMode="Multiple,Toggle"
|
||||||
Theme="{DynamicResource CheckGroupListBox}"
|
Theme="{DynamicResource CheckGroupListBox}"
|
||||||
@@ -129,7 +129,7 @@
|
|||||||
<ListBoxItem>WPF</ListBoxItem>
|
<ListBoxItem>WPF</ListBoxItem>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
|
|
||||||
<TextBlock Text="Theme: CardCheckGroupListBox"/>
|
<TextBlock Text="Theme: CardCheckGroupListBox" />
|
||||||
<ListBox
|
<ListBox
|
||||||
SelectionMode="Multiple,Toggle"
|
SelectionMode="Multiple,Toggle"
|
||||||
Theme="{DynamicResource CardCheckGroupListBox}"
|
Theme="{DynamicResource CardCheckGroupListBox}"
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
@@ -11,8 +9,4 @@ public partial class MenuDemo : UserControl
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
AvaloniaXamlLoader.Load(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
@@ -11,8 +9,4 @@ public partial class NumericUpDownDemo : UserControl
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
AvaloniaXamlLoader.Load(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Media;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
Minimum="{Binding #slider.Minimum}"
|
Minimum="{Binding #slider.Minimum}"
|
||||||
Theme="{DynamicResource ProgressRing}"
|
Theme="{DynamicResource ProgressRing}"
|
||||||
Value="{Binding #slider.Value}"
|
Value="{Binding #slider.Value}"
|
||||||
ShowProgressText="True"/>
|
ShowProgressText="True" />
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
Width="100"
|
Width="100"
|
||||||
Height="100"
|
Height="100"
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
Maximum="{Binding #slider.Maximum}"
|
Maximum="{Binding #slider.Maximum}"
|
||||||
Minimum="{Binding #slider.Minimum}"
|
Minimum="{Binding #slider.Minimum}"
|
||||||
Theme="{DynamicResource ProgressRing}"
|
Theme="{DynamicResource ProgressRing}"
|
||||||
ShowProgressText="True"/>
|
ShowProgressText="True" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Slider
|
<Slider
|
||||||
Name="slider"
|
Name="slider"
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
@@ -10,9 +8,4 @@ public partial class ProgressBarDemo : UserControl
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
AvaloniaXamlLoader.Load(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:pages="clr-namespace:Semi.Avalonia.Demo.Pages"
|
xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels"
|
||||||
d:DesignHeight="450"
|
d:DesignHeight="450"
|
||||||
d:DesignWidth="800"
|
d:DesignWidth="800"
|
||||||
x:DataType="pages:RefreshContainerDemoViewModel"
|
x:DataType="vm:RefreshContainerDemoViewModel"
|
||||||
x:CompileBindings="True"
|
x:CompileBindings="True"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Top">
|
<DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Top">
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using Semi.Avalonia.Demo.ViewModels;
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
@@ -13,34 +10,14 @@ public partial class RefreshContainerDemo : UserControl
|
|||||||
public RefreshContainerDemo()
|
public RefreshContainerDemo()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
_viewModel = new RefreshContainerDemoViewModel();
|
_viewModel = new RefreshContainerDemoViewModel();
|
||||||
|
|
||||||
DataContext = _viewModel;
|
DataContext = _viewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void RefreshContainerPage_RefreshRequested(object? sender, RefreshRequestedEventArgs e)
|
private async void RefreshContainerPage_RefreshRequested(object? sender, RefreshRequestedEventArgs e)
|
||||||
{
|
{
|
||||||
var deferral = e.GetDeferral();
|
var deferral = e.GetDeferral();
|
||||||
|
|
||||||
await _viewModel.AddToTop();
|
await _viewModel.AddToTop();
|
||||||
|
|
||||||
deferral.Complete();
|
deferral.Complete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RefreshContainerDemoViewModel : ObservableObject
|
|
||||||
{
|
|
||||||
public ObservableCollection<string> Items { get; }
|
|
||||||
|
|
||||||
public RefreshContainerDemoViewModel()
|
|
||||||
{
|
|
||||||
Items = new ObservableCollection<string>(Enumerable.Range(1, 200).Select(i => $"Item {i}"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task AddToTop()
|
|
||||||
{
|
|
||||||
await Task.Delay(1000);
|
|
||||||
Items.Insert(0, $"Item {200 - Items.Count}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
@@ -10,9 +8,4 @@ public partial class ScrollViewerDemo : UserControl
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
AvaloniaXamlLoader.Load(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
@@ -11,8 +9,4 @@ public partial class SelectableTextBlockDemo : UserControl
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
AvaloniaXamlLoader.Load(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
@@ -11,8 +9,4 @@ public partial class SliderDemo : UserControl
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
AvaloniaXamlLoader.Load(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -4,12 +4,12 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:pages="clr-namespace:Semi.Avalonia.Demo.Pages"
|
xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels"
|
||||||
d:DesignHeight="1000"
|
d:DesignHeight="1000"
|
||||||
d:DesignWidth="800"
|
d:DesignWidth="800"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<Design.DataContext>
|
<Design.DataContext>
|
||||||
<pages:SplitViewDemoViewModel />
|
<vm:SplitViewDemoViewModel />
|
||||||
</Design.DataContext>
|
</Design.DataContext>
|
||||||
<Border>
|
<Border>
|
||||||
<Grid ColumnDefinitions="*,400">
|
<Grid ColumnDefinitions="*,400">
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
Grid.Row="3" Grid.Column="1"
|
Grid.Row="3" Grid.Column="1"
|
||||||
Name="DisplayModeSelector"
|
Name="DisplayModeSelector"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
ItemsSource="{x:Static pages:SplitViewDemoViewModel.DisplayModes}"
|
ItemsSource="{x:Static vm:SplitViewDemoViewModel.DisplayModes}"
|
||||||
SelectedItem="{x:Static SplitViewDisplayMode.CompactInline}" />
|
SelectedItem="{x:Static SplitViewDisplayMode.CompactInline}" />
|
||||||
|
|
||||||
<Label
|
<Label
|
||||||
@@ -114,8 +114,7 @@
|
|||||||
Theme="{DynamicResource IconBorderlessToggleSwitch}"
|
Theme="{DynamicResource IconBorderlessToggleSwitch}"
|
||||||
Content="{StaticResource SemiIconSidebar}"
|
Content="{StaticResource SemiIconSidebar}"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
IsChecked="{Binding #SplitView.IsPaneOpen}">
|
IsChecked="{Binding #SplitView.IsPaneOpen}" />
|
||||||
</ToggleSwitch>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</SplitView.Pane>
|
</SplitView.Pane>
|
||||||
|
|
||||||
@@ -205,8 +204,7 @@
|
|||||||
Theme="{DynamicResource IconBorderlessToggleSwitch}"
|
Theme="{DynamicResource IconBorderlessToggleSwitch}"
|
||||||
Content="{StaticResource SemiIconSidebar}"
|
Content="{StaticResource SemiIconSidebar}"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
IsChecked="{Binding #SplitView2.IsPaneOpen}">
|
IsChecked="{Binding #SplitView2.IsPaneOpen}" />
|
||||||
</ToggleSwitch>
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Margin="8,12"
|
Margin="8,12"
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
using System.Collections.ObjectModel;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
using Semi.Avalonia.Demo.ViewModels;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
@@ -12,33 +10,4 @@ public partial class SplitViewDemo : UserControl
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.DataContext = new SplitViewDemoViewModel();
|
this.DataContext = new SplitViewDemoViewModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
AvaloniaXamlLoader.Load(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class SplitViewDemoViewModel : ObservableObject
|
|
||||||
{
|
|
||||||
public ObservableCollection<string> Songs { get; set; } =
|
|
||||||
[
|
|
||||||
"320万年前",
|
|
||||||
"隐德来希",
|
|
||||||
"孔明",
|
|
||||||
"锦鲤卟噜噜",
|
|
||||||
"指鹿为马",
|
|
||||||
"热带季风Remix",
|
|
||||||
"加州梦境",
|
|
||||||
"渐近自由",
|
|
||||||
"世界所有的烂漫",
|
|
||||||
];
|
|
||||||
|
|
||||||
public static ObservableCollection<SplitViewDisplayMode> DisplayModes { get; set; } =
|
|
||||||
[
|
|
||||||
SplitViewDisplayMode.Inline,
|
|
||||||
SplitViewDisplayMode.CompactInline,
|
|
||||||
SplitViewDisplayMode.Overlay,
|
|
||||||
SplitViewDisplayMode.CompactOverlay,
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
using Semi.Avalonia.Demo.ViewModels;
|
using Semi.Avalonia.Demo.ViewModels;
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
|
|||||||
@@ -17,9 +17,9 @@
|
|||||||
<TimePicker Classes="Large" />
|
<TimePicker Classes="Large" />
|
||||||
<TimePicker Classes="Small" />
|
<TimePicker Classes="Small" />
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TimePicker Classes="Large" ClockIdentifier="12HourClock"/>
|
<TimePicker Classes="Large" ClockIdentifier="12HourClock" />
|
||||||
<TimePicker ClockIdentifier="12HourClock"/>
|
<TimePicker ClockIdentifier="12HourClock" />
|
||||||
<TimePicker Classes="Small" ClockIdentifier="12HourClock"/>
|
<TimePicker Classes="Small" ClockIdentifier="12HourClock" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TimePicker IsEnabled="False" />
|
<TimePicker IsEnabled="False" />
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
@@ -10,9 +8,4 @@ public partial class TimePickerDemo : UserControl
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
AvaloniaXamlLoader.Load(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
@@ -10,9 +8,4 @@ public partial class ToggleButtonDemo : UserControl
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
AvaloniaXamlLoader.Load(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
@@ -10,9 +8,4 @@ public partial class ToggleSwitchDemo : UserControl
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
AvaloniaXamlLoader.Load(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
@@ -10,9 +8,4 @@ public partial class ToolTipDemo : UserControl
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
AvaloniaXamlLoader.Load(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
@@ -25,14 +23,16 @@ public class TreeViewVm : ObservableObject
|
|||||||
{
|
{
|
||||||
Items = new ObservableCollection<TreeViewItemVm>()
|
Items = new ObservableCollection<TreeViewItemVm>()
|
||||||
{
|
{
|
||||||
new TreeViewItemVm() {Name = "Item 1", Id = "1"},
|
new TreeViewItemVm() { Name = "Item 1", Id = "1" },
|
||||||
new TreeViewItemVm() {Name = "Item 2", Id = "2"},
|
new TreeViewItemVm() { Name = "Item 2", Id = "2" },
|
||||||
new TreeViewItemVm() {Name = "Item 3", Id = "3", Items = new ObservableCollection<TreeViewItemVm>()
|
new TreeViewItemVm()
|
||||||
{
|
{
|
||||||
new TreeViewItemVm() {Name = "Item 3.1", Id = "3.1"},
|
Name = "Item 3", Id = "3", Items = new ObservableCollection<TreeViewItemVm>()
|
||||||
new TreeViewItemVm() {Name = "Item 3.2", Id = "3.2"},
|
{
|
||||||
new TreeViewItemVm() {Name = "Item 3.3", Id = "3.3"},
|
new TreeViewItemVm() { Name = "Item 3.1", Id = "3.1" },
|
||||||
},
|
new TreeViewItemVm() { Name = "Item 3.2", Id = "3.2" },
|
||||||
|
new TreeViewItemVm() { Name = "Item 3.3", Id = "3.3" },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -50,8 +50,10 @@ public class TreeViewVm : ObservableObject
|
|||||||
ThirdItem thirdItem = new ThirdItem { Id = k, Name = $"ThirdItem {k}" };
|
ThirdItem thirdItem = new ThirdItem { Id = k, Name = $"ThirdItem {k}" };
|
||||||
secondItem.ThirdItemItems.Add(thirdItem);
|
secondItem.ThirdItemItems.Add(thirdItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
firstItem.SecondItems.Add(secondItem);
|
firstItem.SecondItems.Add(secondItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
MultipleLevelItems.Add(firstItem);
|
MultipleLevelItems.Add(firstItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,18 +71,17 @@ public class ItemBase
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FirstItem : ItemBase
|
public class FirstItem : ItemBase
|
||||||
{
|
{
|
||||||
public ObservableCollection<SecondItem>? SecondItems { get; set; }
|
public ObservableCollection<SecondItem>? SecondItems { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SecondItem : ItemBase
|
public class SecondItem : ItemBase
|
||||||
{
|
{
|
||||||
public ObservableCollection<ThirdItem>? ThirdItemItems { get; set; }
|
public ObservableCollection<ThirdItem>? ThirdItemItems { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ThirdItem : ItemBase
|
public class ThirdItem : ItemBase
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
37
demo/Semi.Avalonia.Demo/ViewModels/AboutUsViewModel.cs
Normal file
37
demo/Semi.Avalonia.Demo/ViewModels/AboutUsViewModel.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using Avalonia.Platform.Storage;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
|
||||||
|
namespace Semi.Avalonia.Demo.ViewModels;
|
||||||
|
|
||||||
|
public partial class AboutUsViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
public ICommand NavigateCommand { get; set; }
|
||||||
|
|
||||||
|
internal ILauncher? Launcher { get; set; }
|
||||||
|
|
||||||
|
public AboutUsViewModel()
|
||||||
|
{
|
||||||
|
NavigateCommand = new AsyncRelayCommand<string>(OnNavigateAsync);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly IReadOnlyDictionary<string, string> _keyToUrlMapping = new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
["semi"] = "https://github.com/irihitech/Semi.Avalonia",
|
||||||
|
["ursa"] = "https://github.com/irihitech/Ursa.Avalonia",
|
||||||
|
["mantra"] = "https://www.bilibili.com/video/BV15pfKYbEEQ",
|
||||||
|
["huska"] = "https://www.bilibili.com/video/BV1knj1zWE4A",
|
||||||
|
};
|
||||||
|
|
||||||
|
private async Task OnNavigateAsync(string? arg)
|
||||||
|
{
|
||||||
|
if (Launcher is not null && arg is not null && _keyToUrlMapping.TryGetValue(arg.ToLower(), out var uri))
|
||||||
|
{
|
||||||
|
await Launcher.LaunchUriAsync(new Uri(uri));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,11 +2,10 @@ using Avalonia;
|
|||||||
using Avalonia.Controls.ApplicationLifetimes;
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using Semi.Avalonia.Demo.Views;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.ViewModels;
|
namespace Semi.Avalonia.Demo.ViewModels;
|
||||||
|
|
||||||
public partial class ApplicationViewModel: ObservableObject
|
public partial class ApplicationViewModel : ObservableObject
|
||||||
{
|
{
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void Exit()
|
private void Exit()
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
|
namespace Semi.Avalonia.Demo.ViewModels;
|
||||||
|
|
||||||
|
public class AutoCompleteBoxDemoViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
public ObservableCollection<StateData> States { get; set; } =
|
||||||
|
[
|
||||||
|
new("Alabama", "AL", "Montgomery"),
|
||||||
|
new("Alaska", "AK", "Juneau"),
|
||||||
|
new("Arizona", "AZ", "Phoenix"),
|
||||||
|
new("Arkansas", "AR", "Little Rock"),
|
||||||
|
new("California", "CA", "Sacramento"),
|
||||||
|
new("Colorado", "CO", "Denver"),
|
||||||
|
new("Connecticut", "CT", "Hartford"),
|
||||||
|
new("Delaware", "DE", "Dover"),
|
||||||
|
new("Florida", "FL", "Tallahassee"),
|
||||||
|
new("Georgia", "GA", "Atlanta"),
|
||||||
|
new("Hawaii", "HI", "Honolulu"),
|
||||||
|
new("Idaho", "ID", "Boise"),
|
||||||
|
new("Illinois", "IL", "Springfield"),
|
||||||
|
new("Indiana", "IN", "Indianapolis"),
|
||||||
|
new("Iowa", "IA", "Des Moines"),
|
||||||
|
new("Kansas", "KS", "Topeka"),
|
||||||
|
new("Kentucky", "KY", "Frankfort"),
|
||||||
|
new("Louisiana", "LA", "Baton Rouge"),
|
||||||
|
new("Maine", "ME", "Augusta"),
|
||||||
|
new("Maryland", "MD", "Annapolis"),
|
||||||
|
new("Massachusetts", "MA", "Boston"),
|
||||||
|
new("Michigan", "MI", "Lansing"),
|
||||||
|
new("Minnesota", "MN", "St. Paul"),
|
||||||
|
new("Mississippi", "MS", "Jackson"),
|
||||||
|
new("Missouri", "MO", "Jefferson City"),
|
||||||
|
new("Montana", "MT", "Helena"),
|
||||||
|
new("Nebraska", "NE", "Lincoln"),
|
||||||
|
new("Nevada", "NV", "Carson City"),
|
||||||
|
new("New Hampshire", "NH", "Concord"),
|
||||||
|
new("New Jersey", "NJ", "Trenton"),
|
||||||
|
new("New Mexico", "NM", "Santa Fe"),
|
||||||
|
new("New York", "NY", "Albany"),
|
||||||
|
new("North Carolina", "NC", "Raleigh"),
|
||||||
|
new("North Dakota", "ND", "Bismarck"),
|
||||||
|
new("Ohio", "OH", "Columbus"),
|
||||||
|
new("Oklahoma", "OK", "Oklahoma City"),
|
||||||
|
new("Oregon", "OR", "Salem"),
|
||||||
|
new("Pennsylvania", "PA", "Harrisburg"),
|
||||||
|
new("Rhode Island", "RI", "Providence"),
|
||||||
|
new("South Carolina", "SC", "Columbia"),
|
||||||
|
new("South Dakota", "SD", "Pierre"),
|
||||||
|
new("Tennessee", "TN", "Nashville"),
|
||||||
|
new("Texas", "TX", "Austin"),
|
||||||
|
new("Utah", "UT", "Salt Lake City"),
|
||||||
|
new("Vermont", "VT", "Montpelier"),
|
||||||
|
new("Virginia", "VA", "Richmond"),
|
||||||
|
new("Washington", "WA", "Olympia"),
|
||||||
|
new("West Virginia", "WV", "Charleston"),
|
||||||
|
new("Wisconsin", "WI", "Madison"),
|
||||||
|
new("Wyoming", "WY", "Cheyenne")
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public class StateData(string name, string abbreviation, string capital)
|
||||||
|
{
|
||||||
|
public string Name { get; private set; } = name;
|
||||||
|
public string Abbreviation { get; private set; } = abbreviation;
|
||||||
|
public string Capital { get; private set; } = capital;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
|
namespace Semi.Avalonia.Demo.ViewModels;
|
||||||
|
|
||||||
|
public class ComboBoxDemoViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
public ObservableCollection<string> Items { get; set; } = ["Ding", "Otter", "Husky", "Mr.17", "Cass"];
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
|
namespace Semi.Avalonia.Demo.ViewModels;
|
||||||
|
|
||||||
|
public class RefreshContainerDemoViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
public ObservableCollection<string> Items { get; }
|
||||||
|
|
||||||
|
public RefreshContainerDemoViewModel()
|
||||||
|
{
|
||||||
|
Items = new ObservableCollection<string>(Enumerable.Range(1, 200).Select(i => $"Item {i}"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task AddToTop()
|
||||||
|
{
|
||||||
|
await Task.Delay(1000);
|
||||||
|
Items.Insert(0, $"Item {200 - Items.Count}");
|
||||||
|
}
|
||||||
|
}
|
||||||
29
demo/Semi.Avalonia.Demo/ViewModels/SplitViewDemoViewModel.cs
Normal file
29
demo/Semi.Avalonia.Demo/ViewModels/SplitViewDemoViewModel.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
|
namespace Semi.Avalonia.Demo.ViewModels;
|
||||||
|
|
||||||
|
public class SplitViewDemoViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
public ObservableCollection<string> Songs { get; set; } =
|
||||||
|
[
|
||||||
|
"320万年前",
|
||||||
|
"隐德来希",
|
||||||
|
"孔明",
|
||||||
|
"锦鲤卟噜噜",
|
||||||
|
"指鹿为马",
|
||||||
|
"热带季风Remix",
|
||||||
|
"加州梦境",
|
||||||
|
"渐近自由",
|
||||||
|
"世界所有的烂漫",
|
||||||
|
];
|
||||||
|
|
||||||
|
public static ObservableCollection<SplitViewDisplayMode> DisplayModes { get; set; } =
|
||||||
|
[
|
||||||
|
SplitViewDisplayMode.Inline,
|
||||||
|
SplitViewDisplayMode.CompactInline,
|
||||||
|
SplitViewDisplayMode.Overlay,
|
||||||
|
SplitViewDisplayMode.CompactOverlay,
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
|||||||
|
|
||||||
namespace Semi.Avalonia.Demo.ViewModels;
|
namespace Semi.Avalonia.Demo.ViewModels;
|
||||||
|
|
||||||
public class TreeDataGridDemoViewModel: ObservableObject
|
public class TreeDataGridDemoViewModel : ObservableObject
|
||||||
{
|
{
|
||||||
public SongsPageViewModel SongsContext { get; } = new();
|
public SongsPageViewModel SongsContext { get; } = new();
|
||||||
public FilesPageViewModel FilesContext { get; } = new();
|
public FilesPageViewModel FilesContext { get; } = new();
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Controls.Notifications;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Views;
|
namespace Semi.Avalonia.Demo.Views;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user