Merge branch 'refs/heads/main' into ElasticWrapPanel
# Conflicts: # demo/Ursa.Demo/Models/MenuKeys.cs # demo/Ursa.Demo/ViewModels/MainViewViewModel.cs # demo/Ursa.Demo/ViewModels/MenuViewModel.cs # src/Ursa.Themes.Semi/Controls/_index.axaml
This commit is contained in:
57
.github/workflows/deploy.yml
vendored
57
.github/workflows/deploy.yml
vendored
@@ -1,8 +1,8 @@
|
||||
name: Deploy to GitHub Pages
|
||||
|
||||
env:
|
||||
PROJECT_PATH: demo/Ursa.Demo.Browser/Ursa.Demo.Browser.csproj
|
||||
OUTPUT_PATH: demo/Ursa.Demo.Browser/bin/Debug/net7.0/browser-wasm/AppBundle
|
||||
PROJECT_PATH: demo/Ursa.Demo.Browser/Ursa.Demo.Browser.csproj
|
||||
OUTPUT_PATH: demo/Ursa.Demo.Browser/bin/Release/net7.0/browser-wasm/AppBundle
|
||||
on:
|
||||
push:
|
||||
branches: [ "deploy" ]
|
||||
@@ -13,38 +13,41 @@ jobs:
|
||||
deploy-to-github-pages:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4.1.1
|
||||
|
||||
- name: Setup .NET Core SDK
|
||||
uses: actions/setup-dotnet@v1.9.0
|
||||
- name: Setup .NET 7
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 7.0.405
|
||||
|
||||
- name: Install wasm-tools
|
||||
run: dotnet workload install wasm-tools wasm-experimental
|
||||
- name: Install wasm-tools
|
||||
run: dotnet workload install wasm-tools wasm-tools-net7
|
||||
|
||||
- name: Install DotNetCompress
|
||||
run: dotnet tool install --global DotNetCompress --version 2.0.0 --no-cache
|
||||
- name: Install DotNetCompress
|
||||
run: dotnet tool install --global DotNetCompress --version 3.0.0 --no-cache
|
||||
|
||||
- name: Publish .NET Project
|
||||
run: dotnet publish $PROJECT_PATH -c Debug -o debug --nologo
|
||||
- name: Publish .NET Project
|
||||
run: dotnet publish $PROJECT_PATH -c Release -o release --nologo
|
||||
|
||||
- name: Change base-tag in index.html
|
||||
run: sed -i 's/<base href="\/" \/>/<base href="\/Ursa.Avalonia\/" \/>/g' $OUTPUT_PATH/index.html
|
||||
- name: Change base-tag in index.html
|
||||
run: sed -i 's/<base href="\/" \/>/<base href="\/Ursa.Avalonia\/" \/>/g' $OUTPUT_PATH/index.html
|
||||
|
||||
- name: copy index.html to 404.html
|
||||
run: cp $OUTPUT_PATH/index.html $OUTPUT_PATH/404.html
|
||||
- name: copy index.html to 404.html
|
||||
run: cp $OUTPUT_PATH/index.html $OUTPUT_PATH/404.html
|
||||
|
||||
- name: Compress Output using Brotli
|
||||
run: DotNetCompress -d $OUTPUT_PATH -p "*.dll" "*.js" "*.wasm" --format br --threads 4
|
||||
- name: Compress Output using Brotli
|
||||
run: DotNetCompress -d $OUTPUT_PATH -p "*.dll" "*.js" "*.wasm" --format br --threads 4
|
||||
|
||||
- name: Compress Output using GZip
|
||||
run: DotNetCompress -d $OUTPUT_PATH -p "*.dll" "*.js" "*.wasm" --format gz --threads 4
|
||||
- name: Compress Output using GZip
|
||||
run: DotNetCompress -d $OUTPUT_PATH -p "*.dll" "*.js" "*.wasm" --format gz --threads 4
|
||||
|
||||
- name: Add .nojekyll file
|
||||
run: touch $OUTPUT_PATH/.nojekyll
|
||||
- name: Add .nojekyll file
|
||||
run: touch $OUTPUT_PATH/.nojekyll
|
||||
|
||||
- name: Commit wwwroot to GitHub Pages
|
||||
uses: JamesIves/github-pages-deploy-action@4.1.7
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
BRANCH: gh-pages
|
||||
FOLDER: ${{ env.OUTPUT_PATH }}
|
||||
- name: Commit wwwroot to GitHub Pages
|
||||
uses: JamesIves/github-pages-deploy-action@v4.5.0
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
BRANCH: gh-pages
|
||||
FOLDER: ${{ env.OUTPUT_PATH }}
|
||||
|
||||
22
README.md
22
README.md
@@ -6,12 +6,14 @@
|
||||
|
||||
Ursa is a UI library for building cross-platform UIs with Avalonia UI.
|
||||
|
||||

|
||||
|
||||
## How to use
|
||||
1. Ursa
|
||||
|
||||
Add nuget package:
|
||||
```bash
|
||||
dotnet add package Irihi.Ursa --version 0.1.0-beta20230702
|
||||
dotnet add package Irihi.Ursa
|
||||
```
|
||||
|
||||
You can now use Ursa controls in your Avalonia Application.
|
||||
@@ -39,14 +41,24 @@ Ursa.Themes.Semi is a theme package for Ursa inspired by Semi Design. You can ad
|
||||
|
||||
Add nuget package:
|
||||
```bash
|
||||
dotnet add package Semi.Avalonia --version 11.0.0-rc1
|
||||
dotnet add package Irihi.Ursa.Themes.Semi --version 0.1.0-beta20230702
|
||||
dotnet add package Semi.Avalonia --version 11.0.7
|
||||
dotnet add package Irihi.Ursa.Themes.Semi
|
||||
```
|
||||
|
||||
Include Styles in application:
|
||||
```xaml
|
||||
<Application...
|
||||
xmlns:u-semi="https://irihi.tech/ursa/themes/semi"
|
||||
....>
|
||||
|
||||
<Application.Styles>
|
||||
<StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" />
|
||||
<StyleInclude Source="avares://Ursa.Themes.Semi/Index.axaml" />
|
||||
<u-semi:SemiTheme Locale="zh-CN"/>
|
||||
</Application.Styles>
|
||||
```
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
We offer limited free community support for Semi Avalonia and Ursa. Please join our group via FeiShu(Lark)
|
||||
|
||||

|
||||
19
Ursa.sln
19
Ursa.sln
@@ -16,6 +16,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ursa.Demo.iOS", "demo\Ursa.
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ursa.Demo.Browser", "demo\Ursa.Demo.Browser\Ursa.Demo.Browser.csproj", "{D1942476-8473-4608-BB9F-5AC01083BBDA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ursa.PrismExtension", "src\Ursa.PrismExtension\Ursa.PrismExtension.csproj", "{2E934F60-F5DF-4856-B05A-B949C7F9D948}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ursa.PrismDialogDemo", "demo\Ursa.PrismDialogDemo\Ursa.PrismDialogDemo.csproj", "{F99B3D07-4560-4B05-892C-0FF2757FEF2E}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Files", "Solution Files", "{9D34CC2C-9BFA-4138-BA5A-CD3744F9B589}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
src\Package.props = src\Package.props
|
||||
demo\Directory.Build.props = demo\Directory.Build.props
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -50,6 +60,14 @@ Global
|
||||
{D1942476-8473-4608-BB9F-5AC01083BBDA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D1942476-8473-4608-BB9F-5AC01083BBDA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D1942476-8473-4608-BB9F-5AC01083BBDA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2E934F60-F5DF-4856-B05A-B949C7F9D948}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2E934F60-F5DF-4856-B05A-B949C7F9D948}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2E934F60-F5DF-4856-B05A-B949C7F9D948}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2E934F60-F5DF-4856-B05A-B949C7F9D948}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F99B3D07-4560-4B05-892C-0FF2757FEF2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F99B3D07-4560-4B05-892C-0FF2757FEF2E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F99B3D07-4560-4B05-892C-0FF2757FEF2E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F99B3D07-4560-4B05-892C-0FF2757FEF2E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{407A91FD-A88B-459B-8DCE-8C6AA98279FE} = {A41BAF0D-DA61-4A63-889A-084BAD36FD66}
|
||||
@@ -57,5 +75,6 @@ Global
|
||||
{B6BAB821-A9FE-44F3-B9CD-06E27FDB63F6} = {A41BAF0D-DA61-4A63-889A-084BAD36FD66}
|
||||
{94C2BBD9-8B57-4AE9-AAFD-7D4335B15A8E} = {A41BAF0D-DA61-4A63-889A-084BAD36FD66}
|
||||
{D1942476-8473-4608-BB9F-5AC01083BBDA} = {A41BAF0D-DA61-4A63-889A-084BAD36FD66}
|
||||
{F99B3D07-4560-4B05-892C-0FF2757FEF2E} = {A41BAF0D-DA61-4A63-889A-084BAD36FD66}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
BIN
assets/community-support.png
Normal file
BIN
assets/community-support.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 168 KiB |
BIN
assets/demo.png
Normal file
BIN
assets/demo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 144 KiB |
@@ -1,6 +1,6 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Nullable>enable</Nullable>
|
||||
<AvaloniaVersion>11.0.0</AvaloniaVersion>
|
||||
<AvaloniaVersion>11.0.10</AvaloniaVersion>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0-android</TargetFramework>
|
||||
<TargetFramework>net8.0-android</TargetFramework>
|
||||
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<ApplicationId>com.irihitech.Ursa</ApplicationId>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
|
||||
<WasmMainJSPath>AppBundle\main.js</WasmMainJSPath>
|
||||
<OutputType>Exe</OutputType>
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
<OutputType>WinExe</OutputType>
|
||||
<!--If you are willing to use Windows/MacOS native APIs you will need to create 3 projects.
|
||||
One for Windows with net7.0-windows TFM, one for MacOS with net7.0-macos and one with net7.0 TFM for Linux.-->
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<AvaloniaUseCompiledBindingsByDefault>false</AvaloniaUseCompiledBindingsByDefault>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0-ios</TargetFramework>
|
||||
<TargetFramework>net8.0-ios</TargetFramework>
|
||||
<SupportedOSPlatformVersion>13.0</SupportedOSPlatformVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<Application
|
||||
x:Class="Ursa.Demo.App"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:u-semi="https://irihi.tech/ursa/themes/semi">
|
||||
<Application.Styles>
|
||||
<StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" />
|
||||
<StyleInclude Source="avares://Ursa.Themes.Semi/Index.axaml" />
|
||||
<u-semi:SemiTheme Locale="zh-CN" />
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
BIN
demo/Ursa.Demo/Assets/3x.png
Normal file
BIN
demo/Ursa.Demo/Assets/3x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 MiB |
BIN
demo/Ursa.Demo/Assets/IRIHI.png
Normal file
BIN
demo/Ursa.Demo/Assets/IRIHI.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.4 KiB |
BIN
demo/Ursa.Demo/Assets/WORLD.png
Normal file
BIN
demo/Ursa.Demo/Assets/WORLD.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
@@ -13,7 +13,7 @@ namespace Ursa.Demo.Converters;
|
||||
public class IconNameConverter: IValueConverter
|
||||
{
|
||||
[Content]
|
||||
public Dictionary<string, PathGeometry> Paths { get; set; } = new();
|
||||
public Dictionary<string, StreamGeometry> Paths { get; set; } = new();
|
||||
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
|
||||
42
demo/Ursa.Demo/Converters/IconNameToPathConverter.cs
Normal file
42
demo/Ursa.Demo/Converters/IconNameToPathConverter.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Data.Converters;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace Ursa.Demo.Converters;
|
||||
|
||||
public class IconNameToPathConverter: IValueConverter
|
||||
{
|
||||
private string[] paths = new[]
|
||||
{
|
||||
"M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z",
|
||||
"M16 12L9 2L2 12H3.86L0 18H7V22H11V18H18L14.14 12H16M20.14 12H22L15 2L12.61 5.41L17.92 13H15.97L19.19 18H24L20.14 12M13 19H17V22H13V19Z",
|
||||
"M15,9H5V5H15M12,19A3,3 0 0,1 9,16A3,3 0 0,1 12,13A3,3 0 0,1 15,16A3,3 0 0,1 12,19M17,3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V7L17,3Z",
|
||||
"M5 21C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5V19C21 20.1 20.1 21 19 21H5M15.3 16L13.2 13.9L17 10L14.2 7.2L10.4 11.1L8.2 8.9V16H15.3Z",
|
||||
"M16,9V7H12V12.5C11.58,12.19 11.07,12 10.5,12A2.5,2.5 0 0,0 8,14.5A2.5,2.5 0 0,0 10.5,17A2.5,2.5 0 0,0 13,14.5V9H16M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2Z",
|
||||
"M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.67C6,21.4 6.6,22 7.33,22H16.67A1.33,1.33 0 0,0 18,20.67V5.33C18,4.6 17.4,4 16.67,4Z",
|
||||
"M12 2C6.5 2 2 6.5 2 12C2 17.5 6.5 22 12 22C17.5 22 22 17.5 22 12S17.5 2 12 2M12.5 13H11V7H12.5V11.3L16.2 9.2L17 10.5L12.5 13Z"
|
||||
};
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is int i)
|
||||
{
|
||||
string s = paths[i % paths.Length];
|
||||
return StreamGeometry.Parse(s);
|
||||
}
|
||||
else if (value is string s)
|
||||
{
|
||||
int hash = s.GetHashCode();
|
||||
string path = paths[Math.Abs(hash) % paths.Length];
|
||||
return StreamGeometry.Parse(path);
|
||||
}
|
||||
return AvaloniaProperty.UnsetValue;
|
||||
}
|
||||
|
||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
return AvaloniaProperty.UnsetValue;
|
||||
}
|
||||
}
|
||||
32
demo/Ursa.Demo/Converters/TimelineIconConverter.cs
Normal file
32
demo/Ursa.Demo/Converters/TimelineIconConverter.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Avalonia;
|
||||
using Avalonia.Data;
|
||||
using Avalonia.Data.Converters;
|
||||
using Avalonia.Media;
|
||||
using Ursa.Controls;
|
||||
|
||||
namespace Ursa.Demo.Converters;
|
||||
|
||||
public class TimelineIconConverter: IValueConverter
|
||||
{
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is TimelineItemType t)
|
||||
{
|
||||
return t switch
|
||||
{
|
||||
TimelineItemType.Success => Brushes.Green,
|
||||
TimelineItemType.Ongoing => Brushes.Blue,
|
||||
TimelineItemType.Error => Brushes.Red,
|
||||
_ => Brushes.Gray
|
||||
};
|
||||
}
|
||||
return AvaloniaProperty.UnsetValue;
|
||||
}
|
||||
|
||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
56
demo/Ursa.Demo/DataTemplates/ToolBarItemTemplateSelector.cs
Normal file
56
demo/Ursa.Demo/DataTemplates/ToolBarItemTemplateSelector.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Controls.Templates;
|
||||
using Avalonia.Data;
|
||||
using Ursa.Controls;
|
||||
using Ursa.Demo.ViewModels;
|
||||
|
||||
namespace Ursa.Demo.Converters;
|
||||
|
||||
public class ToolBarItemTemplateSelector: IDataTemplate
|
||||
{
|
||||
|
||||
public static ToolBarItemTemplateSelector Instance { get; } = new();
|
||||
public Control? Build(object? param)
|
||||
{
|
||||
if (param is null) return null;
|
||||
if (param is ToolBarSeparatorViewModel sep)
|
||||
{
|
||||
return new ToolBarSeparator();
|
||||
}
|
||||
if (param is ToolBarButtonItemViewModel vm)
|
||||
{
|
||||
return new Button()
|
||||
{
|
||||
[!ContentControl.ContentProperty] = new Binding() { Path = "Content" },
|
||||
[!Button.CommandProperty] = new Binding() { Path = "Command" },
|
||||
[!ToolBar.OverflowModeProperty] = new Binding(){Path = nameof(ToolBarItemViewModel.OverflowMode)},
|
||||
};
|
||||
}
|
||||
if (param is ToolBarCheckBoxItemViweModel cb)
|
||||
{
|
||||
return new CheckBox()
|
||||
{
|
||||
[!ContentControl.ContentProperty] = new Binding() { Path = "Content" },
|
||||
[!ToggleButton.IsCheckedProperty] = new Binding() { Path = "IsChecked" },
|
||||
[!ToolBar.OverflowModeProperty] = new Binding(){Path = nameof(ToolBarItemViewModel.OverflowMode)},
|
||||
};
|
||||
}
|
||||
if (param is ToolBarComboBoxItemViewModel combo)
|
||||
{
|
||||
return new ComboBox()
|
||||
{
|
||||
[!ContentControl.ContentProperty] = new Binding() { Path = "Content" },
|
||||
[!SelectingItemsControl.SelectedItemProperty] = new Binding() { Path = "SelectedItem" },
|
||||
[!ItemsControl.ItemsSourceProperty] = new Binding() { Path = "Items" },
|
||||
[!ToolBar.OverflowModeProperty] = new Binding(){Path = nameof(ToolBarItemViewModel.OverflowMode)},
|
||||
};
|
||||
}
|
||||
return new Button() { Content = "Undefined Item" };
|
||||
}
|
||||
|
||||
public bool Match(object? data)
|
||||
{
|
||||
return data is ToolBarItemViewModel;
|
||||
}
|
||||
}
|
||||
45
demo/Ursa.Demo/Dialogs/DialogWithAction.axaml
Normal file
45
demo/Ursa.Demo/Dialogs/DialogWithAction.axaml
Normal file
@@ -0,0 +1,45 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Dialogs.DialogWithAction"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Ursa.Demo.Dialogs"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="local:DialogWithActionViewModel"
|
||||
Background="{DynamicResource SemiYellow1}"
|
||||
mc:Ignorable="d">
|
||||
<Grid Margin="24" RowDefinitions="Auto, *, Auto">
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
Margin="8"
|
||||
FontSize="16"
|
||||
FontWeight="600"
|
||||
Text="{Binding Title}" />
|
||||
<Calendar
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Top"
|
||||
SelectedDate="{Binding Date}" />
|
||||
<StackPanel
|
||||
Grid.Row="2"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<Rectangle Width="10" Height="10" Fill="Red" u:DialogControlBase.CanClose="True"></Rectangle>
|
||||
<Button Command="{Binding DialogCommand}" Content="Dialog" />
|
||||
<Button Command="{Binding OKCommand}" Content="OK" />
|
||||
<Button Command="{Binding CancelCommand}" Content="Cancel" />
|
||||
<ComboBox>
|
||||
<ComboBoxItem>A</ComboBoxItem>
|
||||
<ComboBoxItem>B</ComboBoxItem>
|
||||
<ComboBoxItem>C</ComboBoxItem>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Dialogs/DialogWithAction.axaml.cs
Normal file
13
demo/Ursa.Demo/Dialogs/DialogWithAction.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Dialogs;
|
||||
|
||||
public partial class DialogWithAction : UserControl
|
||||
{
|
||||
public DialogWithAction()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
51
demo/Ursa.Demo/Dialogs/DialogWithActionViewModel.cs
Normal file
51
demo/Ursa.Demo/Dialogs/DialogWithActionViewModel.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Irihi.Avalonia.Shared.Contracts;
|
||||
using Ursa.Controls;
|
||||
|
||||
namespace Ursa.Demo.Dialogs;
|
||||
|
||||
public partial class DialogWithActionViewModel: ObservableObject, IDialogContext
|
||||
{
|
||||
[ObservableProperty] private string _title;
|
||||
[ObservableProperty] private DateTime _date;
|
||||
|
||||
public void Close()
|
||||
{
|
||||
RequestClose?.Invoke(this, false);
|
||||
}
|
||||
|
||||
public event EventHandler<object?>? RequestClose;
|
||||
|
||||
public ICommand OKCommand { get; set; }
|
||||
public ICommand CancelCommand { get; set; }
|
||||
|
||||
public ICommand DialogCommand { get; set; }
|
||||
|
||||
public DialogWithActionViewModel()
|
||||
{
|
||||
OKCommand = new RelayCommand(OK);
|
||||
CancelCommand = new RelayCommand(Cancel);
|
||||
DialogCommand = new AsyncRelayCommand(ShowDialog);
|
||||
Title = "Please select a date";
|
||||
Date = DateTime.Now;
|
||||
}
|
||||
|
||||
private void OK()
|
||||
{
|
||||
RequestClose?.Invoke(this, true);
|
||||
}
|
||||
|
||||
private void Cancel()
|
||||
{
|
||||
RequestClose?.Invoke(this, false);
|
||||
}
|
||||
|
||||
private async Task ShowDialog()
|
||||
{
|
||||
await OverlayDialog.ShowCustomModal<DialogWithAction, DialogWithActionViewModel, bool>(new DialogWithActionViewModel());
|
||||
}
|
||||
}
|
||||
14
demo/Ursa.Demo/Dialogs/PlainDialog.axaml
Normal file
14
demo/Ursa.Demo/Dialogs/PlainDialog.axaml
Normal file
@@ -0,0 +1,14 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
xmlns:local="clr-namespace:Ursa.Demo.Dialogs"
|
||||
x:DataType="local:PlainDialogViewModel"
|
||||
x:CompileBindings="True"
|
||||
x:Class="Ursa.Demo.Dialogs.PlainDialog">
|
||||
<StackPanel>
|
||||
<Calendar SelectedDate="{Binding Date}" ></Calendar>
|
||||
<TextBlock TextWrapping="Wrap" Text="{Binding Text}"></TextBlock>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Dialogs/PlainDialog.axaml.cs
Normal file
13
demo/Ursa.Demo/Dialogs/PlainDialog.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Dialogs;
|
||||
|
||||
public partial class PlainDialog : UserControl
|
||||
{
|
||||
public PlainDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
28
demo/Ursa.Demo/Dialogs/PlainDialogViewModel.cs
Normal file
28
demo/Ursa.Demo/Dialogs/PlainDialogViewModel.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace Ursa.Demo.Dialogs;
|
||||
|
||||
public class PlainDialogViewModel: ObservableObject
|
||||
{
|
||||
private DateTime? _date;
|
||||
|
||||
public DateTime? Date
|
||||
{
|
||||
get => _date;
|
||||
set => SetProperty(ref _date, value);
|
||||
}
|
||||
|
||||
private string? _text;
|
||||
public string? Text
|
||||
{
|
||||
get => _text;
|
||||
set => SetProperty(ref _text, value);
|
||||
}
|
||||
|
||||
public PlainDialogViewModel()
|
||||
{
|
||||
Text =
|
||||
"千古悠悠 有多少冤魂嗟叹 空怅望人寰无限 丛生哀怨 泣血蝇虫笑苍天 孤帆叠影锁白链 残月升骤起烈烈风 尽吹散 尽吹散 尽吹散 滂沱雨无底涧 涉激流登彼岸 奋力拨云间消得雾患 社稷安抚臣子心 长驱鬼魅不休战 看斜阳照大地阡陌 从头转";
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
namespace Ursa.Demo;
|
||||
|
||||
public static class MenuKeys
|
||||
{
|
||||
public const string MenuKeyBadge = "Badge";
|
||||
public const string MenuKeyBanner = "Banner";
|
||||
public const string MenuKeyButtonGroup = "ButtonGroup";
|
||||
public const string MenuKeyDivider = "Divider";
|
||||
public const string MenuKeyDualBadge = "DualBadge";
|
||||
public const string MenuKeyElasticWrapPanel = "ElasticWrapPanel";
|
||||
public const string MenuKeyIpBox = "IPv4Box";
|
||||
public const string MenuKeyKeyGestureInput = "KeyGestureInput";
|
||||
public const string MenuKeyLoading = "Loading";
|
||||
public const string MenuKeyNavigation = "Navigation";
|
||||
public const string MenuKeyPagination = "Pagination";
|
||||
public const string MenuKeyTagInput = "TagInput";
|
||||
public const string MenuKeyTimeline = "Timeline";
|
||||
|
||||
}
|
||||
@@ -5,129 +5,355 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
d:DesignHeight="850"
|
||||
d:DesignWidth="850"
|
||||
mc:Ignorable="d">
|
||||
<StackPanel
|
||||
Margin="24"
|
||||
HorizontalAlignment="Left"
|
||||
ClipToBounds="False">
|
||||
<StackPanel.Styles>
|
||||
<Style Selector="u|Badge">
|
||||
<Setter Property="Margin" Value="14" />
|
||||
</Style>
|
||||
<Style Selector="Border">
|
||||
<Setter Property="Background" Value="Orange" />
|
||||
</Style>
|
||||
</StackPanel.Styles>
|
||||
<TextBlock Text="Hello" />
|
||||
<u:Badge
|
||||
HorizontalAlignment="Center"
|
||||
BadgeContent="500"
|
||||
OverflowCount="100">
|
||||
<Border Width="100" Height="50" />
|
||||
</u:Badge>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<u:Badge BadgeContent="5" CornerPosition="TopLeft">
|
||||
<Border Width="100" Height="50" />
|
||||
</u:Badge>
|
||||
<u:Badge BadgeContent="5" CornerPosition="TopRight">
|
||||
<Border Width="100" Height="50" />
|
||||
</u:Badge>
|
||||
<u:Badge BadgeContent="5" CornerPosition="BottomLeft">
|
||||
<Border Width="100" Height="50" />
|
||||
</u:Badge>
|
||||
<u:Badge BadgeContent="5" CornerPosition="BottomRight">
|
||||
<Border Width="100" Height="50" />
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Auto" u:ScrollTo.Direction="Bottom">
|
||||
<StackPanel
|
||||
Margin="24"
|
||||
HorizontalAlignment="Left"
|
||||
ClipToBounds="False">
|
||||
|
||||
<StackPanel.Styles>
|
||||
<Style Selector="u|Badge">
|
||||
<Setter Property="Margin" Value="14" />
|
||||
<Style Selector="^ Border">
|
||||
<Setter Property="Background" Value="{DynamicResource SemiOrange3}" />
|
||||
<Setter Property="CornerRadius" Value="8" />
|
||||
<Style Selector="^ TextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
</Style>
|
||||
</Style>
|
||||
</StackPanel.Styles>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<u:Badge
|
||||
HorizontalAlignment="Center"
|
||||
Header="500"
|
||||
OverflowCount="100">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="■■■"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge Header="SUCCEED!">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="■■■"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge Header="Hello" />
|
||||
<u:Badge Header="Hello" Dot="True" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<u:Badge Header="5" CornerPosition="TopLeft">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="■■■"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge Header="5" CornerPosition="TopRight">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="■■■"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge Header="5" CornerPosition="BottomLeft">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="■■■"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge Header="5" CornerPosition="BottomRight">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="■■■"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<u:Badge
|
||||
Header="VIP"
|
||||
CornerPosition="TopLeft"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="■■■"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
Header="VIP"
|
||||
CornerPosition="TopRight"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="■■■"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
Header="VIP"
|
||||
CornerPosition="BottomLeft"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="■■■"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
Header="VIP"
|
||||
CornerPosition="BottomRight"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="■■■"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
</StackPanel>
|
||||
<u:Badge HorizontalAlignment="Stretch" Header="VIP">
|
||||
<Border Height="50">
|
||||
<TextBlock Text="■■■"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<u:Badge Header="URSA" Classes="Primary">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Solid"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge Header="URSA" Classes="Secondary">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Solid"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge Header="URSA" Classes="Tertiary">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Solid"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge Header="URSA" Classes="Success">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Solid"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge Header="URSA" Classes="Warning">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Solid"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge Header="URSA" Classes="Danger">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Solid"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<u:Badge Header="URSA" Classes="Light Primary">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Light"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge Header="URSA" Classes="Light Secondary">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Light"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge Header="URSA" Classes="Light Tertiary">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Light"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge Header="URSA" Classes="Light Success">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Light"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge Header="URSA" Classes="Light Warning">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Light"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge Header="URSA" Classes="Light Danger">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Light"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<u:Badge Header="URSA" Classes="Inverted Primary">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Inverted"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge Header="URSA" Classes="Inverted Secondary">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Inverted"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge Header="URSA" Classes="Inverted Tertiary">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Inverted"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge Header="URSA" Classes="Inverted Success">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Inverted"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge Header="URSA" Classes="Inverted Warning">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Inverted"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge Header="URSA" Classes="Inverted Danger">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Inverted"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<u:Badge
|
||||
Header="URSA"
|
||||
Classes="Primary"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Solid"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
Header="URSA"
|
||||
Classes="Secondary"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Solid"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
Header="URSA"
|
||||
Classes="Tertiary"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Solid"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
Header="URSA"
|
||||
Classes="Success"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Solid"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
Header="URSA"
|
||||
Classes="Warning"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Solid"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
Header="URSA"
|
||||
Classes="Danger"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Solid"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<u:Badge
|
||||
Header="URSA"
|
||||
Classes="Light Primary"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Light"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
Header="URSA"
|
||||
Classes="Light Secondary"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Light"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
Header="URSA"
|
||||
Classes="Light Tertiary"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Light"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
Header="URSA"
|
||||
Classes="Light Success"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Light"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
Header="URSA"
|
||||
Classes="Light Warning"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Light"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
Header="URSA"
|
||||
Classes="Light Danger"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Light"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
</StackPanel>
|
||||
<Border Background="{DynamicResource SemiGrey2}" CornerRadius="4">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<u:Badge
|
||||
Header="URSA"
|
||||
Classes="Inverted Primary"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Inverted"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
Header="URSA"
|
||||
Classes="Inverted Secondary"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Inverted"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
Header="URSA"
|
||||
Classes="Inverted Tertiary"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Inverted"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
Header="URSA"
|
||||
Classes="Inverted Success"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Inverted"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
Header="URSA"
|
||||
Classes="Inverted Warning"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Inverted"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
Header="URSA"
|
||||
Classes="Inverted Danger"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50">
|
||||
<TextBlock Text="Inverted"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<u:Badge BadgeContent="SUCCEED!">
|
||||
<Border Width="100" Height="50" />
|
||||
</u:Badge>
|
||||
<u:Badge HorizontalAlignment="Stretch" BadgeContent="VIP">
|
||||
<Border Height="50" />
|
||||
</u:Badge>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<u:Badge
|
||||
BadgeContent="VIP"
|
||||
CornerPosition="TopLeft"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50" />
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
BadgeContent="VIP"
|
||||
CornerPosition="TopRight"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50" />
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
BadgeContent="VIP"
|
||||
CornerPosition="BottomLeft"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50" />
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
BadgeContent="VIP"
|
||||
CornerPosition="BottomRight"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50" />
|
||||
</u:Badge>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<u:Badge BadgeContent="URSA" Classes="Primary">
|
||||
<Border Width="100" Height="50" />
|
||||
</u:Badge>
|
||||
<u:Badge BadgeContent="URSA" Classes="Secondary">
|
||||
<Border Width="100" Height="50" />
|
||||
</u:Badge>
|
||||
<u:Badge BadgeContent="URSA" Classes="Tertiary">
|
||||
<Border Width="100" Height="50" />
|
||||
</u:Badge>
|
||||
<u:Badge BadgeContent="URSA" Classes="Warning">
|
||||
<Border Width="100" Height="50" />
|
||||
</u:Badge>
|
||||
<u:Badge BadgeContent="URSA" Classes="Danger">
|
||||
<Border Width="100" Height="50" />
|
||||
</u:Badge>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<u:Badge
|
||||
BadgeContent="URSA"
|
||||
Classes="Primary"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50" />
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
BadgeContent="URSA"
|
||||
Classes="Secondary"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50" />
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
BadgeContent="URSA"
|
||||
Classes="Tertiary"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50" />
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
BadgeContent="URSA"
|
||||
Classes="Warning"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50" />
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
BadgeContent="URSA"
|
||||
Classes="Danger"
|
||||
Dot="True">
|
||||
<Border Width="100" Height="50" />
|
||||
</u:Badge>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<u:Badge VerticalAlignment="Center" BadgeContent="Hello" />
|
||||
<u:Badge
|
||||
VerticalAlignment="Center"
|
||||
BadgeContent="Hello"
|
||||
Dot="True" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -47,6 +47,5 @@
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
||||
@@ -14,16 +14,17 @@ public partial class BannerDemo : UserControl
|
||||
InitializeComponent();
|
||||
this.DataContext = new BannerDemoViewModel();
|
||||
}
|
||||
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
|
||||
public class BannerDemoViewModel: ViewModelBase
|
||||
public class BannerDemoViewModel : ViewModelBase
|
||||
{
|
||||
private ObservableCollection<NotificationType> _types;
|
||||
|
||||
public ObservableCollection<NotificationType> Types
|
||||
{
|
||||
get => _types;
|
||||
@@ -48,6 +49,9 @@ public class BannerDemoViewModel: ViewModelBase
|
||||
|
||||
public BannerDemoViewModel()
|
||||
{
|
||||
Types = new ObservableCollection<NotificationType>() { NotificationType.Information, NotificationType.Warning, NotificationType.Error, NotificationType.Success };
|
||||
Types = new ObservableCollection<NotificationType>()
|
||||
{
|
||||
NotificationType.Information, NotificationType.Success, NotificationType.Warning, NotificationType.Error
|
||||
};
|
||||
}
|
||||
}
|
||||
56
demo/Ursa.Demo/Pages/BreadcrumbDemo.axaml
Normal file
56
demo/Ursa.Demo/Pages/BreadcrumbDemo.axaml
Normal file
@@ -0,0 +1,56 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.BreadcrumbDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="using:Ursa.Demo.ViewModels"
|
||||
xmlns:converters="clr-namespace:Ursa.Demo.Converters"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="vm:BreadcrumbDemoViewModel"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<converters:IconNameToPathConverter x:Key="IconConverter" />
|
||||
</UserControl.Resources>
|
||||
<StackPanel>
|
||||
|
||||
<u:Breadcrumb>
|
||||
<TextBlock Text="Hello" />
|
||||
<u:BreadcrumbItem Content="World" IsReadOnly="True"></u:BreadcrumbItem>
|
||||
<u:BreadcrumbItem Icon="?" Separator="♥" />
|
||||
<TextBlock Text="Avalonia" />
|
||||
<TextBlock Text="Ursa" />
|
||||
</u:Breadcrumb>
|
||||
<u:Breadcrumb Classes="Small">
|
||||
<TextBlock Text="Hello" />
|
||||
<u:BreadcrumbItem Icon="?" Separator="♥" />
|
||||
<TextBlock Text="Avalonia" />
|
||||
<TextBlock Text="Ursa" />
|
||||
</u:Breadcrumb>
|
||||
<u:Breadcrumb>
|
||||
<TextBlock Text="Hello" />
|
||||
<u:BreadcrumbItem Icon="?" Separator="♥" />
|
||||
<TextBlock Text="Avalonia" />
|
||||
<TextBlock Text="Ursa" />
|
||||
</u:Breadcrumb>
|
||||
<u:Breadcrumb
|
||||
DisplayMemberBinding="{Binding Section}"
|
||||
IconBinding="{Binding Icon}"
|
||||
CommandBinding="{Binding Command}"
|
||||
ItemsSource="{Binding Items1}">
|
||||
<u:Breadcrumb.Styles>
|
||||
<Style Selector="u|BreadcrumbItem" x:DataType="vm:BreadcrumbDemoItem">
|
||||
<Setter Property="IsReadOnly" Value="{Binding IsReadOnly}"/>
|
||||
</Style>
|
||||
</u:Breadcrumb.Styles>
|
||||
<u:Breadcrumb.IconTemplate>
|
||||
<DataTemplate DataType="x:String">
|
||||
<PathIcon Width="12" Height="12" Data="{Binding Path=., Converter={StaticResource IconConverter}}"></PathIcon>
|
||||
</DataTemplate>
|
||||
</u:Breadcrumb.IconTemplate>
|
||||
</u:Breadcrumb>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Pages/BreadcrumbDemo.axaml.cs
Normal file
13
demo/Ursa.Demo/Pages/BreadcrumbDemo.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class BreadcrumbDemo : UserControl
|
||||
{
|
||||
public BreadcrumbDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -13,10 +13,23 @@
|
||||
mc:Ignorable="d">
|
||||
|
||||
<StackPanel Margin="20" Spacing="20">
|
||||
<u:ButtonGroup Classes="Primary Solid" ItemsSource="{Binding Items}" />
|
||||
<u:ButtonGroup Classes="Primary" ItemsSource="{Binding Items}" />
|
||||
<u:ButtonGroup Classes="Primary Borderless" ItemsSource="{Binding Items}" />
|
||||
<u:ButtonGroup Classes="Primary Large" ItemsSource="{Binding Items}" />
|
||||
<u:ButtonGroup Classes="Primary Small" ItemsSource="{Binding Items}" />
|
||||
<u:ButtonGroup Classes="Primary Solid"
|
||||
CommandBinding="{Binding InvokeCommand}"
|
||||
ItemsSource="{Binding Items}" >
|
||||
<u:ButtonGroup.ItemTemplate>
|
||||
<DataTemplate x:DataType="vm:ButtonItem">
|
||||
<TextBlock>
|
||||
<Run Text="🐼"></Run>
|
||||
<Run Text="{Binding Name}"></Run>
|
||||
</TextBlock>
|
||||
</DataTemplate>
|
||||
</u:ButtonGroup.ItemTemplate>
|
||||
</u:ButtonGroup>
|
||||
|
||||
<u:ButtonGroup Classes="Primary"
|
||||
ContentBinding="{Binding Name}"
|
||||
CommandBinding="{Binding InvokeCommand}"
|
||||
ItemsSource="{Binding Items}" >
|
||||
</u:ButtonGroup>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
||||
16
demo/Ursa.Demo/Pages/ClassInputDemo.axaml
Normal file
16
demo/Ursa.Demo/Pages/ClassInputDemo.axaml
Normal file
@@ -0,0 +1,16 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Ursa.Demo.Pages.ClassInputDemo">
|
||||
<StackPanel HorizontalAlignment="Left" Spacing="20">
|
||||
<u:ControlClassesInput Name="input" Separator=" " />
|
||||
<Button u:ControlClassesInput.Source="{Binding #input}" Content="Hello Panda" />
|
||||
<Button u:ControlClassesInput.Source="{Binding #input}" Content="Hello Panda" />
|
||||
<Button u:ControlClassesInput.Source="{Binding #input}" Content="Hello Panda" />
|
||||
<TextBox u:ControlClassesInput.Source="{Binding #input}" Width="100" Text="100"></TextBox>
|
||||
<ProgressBar u:ControlClassesInput.Source="{Binding #input}" Width="200" Value="20" ShowProgressText="True"></ProgressBar>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Pages/ClassInputDemo.axaml.cs
Normal file
13
demo/Ursa.Demo/Pages/ClassInputDemo.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class ClassInputDemo : UserControl
|
||||
{
|
||||
public ClassInputDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
18
demo/Ursa.Demo/Pages/ClockDemo.axaml
Normal file
18
demo/Ursa.Demo/Pages/ClockDemo.axaml
Normal file
@@ -0,0 +1,18 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.ClockDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="clr-namespace:Ursa.Demo.ViewModels"
|
||||
x:DataType="vm:ClockDemoViewModel"
|
||||
x:CompileBindings="True"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<u:Clock HorizontalAlignment="Left" Time="{Binding Time}"></u:Clock>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Pages/ClockDemo.axaml.cs
Normal file
13
demo/Ursa.Demo/Pages/ClockDemo.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class ClockDemo : UserControl
|
||||
{
|
||||
public ClockDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
127
demo/Ursa.Demo/Pages/DialogDemo.axaml
Normal file
127
demo/Ursa.Demo/Pages/DialogDemo.axaml
Normal file
@@ -0,0 +1,127 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.DialogDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="using:Ursa.Demo.ViewModels"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="vm:DialogDemoViewModel"
|
||||
mc:Ignorable="d">
|
||||
<Grid ColumnDefinitions="Auto, *">
|
||||
<TabControl Grid.Column="0" Width="300">
|
||||
<TabItem Header="Default">
|
||||
<StackPanel>
|
||||
<ToggleSwitch
|
||||
Name="overlay"
|
||||
Content="Window/Overlay"
|
||||
IsChecked="{Binding IsWindow}"
|
||||
OffContent="Overlay"
|
||||
OnContent="Window" />
|
||||
<ToggleSwitch
|
||||
Content="Global/Local"
|
||||
IsChecked="{Binding IsGlobal}"
|
||||
IsVisible="{Binding !#overlay.IsChecked}"
|
||||
OffContent="Local"
|
||||
OnContent="Global" />
|
||||
<ToggleSwitch
|
||||
Name="defaultModal"
|
||||
Content="Modal/Regular"
|
||||
IsChecked="{Binding IsModal}"
|
||||
IsVisible="{Binding !#overlay.IsChecked}"
|
||||
OffContent="Regular"
|
||||
OnContent="Modal" />
|
||||
<ToggleSwitch
|
||||
Content="ClickOnMaskToClose"
|
||||
IsChecked="{Binding CanLightDismiss}"
|
||||
OffContent="No"
|
||||
OnContent="Yes" />
|
||||
<ToggleSwitch
|
||||
Content="FullScreen"
|
||||
IsChecked="{Binding FullScreen}"
|
||||
OffContent="No"
|
||||
OnContent="Yes" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="Buttons" />
|
||||
<u:EnumSelector EnumType="{x:Type u:DialogButton}" Value="{Binding SelectedButton}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="Mode" />
|
||||
<u:EnumSelector EnumType="{x:Type u:DialogMode}" Value="{Binding SelectedMode}" />
|
||||
</StackPanel>
|
||||
<Button Command="{Binding ShowDialogCommand}" Content="Show Dialog" />
|
||||
<TextBlock>
|
||||
<Run Text="Default Result: " />
|
||||
<Run Text="{Binding DefaultResult, FallbackValue=''}" />
|
||||
</TextBlock>
|
||||
<TextBlock>
|
||||
<Run Text="Dialog Date: " />
|
||||
<Run Text="{Binding Date, FallbackValue=''}" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
<TabItem Header="Custom">
|
||||
<StackPanel>
|
||||
<ToggleSwitch
|
||||
Name="overlay2"
|
||||
Content="Window/Overlay"
|
||||
IsChecked="{Binding IsWindow}"
|
||||
OffContent="Overlay"
|
||||
OnContent="Window" />
|
||||
<ToggleSwitch
|
||||
Content="Global/Local"
|
||||
IsChecked="{Binding IsGlobal}"
|
||||
IsVisible="{Binding !#overlay2.IsChecked}"
|
||||
OffContent="Local"
|
||||
OnContent="Global" />
|
||||
<ToggleSwitch
|
||||
Name="modal"
|
||||
Content="Modal/Regular"
|
||||
IsChecked="{Binding IsModal}"
|
||||
OffContent="Regular"
|
||||
OnContent="Modal" />
|
||||
<ToggleSwitch
|
||||
Content="ClickOnMaskToClose"
|
||||
IsChecked="{Binding CanLightDismiss}"
|
||||
OffContent="No"
|
||||
OnContent="Yes" />
|
||||
<ToggleSwitch
|
||||
Content="FullScreen"
|
||||
IsChecked="{Binding FullScreen}"
|
||||
OffContent="No"
|
||||
OnContent="Yes" />
|
||||
<Button Command="{Binding ShowCustomDialogCommand}" Content="Show Dialog" />
|
||||
<TextBlock>
|
||||
<Run Text="Custom Result: " />
|
||||
<Run Text="{Binding Result}" />
|
||||
</TextBlock>
|
||||
<TextBlock>
|
||||
<Run Text="Dialog Date: " />
|
||||
<Run Text="{Binding Date}" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<Grid Grid.Column="1">
|
||||
<Border
|
||||
BorderBrush="{DynamicResource SemiGrey1}"
|
||||
BorderThickness="1"
|
||||
ClipToBounds="True"
|
||||
CornerRadius="20">
|
||||
<u:OverlayDialogHost HostId="LocalHost">
|
||||
<u:OverlayDialogHost.DialogDataTemplates>
|
||||
<DataTemplate DataType="x:String">
|
||||
<TextBlock
|
||||
Margin="24,24,48,24"
|
||||
Foreground="Red"
|
||||
Text="{Binding Path=.}" />
|
||||
</DataTemplate>
|
||||
</u:OverlayDialogHost.DialogDataTemplates>
|
||||
</u:OverlayDialogHost>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Pages/DialogDemo.axaml.cs
Normal file
13
demo/Ursa.Demo/Pages/DialogDemo.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class DialogDemo : UserControl
|
||||
{
|
||||
public DialogDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
29
demo/Ursa.Demo/Pages/DisableContainerDemo.axaml
Normal file
29
demo/Ursa.Demo/Pages/DisableContainerDemo.axaml
Normal file
@@ -0,0 +1,29 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.DisableContainerDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<StackPanel HorizontalAlignment="Left" Spacing="20">
|
||||
<ToggleSwitch Name="s" IsChecked="True" />
|
||||
<u:DisableContainer DisabledTip="This is disabled. ">
|
||||
<Button IsEnabled="{Binding #s.IsChecked}">Hello World!</Button>
|
||||
</u:DisableContainer>
|
||||
<u:DisableContainer DisabledTip="This is disabled. ">
|
||||
<Calendar IsEnabled="{Binding #s.IsChecked}" />
|
||||
</u:DisableContainer>
|
||||
<u:DisableContainer>
|
||||
<Button IsEnabled="{Binding #s.IsChecked}">Hello Avalonia</Button>
|
||||
</u:DisableContainer>
|
||||
<Button
|
||||
u:DisabledAdorner.DisabledTip="Fine"
|
||||
u:DisabledAdorner.IsEnabled="True"
|
||||
IsEnabled="{Binding #s.IsChecked}">
|
||||
Hello Avalonia
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Pages/DisableContainerDemo.axaml.cs
Normal file
13
demo/Ursa.Demo/Pages/DisableContainerDemo.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class DisableContainerDemo : UserControl
|
||||
{
|
||||
public DisableContainerDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
99
demo/Ursa.Demo/Pages/DrawerDemo.axaml
Normal file
99
demo/Ursa.Demo/Pages/DrawerDemo.axaml
Normal file
@@ -0,0 +1,99 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.DrawerDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:common="clr-namespace:Ursa.Common;assembly=Ursa"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="clr-namespace:Ursa.Demo.ViewModels;assembly=Ursa.Demo"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="vm:DrawerDemoViewModel"
|
||||
mc:Ignorable="d">
|
||||
<Grid ColumnDefinitions="Auto, *">
|
||||
<TabControl Grid.Column="0" Width="300">
|
||||
<TabItem Header="Default">
|
||||
<StackPanel>
|
||||
<u:EnumSelector EnumType="common:Position" Value="{Binding SelectedPosition}" />
|
||||
<ToggleSwitch
|
||||
Content="Global/Local"
|
||||
IsChecked="{Binding IsGlobal}"
|
||||
OffContent="Local"
|
||||
OnContent="Global" />
|
||||
<ToggleSwitch
|
||||
Content="Modal"
|
||||
IsChecked="{Binding IsModal}"
|
||||
OffContent="No"
|
||||
OnContent="Yes" />
|
||||
<ToggleSwitch
|
||||
Content="CanLightDismiss"
|
||||
IsChecked="{Binding CanLightDismiss}"
|
||||
OffContent="No"
|
||||
OnContent="Yes" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Buttons" />
|
||||
<u:EnumSelector EnumType="{x:Type u:DialogButton}" Value="{Binding SelectedButton}" />
|
||||
</StackPanel>
|
||||
<Button Command="{Binding ShowDialogCommand}" Content="Show Default Drawer" />
|
||||
<TextBlock>
|
||||
<Run Text="Default Result: " />
|
||||
<Run Text="{Binding DefaultResult}" />
|
||||
</TextBlock>
|
||||
<TextBlock>
|
||||
<Run Text="Dialog Date: " />
|
||||
<Run Text="{Binding Date}" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
<TabItem Header="Custom">
|
||||
<StackPanel>
|
||||
<u:EnumSelector EnumType="common:Position" Value="{Binding SelectedPosition}" />
|
||||
<ToggleSwitch
|
||||
Content="Global/Local"
|
||||
IsChecked="{Binding IsGlobal}"
|
||||
OffContent="Local"
|
||||
OnContent="Global" />
|
||||
<ToggleSwitch
|
||||
Content="CanLightDismiss"
|
||||
IsChecked="{Binding CanLightDismiss}"
|
||||
OffContent="No"
|
||||
OnContent="Yes" />
|
||||
<ToggleSwitch
|
||||
Content="Modal"
|
||||
IsChecked="{Binding IsModal}"
|
||||
OffContent="No"
|
||||
OnContent="Yes" />
|
||||
<Button Command="{Binding ShowCustomDialogCommand}" Content="Show Custom Drawer" />
|
||||
<TextBlock>
|
||||
<Run Text="Custom Result: " />
|
||||
<Run Text="{Binding Result}" />
|
||||
</TextBlock>
|
||||
<TextBlock>
|
||||
<Run Text="Dialog Date: " />
|
||||
<Run Text="{Binding Date}" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<Grid Grid.Column="1" ClipToBounds="True">
|
||||
<Border
|
||||
BorderBrush="{DynamicResource SemiGrey1}"
|
||||
BorderThickness="1"
|
||||
ClipToBounds="True"
|
||||
CornerRadius="20">
|
||||
<u:OverlayDialogHost HostId="LocalHost">
|
||||
<u:OverlayDialogHost.DialogDataTemplates>
|
||||
<DataTemplate DataType="x:String">
|
||||
<TextBlock
|
||||
Margin="24,24,48,24"
|
||||
Foreground="Red"
|
||||
Text="{Binding Path=.}" />
|
||||
</DataTemplate>
|
||||
</u:OverlayDialogHost.DialogDataTemplates>
|
||||
</u:OverlayDialogHost>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Pages/DrawerDemo.axaml.cs
Normal file
13
demo/Ursa.Demo/Pages/DrawerDemo.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class DrawerDemo : UserControl
|
||||
{
|
||||
public DrawerDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@
|
||||
mc:Ignorable="d">
|
||||
|
||||
<UserControl.Resources>
|
||||
<PathGeometry x:Key="InfoPath">M12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23ZM14 7C14 8.10457 13.1046 9 12 9C10.8954 9 10 8.10457 10 7C10 5.89543 10.8954 5 12 5C13.1046 5 14 5.89543 14 7ZM9 10.75C9 10.3358 9.33579 10 9.75 10H12.5C13.0523 10 13.5 10.4477 13.5 11V16.5H14.25C14.6642 16.5 15 16.8358 15 17.25C15 17.6642 14.6642 18 14.25 18H9.75C9.33579 18 9 17.6642 9 17.25C9 16.8358 9.33579 16.5 9.75 16.5H10.5V11.5H9.75C9.33579 11.5 9 11.1642 9 10.75Z</PathGeometry>
|
||||
<StreamGeometry x:Key="InfoPath">M12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23ZM14 7C14 8.10457 13.1046 9 12 9C10.8954 9 10 8.10457 10 7C10 5.89543 10.8954 5 12 5C13.1046 5 14 5.89543 14 7ZM9 10.75C9 10.3358 9.33579 10 9.75 10H12.5C13.0523 10 13.5 10.4477 13.5 11V16.5H14.25C14.6642 16.5 15 16.8358 15 17.25C15 17.6642 14.6642 18 14.25 18H9.75C9.33579 18 9 17.6642 9 17.25C9 16.8358 9.33579 16.5 9.75 16.5H10.5V11.5H9.75C9.33579 11.5 9 11.1642 9 10.75Z</StreamGeometry>
|
||||
</UserControl.Resources>
|
||||
|
||||
<UserControl.Styles>
|
||||
|
||||
30
demo/Ursa.Demo/Pages/EnumSelectorDemo.axaml
Normal file
30
demo/Ursa.Demo/Pages/EnumSelectorDemo.axaml
Normal file
@@ -0,0 +1,30 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.EnumSelectorDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="clr-namespace:Ursa.Demo.ViewModels;assembly=Ursa.Demo"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="vm:EnumSelectorDemoViewModel"
|
||||
mc:Ignorable="d">
|
||||
<StackPanel>
|
||||
<ToggleSwitch Name="description" Content="Show Description" />
|
||||
<TextBlock Text="Select Type" />
|
||||
<ComboBox
|
||||
Width="200"
|
||||
DisplayMemberBinding="{Binding Name}"
|
||||
ItemsSource="{Binding Types}"
|
||||
SelectedItem="{Binding SelectedType}" />
|
||||
<TextBlock Text="Select Value" />
|
||||
<u:EnumSelector
|
||||
Width="200"
|
||||
DisplayDescription="{Binding #description.IsChecked}"
|
||||
EnumType="{Binding SelectedType}"
|
||||
Value="{Binding Value}" />
|
||||
<TextBlock Text="{Binding Value}" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Pages/EnumSelectorDemo.axaml.cs
Normal file
13
demo/Ursa.Demo/Pages/EnumSelectorDemo.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class EnumSelectorDemo : UserControl
|
||||
{
|
||||
public EnumSelectorDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
71
demo/Ursa.Demo/Pages/FormDemo.axaml
Normal file
71
demo/Ursa.Demo/Pages/FormDemo.axaml
Normal file
@@ -0,0 +1,71 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.FormDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:common="clr-namespace:Ursa.Common;assembly=Ursa"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="clr-namespace:Ursa.Demo.ViewModels;assembly=Ursa.Demo"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="vm:FormDemoViewModel"
|
||||
mc:Ignorable="d">
|
||||
<ScrollViewer>
|
||||
<StackPanel>
|
||||
<Grid RowDefinitions="Auto, Auto" ColumnDefinitions="Auto, Auto">
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="Label Position" VerticalAlignment="Center"></TextBlock>
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="Label Alignment" VerticalAlignment="Center"></TextBlock>
|
||||
<u:EnumSelector Grid.Row="0" Grid.Column="1"
|
||||
Name="position"
|
||||
EnumType="common:Position"
|
||||
Value="{x:Static common:Position.Top}" />
|
||||
<u:EnumSelector Grid.Row="1" Grid.Column="1"
|
||||
Name="alignment"
|
||||
EnumType="HorizontalAlignment"
|
||||
Value="{x:Static HorizontalAlignment.Left}" />
|
||||
</Grid>
|
||||
<u:Form
|
||||
DataContext="{Binding Model}"
|
||||
LabelAlignment="{Binding #alignment.Value}"
|
||||
LabelPosition="{Binding #position.Value}"
|
||||
LabelWidth="*">
|
||||
<u:FormGroup Header="Information">
|
||||
<TextBox
|
||||
Width="300"
|
||||
u:FormItem.IsRequired="True"
|
||||
u:FormItem.Label="Name"
|
||||
Text="{Binding Name}" />
|
||||
<TextBox
|
||||
Width="300"
|
||||
u:FormItem.Label="Email"
|
||||
Text="{Binding Email}" />
|
||||
</u:FormGroup>
|
||||
<u:FormItem Label="Please select a Date">
|
||||
<CalendarDatePicker SelectedDate="{Binding Date}" />
|
||||
</u:FormItem>
|
||||
|
||||
<u:FormGroup Header="Education">
|
||||
<TextBox
|
||||
HorizontalAlignment="Stretch"
|
||||
u:FormItem.IsRequired="True"
|
||||
u:FormItem.Label="Name"
|
||||
Text="{Binding Name}" />
|
||||
<TextBox
|
||||
HorizontalAlignment="Stretch"
|
||||
u:FormItem.Label="Email"
|
||||
u:FormItem.IsRequired="True"
|
||||
Text="{Binding Email}" />
|
||||
</u:FormGroup>
|
||||
<u:FormItem Label="Click to Submit">
|
||||
<Button Content="Button With Label" />
|
||||
</u:FormItem>
|
||||
<CheckBox Content="I Agree User Agreement" u:FormItem.NoLabel="True"></CheckBox>
|
||||
<u:FormItem NoLabel="True">
|
||||
<Button HorizontalAlignment="Left" Content="No Label" />
|
||||
</u:FormItem>
|
||||
</u:Form>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Pages/FormDemo.axaml.cs
Normal file
13
demo/Ursa.Demo/Pages/FormDemo.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class FormDemo : UserControl
|
||||
{
|
||||
public FormDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -4,14 +4,13 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:pages="clr-namespace:Ursa.Demo.Pages"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="clr-namespace:Ursa.Demo.ViewModels;assembly=Ursa.Demo"
|
||||
x:DataType="vm:IPv4BoxDemoViewModel"
|
||||
x:CompileBindings="True"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<Design.DataContext>
|
||||
<pages:IPv4DemoViewMode />
|
||||
</Design.DataContext>
|
||||
<StackPanel HorizontalAlignment="Left">
|
||||
<ToggleButton
|
||||
Name="format"
|
||||
@@ -38,6 +37,6 @@
|
||||
IPAddress="{Binding Address}"
|
||||
ShowLeadingZero="{Binding #format.IsChecked}" />
|
||||
<TextBlock Classes="" Text="Disabled" />
|
||||
<u:IPv4Box Width="200" IsEnabled="False" />
|
||||
<u:IPv4Box Width="200" IsEnabled="False" IPAddress="{Binding Address}" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
||||
@@ -12,18 +12,5 @@ public partial class IPv4BoxDemo : UserControl
|
||||
public IPv4BoxDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = new IPv4DemoViewMode();
|
||||
}
|
||||
}
|
||||
|
||||
public partial class IPv4DemoViewMode: ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private IPAddress? _address;
|
||||
|
||||
public void ChangeAddress()
|
||||
{
|
||||
long l = Random.Shared.NextInt64(0x00000000FFFFFFFF);
|
||||
Address = new IPAddress(l);
|
||||
}
|
||||
}
|
||||
108
demo/Ursa.Demo/Pages/IconButtonDemo.axaml
Normal file
108
demo/Ursa.Demo/Pages/IconButtonDemo.axaml
Normal file
@@ -0,0 +1,108 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.IconButtonDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:common="clr-namespace:Ursa.Common;assembly=Ursa"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<StreamGeometry x:Key="iconGlyph">M12.0101 1C5.92171 1 1 5.92171 1 12.0101C1 16.8771 4.15354 20.9967 8.5284 22.455C9.07526 22.5644 9.27577 22.218 9.27577 21.9264C9.27577 21.6712 9.25754 20.7962 9.25754 19.8848C6.19514 20.541 5.55714 18.5723 5.55714 18.5723C5.06497 17.2963 4.33583 16.9682 4.33583 16.9682C3.33326 16.2938 4.40874 16.2938 4.40874 16.2938C5.52069 16.3667 6.104 17.4239 6.104 17.4239C7.08834 19.101 8.67423 18.627 9.31223 18.3354C9.40337 17.6245 9.69503 17.1323 10.0049 16.8589C7.56229 16.6037 4.99206 15.6558 4.99206 11.4267C4.99206 10.2237 5.42954 9.23931 6.12223 8.47371C6.01286 8.20028 5.63006 7.07011 6.2316 5.55714C6.2316 5.55714 7.16126 5.26548 9.25754 6.68731C10.1325 6.45034 11.0804 6.32274 12.0101 6.32274C12.9397 6.32274 13.8876 6.45034 14.7626 6.68731C16.8589 5.26548 17.7885 5.55714 17.7885 5.55714C18.3901 7.07011 18.0073 8.20028 17.8979 8.47371C18.6088 9.23931 19.0281 10.2237 19.0281 11.4267C19.0281 15.6558 16.4578 16.5854 13.997 16.8589C14.398 17.2052 14.7443 17.8614 14.7443 18.9004C14.7443 20.377 14.7261 21.5618 14.7261 21.9264C14.7261 22.218 14.9266 22.5644 15.4735 22.455C19.8483 20.9967 23.0019 16.8771 23.0019 12.0101C23.0201 5.92171 18.0802 1 12.0101 1Z</StreamGeometry>
|
||||
</UserControl.Resources>
|
||||
<StackPanel HorizontalAlignment="Left" Spacing="16">
|
||||
<ToggleSwitch Name="loading" Content="Toggle Loading" />
|
||||
<u:EnumSelector Name="placement" EnumType="{x:Type common:Position}" />
|
||||
<u:IconButton
|
||||
Content="Hello World"
|
||||
IconPlacement="{Binding #placement.Value}"
|
||||
IsLoading="{Binding #loading.IsChecked}" />
|
||||
<u:IconButton
|
||||
Content="Hello Panda"
|
||||
IconPlacement="{Binding #placement.Value}"
|
||||
IsLoading="{Binding #loading.IsChecked}">
|
||||
<u:IconButton.Icon>
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
FontSize="40"
|
||||
Text="🐼" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
<u:IconButton
|
||||
Content="GitHub"
|
||||
IconPlacement="{Binding #placement.Value}"
|
||||
IsLoading="{Binding #loading.IsChecked}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="14"
|
||||
Height="14"
|
||||
Data="{StaticResource iconGlyph}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
<u:IconButton
|
||||
Width="150"
|
||||
Content="GitHub"
|
||||
IconPlacement="{Binding #placement.Value}"
|
||||
IsLoading="{Binding #loading.IsChecked}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="14"
|
||||
Height="14"
|
||||
Data="{StaticResource iconGlyph}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
<u:IconButton
|
||||
Width="150"
|
||||
Classes="Warning"
|
||||
Content="GitHub"
|
||||
IconPlacement="{Binding #placement.Value}"
|
||||
IsLoading="{Binding #loading.IsChecked}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="14"
|
||||
Height="14"
|
||||
Data="{StaticResource iconGlyph}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
<u:IconButton
|
||||
Width="150"
|
||||
Content="GitHub"
|
||||
IconPlacement="{Binding #placement.Value}"
|
||||
IsLoading="{Binding #loading.IsChecked}"
|
||||
Theme="{DynamicResource SolidIconButton}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="14"
|
||||
Height="14"
|
||||
Data="{StaticResource iconGlyph}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
<u:IconButton
|
||||
Width="150"
|
||||
Classes="Warning"
|
||||
Content="GitHub"
|
||||
IconPlacement="{Binding #placement.Value}"
|
||||
IsLoading="{Binding #loading.IsChecked}"
|
||||
Theme="{DynamicResource SolidIconButton}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="14"
|
||||
Height="14"
|
||||
Data="{StaticResource iconGlyph}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
<u:IconButton
|
||||
Classes="Danger"
|
||||
IsLoading="{Binding #loading.IsChecked}"
|
||||
Theme="{DynamicResource SolidIconButton}">
|
||||
<u:IconButton.Icon>
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
FontSize="40"
|
||||
Text="🐼" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Pages/IconButtonDemo.axaml.cs
Normal file
13
demo/Ursa.Demo/Pages/IconButtonDemo.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class IconButtonDemo : UserControl
|
||||
{
|
||||
public IconButtonDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
122
demo/Ursa.Demo/Pages/ImageViewerDemo.axaml
Normal file
122
demo/Ursa.Demo/Pages/ImageViewerDemo.axaml
Normal file
@@ -0,0 +1,122 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.ImageViewerDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<SolidColorBrush x:Key="MaskBackground" Opacity="0.2" Color="Red" />
|
||||
<SolidColorBrush x:Key="MaskBorder" Color="Red" />
|
||||
</UserControl.Resources>
|
||||
<StackPanel>
|
||||
<u:Banner
|
||||
Content="Setting the Scale before loading has no effect."
|
||||
Header="Notice"
|
||||
Type="Warning" />
|
||||
<u:ImageViewer
|
||||
Name="viewer"
|
||||
Width="600"
|
||||
Height="300"
|
||||
MinScale="0.5"
|
||||
Source="../Assets/3x.png">
|
||||
<u:ImageViewer.Overlayer>
|
||||
<Grid
|
||||
HorizontalAlignment="Stretch"
|
||||
ColumnDefinitions="*, Auto, *"
|
||||
IsVisible="{Binding #maskSwitch.IsChecked}">
|
||||
<Border
|
||||
Grid.Column="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{StaticResource MaskBackground}"
|
||||
BorderBrush="{StaticResource MaskBorder}"
|
||||
BorderThickness="0,0,1,0"
|
||||
IsHitTestVisible="False" />
|
||||
<Rectangle
|
||||
Grid.Column="1"
|
||||
Width="150"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Fill="Transparent"
|
||||
IsHitTestVisible="False" />
|
||||
<Border
|
||||
Grid.Column="2"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{StaticResource MaskBackground}"
|
||||
BorderBrush="{StaticResource MaskBorder}"
|
||||
BorderThickness="1,0,0,0"
|
||||
IsHitTestVisible="False" />
|
||||
</Grid>
|
||||
</u:ImageViewer.Overlayer>
|
||||
</u:ImageViewer>
|
||||
|
||||
<Grid ColumnDefinitions="Auto, Auto, *" RowDefinitions="Auto, Auto, Auto, Auto">
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Text="Scale" />
|
||||
<Slider
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Width="200"
|
||||
Maximum="10"
|
||||
Minimum="0.1"
|
||||
Value="{Binding #viewer.Scale}" />
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
Text="{Binding #viewer.Scale, StringFormat=\{0:0.00000\}}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Text="TranslateX" />
|
||||
<Slider
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Width="200"
|
||||
IsSnapToTickEnabled="True"
|
||||
Maximum="300"
|
||||
Minimum="-300"
|
||||
TickFrequency="0.1"
|
||||
Value="{Binding #viewer.TranslateX}" />
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Text="{Binding #viewer.TranslateX, StringFormat=\{0:0.0\}}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Text="TranslateY" />
|
||||
<Slider
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Width="200"
|
||||
IsSnapToTickEnabled="True"
|
||||
Maximum="300"
|
||||
Minimum="-300"
|
||||
TickFrequency="0.1"
|
||||
Value="{Binding #viewer.TranslateY}" />
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
Grid.Column="2"
|
||||
Text="{Binding #viewer.TranslateY, StringFormat=\{0:0.0\}}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="3"
|
||||
Grid.Column="0"
|
||||
Text="Show Mask" />
|
||||
<ToggleSwitch
|
||||
Name="maskSwitch"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Theme="{DynamicResource SimpleToggleSwitch}" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
14
demo/Ursa.Demo/Pages/ImageViewerDemo.axaml.cs
Normal file
14
demo/Ursa.Demo/Pages/ImageViewerDemo.axaml.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class ImageViewerDemo : UserControl
|
||||
{
|
||||
public ImageViewerDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
262
demo/Ursa.Demo/Pages/IntroductionDemo.axaml
Normal file
262
demo/Ursa.Demo/Pages/IntroductionDemo.axaml
Normal file
@@ -0,0 +1,262 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.IntroductionDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="clr-namespace:Ursa.Demo.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="using:Ursa.Demo.ViewModels"
|
||||
d:DesignHeight="800"
|
||||
d:DesignWidth="1600"
|
||||
mc:Ignorable="d">
|
||||
<Design.DataContext>
|
||||
<vm:IntroductionDemoViewModel />
|
||||
</Design.DataContext>
|
||||
<UserControl.Resources>
|
||||
<StreamGeometry x:Key="InfoPath">M12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23ZM14 7C14 8.10457 13.1046 9 12 9C10.8954 9 10 8.10457 10 7C10 5.89543 10.8954 5 12 5C13.1046 5 14 5.89543 14 7ZM9 10.75C9 10.3358 9.33579 10 9.75 10H12.5C13.0523 10 13.5 10.4477 13.5 11V16.5H14.25C14.6642 16.5 15 16.8358 15 17.25C15 17.6642 14.6642 18 14.25 18H9.75C9.33579 18 9 17.6642 9 17.25C9 16.8358 9.33579 16.5 9.75 16.5H10.5V11.5H9.75C9.33579 11.5 9 11.1642 9 10.75Z</StreamGeometry>
|
||||
<SolidColorBrush x:Key="MaskBackground" Opacity="0.2" Color="{DynamicResource SemiBlue3Color}" />
|
||||
<SolidColorBrush x:Key="MaskBorderBrush" Color="{DynamicResource SemiBlue5Color}" />
|
||||
</UserControl.Resources>
|
||||
<UserControl.Styles>
|
||||
<Style Selector="u|Badge">
|
||||
<Setter Property="Margin" Value="10" />
|
||||
<Style Selector="^ > Border">
|
||||
<Setter Property="Theme" Value="{DynamicResource CardBorder}" />
|
||||
<Setter Property="Width" Value="100" />
|
||||
<Setter Property="Height" Value="60" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="u|DualBadge">
|
||||
<Setter Property="Margin" Value="4" />
|
||||
</Style>
|
||||
</UserControl.Styles>
|
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="20">
|
||||
<Grid RowDefinitions="Auto, *" ColumnDefinitions="Auto, Auto, Auto">
|
||||
<u:Banner
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
Grid.Row="0"
|
||||
Classes="Bordered"
|
||||
Content="Aesthetic revolution of productivity. "
|
||||
Header="Welcome to IRIHI Technology!"
|
||||
Type="Information" />
|
||||
<StackPanel Grid.Column="1" Grid.Row="1" Spacing="20" Margin="8">
|
||||
<u:ImageViewer
|
||||
Name="viewer"
|
||||
Width="600"
|
||||
Height="300"
|
||||
Scale="0.2"
|
||||
Background="{DynamicResource SemiGrey1Color}"
|
||||
Source="../Assets/IRIHI.png">
|
||||
<u:ImageViewer.Overlayer>
|
||||
<Grid
|
||||
HorizontalAlignment="Stretch"
|
||||
ColumnDefinitions="*, Auto, *"
|
||||
IsVisible="{Binding #maskSwitch.IsChecked}">
|
||||
<Border
|
||||
Grid.Column="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{DynamicResource MaskBackground}"
|
||||
BorderBrush="{DynamicResource MaskBorderBrush}"
|
||||
BorderThickness="0,0,1,0"
|
||||
IsHitTestVisible="False" />
|
||||
<Rectangle
|
||||
Grid.Column="1"
|
||||
Width="150"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Fill="Transparent"
|
||||
IsHitTestVisible="False" />
|
||||
<Border
|
||||
Grid.Column="2"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{DynamicResource MaskBackground}"
|
||||
BorderBrush="{DynamicResource MaskBorderBrush}"
|
||||
BorderThickness="1,0,0,0"
|
||||
IsHitTestVisible="False" />
|
||||
</Grid>
|
||||
</u:ImageViewer.Overlayer>
|
||||
</u:ImageViewer>
|
||||
<u:Divider>
|
||||
<ToggleSwitch
|
||||
Name="maskSwitch"
|
||||
IsChecked="True"
|
||||
OnContent="Show Mask"
|
||||
OffContent="Show Mask" />
|
||||
</u:Divider>
|
||||
<Grid ColumnDefinitions="*,Auto,*">
|
||||
<StackPanel Grid.Column="0" Spacing="20">
|
||||
<u:IPv4Box HorizontalAlignment="Stretch" />
|
||||
<u:IPv4Box HorizontalAlignment="Stretch" InputMode="Fast" />
|
||||
<RepeatButton Command="{Binding ChangeAddress}" Content="Random" />
|
||||
<u:IPv4Box HorizontalAlignment="Stretch"
|
||||
ShowLeadingZero="True"
|
||||
IPAddress="{Binding Address}" />
|
||||
<u:IPv4Box HorizontalAlignment="Stretch" IsEnabled="False" />
|
||||
</StackPanel>
|
||||
<u:Timeline Grid.Column="1" HorizontalAlignment="Left" Mode="Alternate">
|
||||
<u:TimelineItem
|
||||
Content="Step 1"
|
||||
Header="ToDo"
|
||||
Type="Default"
|
||||
Time="2023-01-14 09:24:05"/>
|
||||
<u:TimelineItem
|
||||
Content="Step 2"
|
||||
Header="Start"
|
||||
Position="Right"
|
||||
Type="Ongoing"
|
||||
Time="2024-01-04 22:32:58"/>
|
||||
<u:TimelineItem
|
||||
Content="Step 3"
|
||||
Header="In Between"
|
||||
Type="Warning"
|
||||
Time="2024-01-05 00:08:29"/>
|
||||
<u:TimelineItem
|
||||
Content="Step 4"
|
||||
Header="Finished"
|
||||
Position="Right"
|
||||
Type="Success"
|
||||
Time="2024-01-05 00:27:44"/>
|
||||
</u:Timeline>
|
||||
<StackPanel Grid.Column="2" Spacing="20">
|
||||
<u:ButtonGroup Classes="Primary Solid" ItemsSource="{Binding ButtonGroupItems}" />
|
||||
<u:ButtonGroup Classes="Primary" ItemsSource="{Binding ButtonGroupItems}" />
|
||||
<u:ButtonGroup Classes="Primary Borderless" ItemsSource="{Binding ButtonGroupItems}" />
|
||||
<u:ButtonGroup Classes="Primary Large" ItemsSource="{Binding ButtonGroupItems}" />
|
||||
<u:ButtonGroup Classes="Primary Small" ItemsSource="{Binding ButtonGroupItems}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Column="2" Grid.Row="1" Spacing="20" Margin="8">
|
||||
<u:Divider HorizontalContentAlignment="Right">Badge</u:Divider>
|
||||
<WrapPanel Orientation="Horizontal">
|
||||
<u:Badge Header="Ursa" CornerPosition="TopRight">
|
||||
<Border Classes="Hover">
|
||||
<TextBlock Text="Pyro"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
HorizontalAlignment="Center"
|
||||
CornerPosition="TopRight"
|
||||
Header="500"
|
||||
OverflowCount="99">
|
||||
<Border Classes="Hover">
|
||||
<TextBlock Text="Hydro"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge
|
||||
Header="Ursa"
|
||||
CornerPosition="TopRight"
|
||||
Dot="True">
|
||||
<Border Classes="Hover">
|
||||
<TextBlock Text="Ameno"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
|
||||
<u:Badge Header="Ursa" />
|
||||
<u:Badge Header="Ursa" Dot="True" />
|
||||
</WrapPanel>
|
||||
<WrapPanel Orientation="Horizontal">
|
||||
<u:Badge Header="Ursa" Classes="Secondary">
|
||||
<Border Classes="Hover">
|
||||
<TextBlock Text="Electro"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge Header="Ursa" Classes="Tertiary" CornerPosition="BottomLeft">
|
||||
<Border Classes="Hover">
|
||||
<TextBlock Text="Dendro"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge Header="Ursa" Classes="Warning" CornerPosition="BottomRight">
|
||||
<Border Classes="Hover">
|
||||
<TextBlock Text="Cryo"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
<u:Badge Header="Ursa" Classes="Danger" CornerPosition="TopRight">
|
||||
<Border Classes="Hover">
|
||||
<TextBlock Text="Geo"/>
|
||||
</Border>
|
||||
</u:Badge>
|
||||
</WrapPanel>
|
||||
|
||||
<u:Divider>DualBadge</u:Divider>
|
||||
<WrapPanel Orientation="Horizontal">
|
||||
<u:DualBadge Header="downloads">
|
||||
<u:DualBadge.Icon>
|
||||
<PathIcon
|
||||
Width="14"
|
||||
Height="14"
|
||||
Data="{StaticResource InfoPath}" />
|
||||
</u:DualBadge.Icon>
|
||||
2.4k
|
||||
</u:DualBadge>
|
||||
<u:DualBadge Classes="FlatSquare" Header="downloads">
|
||||
<u:DualBadge.Icon>
|
||||
<PathIcon
|
||||
Width="14"
|
||||
Height="14"
|
||||
Data="{StaticResource InfoPath}" />
|
||||
</u:DualBadge.Icon>
|
||||
2.4k
|
||||
</u:DualBadge>
|
||||
<u:DualBadge Classes="Plastic" Header="downloads">
|
||||
<u:DualBadge.Icon>
|
||||
<PathIcon
|
||||
Width="12"
|
||||
Height="12"
|
||||
Data="{StaticResource InfoPath}" />
|
||||
</u:DualBadge.Icon>
|
||||
2.4k
|
||||
</u:DualBadge>
|
||||
<u:DualBadge Classes="ForTheBadge" Header="downloads">
|
||||
<u:DualBadge.Icon>
|
||||
<PathIcon
|
||||
Width="12"
|
||||
Height="12"
|
||||
Data="{StaticResource InfoPath}" />
|
||||
</u:DualBadge.Icon>
|
||||
2.4k
|
||||
</u:DualBadge>
|
||||
</WrapPanel>
|
||||
|
||||
<u:Divider HorizontalContentAlignment="Left">
|
||||
<ToggleSwitch
|
||||
Name="s"
|
||||
OffContent="Divider"
|
||||
OnContent="Divider"
|
||||
IsChecked="True" />
|
||||
</u:Divider>
|
||||
<u:LoadingContainer
|
||||
IsLoading="{Binding #s.IsChecked}"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
LoadingMessage="Loading...">
|
||||
<StackPanel Spacing="20">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Windows" />
|
||||
<u:Divider Margin="12,0" Orientation="Vertical" />
|
||||
<TextBlock Text="macOS" />
|
||||
<u:Divider Orientation="Vertical" />
|
||||
<TextBlock Text="Linux" />
|
||||
</StackPanel>
|
||||
<Grid Height="100" Background="{DynamicResource MaskBackground}">
|
||||
<u:Divider HorizontalContentAlignment="Stretch">Stretch</u:Divider>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</u:LoadingContainer>
|
||||
<u:TagInput HorizontalAlignment="Left" Width="550" />
|
||||
<u:Pagination
|
||||
PageSizeOptions="10, 20, 50, 100"
|
||||
ShowPageSizeSelector="True"
|
||||
TotalCount="600" />
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Pages/IntroductionDemo.axaml.cs
Normal file
13
demo/Ursa.Demo/Pages/IntroductionDemo.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class IntroductionDemo : UserControl
|
||||
{
|
||||
public IntroductionDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,15 @@
|
||||
mc:Ignorable="d">
|
||||
<StackPanel Margin="20">
|
||||
<TextBlock Text="Accept all keys" />
|
||||
<u:KeyGestureInput HorizontalAlignment="Left" Width="500" />
|
||||
<u:KeyGestureInput HorizontalAlignment="Left" />
|
||||
<TextBlock Text="Accept only A,B and C" />
|
||||
<u:KeyGestureInput HorizontalAlignment="Left" AcceptableKeys="{Binding AcceptableKeys}" Width="500" />
|
||||
<u:KeyGestureInput
|
||||
Width="300"
|
||||
HorizontalAlignment="Left"
|
||||
AcceptableKeys="{Binding AcceptableKeys}"
|
||||
Classes="ClearButton"
|
||||
InnerLeftContent="Attack"
|
||||
InnerRightContent="Default" />
|
||||
<u:KeyGestureInput HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
35
demo/Ursa.Demo/Pages/MessageBoxDemo.axaml
Normal file
35
demo/Ursa.Demo/Pages/MessageBoxDemo.axaml
Normal file
@@ -0,0 +1,35 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.MessageBoxDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="using:Ursa.Demo.ViewModels"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="vm:MessageBoxDemoViewModel"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Styles>
|
||||
<Style Selector="Button">
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="Margin" Value="8"></Setter>
|
||||
</Style>
|
||||
</UserControl.Styles>
|
||||
<StackPanel HorizontalAlignment="Left">
|
||||
<ComboBox ItemsSource="{Binding Icons}" SelectedItem="{Binding SelectedIcon}" />
|
||||
<ToggleSwitch Content="Try Long Message" IsChecked="{Binding UseLong}"></ToggleSwitch>
|
||||
<ToggleSwitch Content="Show Title" IsChecked="{Binding UseTitle}"></ToggleSwitch>
|
||||
<ToggleSwitch Content="Overlay" IsChecked="{Binding UseOverlay}"></ToggleSwitch>
|
||||
<Button Command="{Binding DefaultMessageBoxCommand}" Content="Default" />
|
||||
<Button Command="{Binding OkCommand}" Content="OK" />
|
||||
<Button Command="{Binding OkCancelCommand}" Content="OKCancel" />
|
||||
<Button Command="{Binding YesNoCommand}" Content="YesNo" />
|
||||
<Button Command="{Binding YesNoCancelCommand}" Content="YesNoCancel" />
|
||||
|
||||
<TextBlock>
|
||||
<Run Text="Last Clicked Result: "></Run>
|
||||
<Run Text="{Binding Result}"></Run>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
15
demo/Ursa.Demo/Pages/MessageBoxDemo.axaml.cs
Normal file
15
demo/Ursa.Demo/Pages/MessageBoxDemo.axaml.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Ursa.Demo.ViewModels;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class MessageBoxDemo : UserControl
|
||||
{
|
||||
public MessageBoxDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new MessageBoxDemoViewModel();
|
||||
}
|
||||
}
|
||||
24
demo/Ursa.Demo/Pages/MultiComboBoxDemo.axaml
Normal file
24
demo/Ursa.Demo/Pages/MultiComboBoxDemo.axaml
Normal file
@@ -0,0 +1,24 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.MultiComboBoxDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="using:Ursa.Demo.ViewModels"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="vm:MultiComboBoxDemoViewModel"
|
||||
mc:Ignorable="d">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<u:MultiComboBox
|
||||
Name="combo"
|
||||
InnerLeftContent="Left"
|
||||
InnerRightContent="Right"
|
||||
Classes="ClearButton"
|
||||
ItemsSource="{Binding Items}" >
|
||||
</u:MultiComboBox>
|
||||
<ListBox ItemsSource="{Binding #combo.SelectedItems}" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Pages/MultiComboBoxDemo.axaml.cs
Normal file
13
demo/Ursa.Demo/Pages/MultiComboBoxDemo.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class MultiComboBoxDemo : UserControl
|
||||
{
|
||||
public MultiComboBoxDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
124
demo/Ursa.Demo/Pages/NavMenuDemo.axaml
Normal file
124
demo/Ursa.Demo/Pages/NavMenuDemo.axaml
Normal file
@@ -0,0 +1,124 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.NavMenuDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="clr-namespace:Ursa.Demo.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="using:Ursa.Demo.ViewModels"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="vm:NavMenuDemoViewModel"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<converters:IconNameToPathConverter x:Key="IconConverter" />
|
||||
</UserControl.Resources>
|
||||
<Grid
|
||||
HorizontalAlignment="Left"
|
||||
ColumnDefinitions="Auto, Auto"
|
||||
RowDefinitions="Auto, Auto, *">
|
||||
<ToggleButton
|
||||
Name="collapse"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2">
|
||||
Collapse
|
||||
</ToggleButton>
|
||||
<StackPanel Grid.Row="1" Grid.Column="0">
|
||||
<TextBlock Text="{Binding SelectedMenuItem.Header}" />
|
||||
<Button Command="{Binding RandomCommand}">Random a selection</Button>
|
||||
</StackPanel>
|
||||
<Border
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Padding="0"
|
||||
HorizontalAlignment="Left"
|
||||
Theme="{DynamicResource CardBorder}">
|
||||
<u:NavMenu
|
||||
Name="menu"
|
||||
ExpandWidth="400"
|
||||
HeaderBinding="{Binding Header}"
|
||||
IconBinding="{Binding IconIndex}"
|
||||
IsHorizontalCollapsed="{Binding #collapse.IsChecked, Mode=OneWay}"
|
||||
ItemsSource="{Binding MenuItems}"
|
||||
SelectedItem="{Binding SelectedMenuItem}"
|
||||
SubMenuBinding="{Binding Children}">
|
||||
<u:NavMenu.Styles>
|
||||
<Style x:DataType="vm:MenuItem" Selector="u|NavMenuItem">
|
||||
<Setter Property="IsSeparator" Value="{Binding IsSeparator}" />
|
||||
</Style>
|
||||
</u:NavMenu.Styles>
|
||||
<u:NavMenu.IconTemplate>
|
||||
<DataTemplate DataType="{x:Type x:Int32}">
|
||||
<u:TwoTonePathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
ActiveForeground="{DynamicResource SemiBlue5}"
|
||||
ActiveStrokeBrush="{DynamicResource SemiBlue5}"
|
||||
Data="{Binding Converter={StaticResource IconConverter}}"
|
||||
Foreground="{DynamicResource SemiGrey5}"
|
||||
IsActive="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=u:NavMenuItem}, Path=IsHighlighted, Mode=TwoWay}"
|
||||
StrokeBrush="{DynamicResource SemiGrey5}" />
|
||||
</DataTemplate>
|
||||
</u:NavMenu.IconTemplate>
|
||||
<u:NavMenu.Header>
|
||||
<Grid HorizontalAlignment="Center" ColumnDefinitions="Auto, Auto">
|
||||
<Image
|
||||
Width="48"
|
||||
Height="48"
|
||||
Margin="4,12"
|
||||
u:NavMenu.CanToggle="True"
|
||||
RenderOptions.BitmapInterpolationMode="HighQuality"
|
||||
Source="../Assets/Ursa.ico" />
|
||||
<TextBlock
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
Classes="H5"
|
||||
IsVisible="{Binding !#menu.IsHorizontalCollapsed}"
|
||||
Text="Ursa Avalonia"
|
||||
Theme="{DynamicResource TitleTextBlock}" />
|
||||
</Grid>
|
||||
</u:NavMenu.Header>
|
||||
</u:NavMenu>
|
||||
</Border>
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Text="{ReflectionBinding #menu2.SelectedItem.Header}" />
|
||||
<u:NavMenu
|
||||
Name="menu2"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
IsHorizontalCollapsed="{Binding #collapse.IsChecked}">
|
||||
<u:NavMenuItem Header="Menu 1">
|
||||
<u:NavMenuItem.Icon>
|
||||
<Rectangle
|
||||
Width="10"
|
||||
Height="10"
|
||||
Fill="Red" />
|
||||
</u:NavMenuItem.Icon>
|
||||
<u:NavMenuItem Header="Sub Menu 1" />
|
||||
<u:NavMenuItem Header="Sub Menu 2" />
|
||||
<u:NavMenuItem Header="Sub Menu 3" />
|
||||
</u:NavMenuItem>
|
||||
<u:NavMenuItem Header="Menu 2">
|
||||
<u:NavMenuItem.Icon>
|
||||
<Rectangle
|
||||
Width="10"
|
||||
Height="10"
|
||||
Fill="Red" />
|
||||
</u:NavMenuItem.Icon>
|
||||
</u:NavMenuItem>
|
||||
<u:NavMenuItem Header="Menu 3">
|
||||
<u:NavMenuItem.Icon>
|
||||
<Rectangle
|
||||
Width="10"
|
||||
Height="10"
|
||||
Fill="Red" />
|
||||
</u:NavMenuItem.Icon>
|
||||
</u:NavMenuItem>
|
||||
</u:NavMenu>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
27
demo/Ursa.Demo/Pages/NavMenuDemo.axaml.cs
Normal file
27
demo/Ursa.Demo/Pages/NavMenuDemo.axaml.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Shapes;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.LogicalTree;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Ursa.Demo.ViewModels;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class NavMenuDemo : UserControl
|
||||
{
|
||||
public NavMenuDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new NavMenuDemoViewModel();
|
||||
}
|
||||
|
||||
private void InputElement_OnPointerPressed(object? sender, PointerPressedEventArgs e)
|
||||
{
|
||||
if (sender is Rectangle c)
|
||||
{
|
||||
c.ApplyStyling();
|
||||
var ancestors = c.GetLogicalAncestors();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.NavigationMenuDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="clr-namespace:Ursa.Demo.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="clr-namespace:Ursa.Demo.ViewModels"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="vm:NavigationMenuDemoViewModel"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<converters:IconNameConverter x:Key="IconNameConverter">
|
||||
<PathGeometry x:Key="User">M12 16C13.9818 16 15.7453 14.3394 16.7142 11.8589C17.3163 11.6122 17.8892 10.8644 18.1508 9.88823C18.4909 8.61881 18.4234 7.48536 17.4964 7.13266C17.4064 2.7111 15.6617 1 12 1C8.33858 1 6.59387 2.71088 6.50372 7.13179C5.57454 7.48354 5.50668 8.61777 5.84709 9.8882C6.10904 10.8658 6.68318 11.6143 7.28626 11.8599C8.2552 14.3398 10.0186 16 12 16Z M19.6049 22C20.8385 22 21.7171 20.8487 20.867 19.9547C19.1971 18.1985 15.853 17 12 17C8.14699 17 4.80292 18.1985 3.133 19.9547C2.2829 20.8487 3.16148 22 4.39513 22H19.6049Z</PathGeometry>
|
||||
<PathGeometry x:Key="Star">M10.7525 1.90411C11.1451 0.698628 12.8549 0.698631 13.2475 1.90411L15.2395 8.01946H21.6858C22.9565 8.01946 23.4848 9.64143 22.4568 10.3865L17.2417 14.1659L19.2337 20.2813C19.6263 21.4868 18.2431 22.4892 17.2151 21.7442L12 17.9647L6.78489 21.7442C5.75687 22.4892 4.37368 21.4868 4.76635 20.2813L6.75834 14.1659L1.54323 10.3865C0.515206 9.64142 1.04354 8.01946 2.31425 8.01946H8.76048L10.7525 1.90411Z</PathGeometry>
|
||||
<PathGeometry x:Key="Gear">M7.99973 5.07197C7.19713 5.53535 6.20729 5.53113 5.40866 5.06092L5.1637 4.91669C4.55751 4.55978 3.77662 4.65563 3.34264 5.20927C2.69567 6.03462 2.17585 6.94251 1.79166 7.90124C1.53027 8.55354 1.83733 9.27693 2.449 9.62286L2.69407 9.76145C3.50107 10.2178 4.00002 11.0732 4.00002 12.0003C4.00002 12.9271 3.50145 13.7822 2.69492 14.2387L2.44842 14.3783C1.83596 14.725 1.52888 15.4497 1.79213 16.1024C1.98358 16.577 2.21048 17.044 2.47374 17.5C2.73723 17.9564 3.0285 18.3868 3.34416 18.7902C3.77773 19.3443 4.5588 19.4406 5.16498 19.0834L5.40839 18.9399C6.20714 18.4692 7.19739 18.4648 8.0003 18.9284C8.80291 19.3918 9.29417 20.2511 9.28627 21.1778L9.28386 21.4601C9.27787 22.1629 9.75107 22.7906 10.4468 22.8903C11.4692 23.0368 12.5154 23.0404 13.5537 22.8927C14.2499 22.7936 14.7231 22.1653 14.7169 21.462L14.7143 21.1785C14.7061 20.2514 15.1974 19.3916 16.0003 18.928C16.8029 18.4647 17.7927 18.4689 18.5914 18.9391L18.8363 19.0833C19.4425 19.4402 20.2234 19.3444 20.6574 18.7907C21.3044 17.9654 21.8242 17.0575 22.2084 16.0988C22.4698 15.4465 22.1627 14.7231 21.551 14.3772L21.306 14.2386C20.499 13.7822 20 12.9268 20 11.9997C20 11.0729 20.4986 10.2178 21.3051 9.76126L21.5516 9.62174C22.1641 9.27506 22.4712 8.55029 22.2079 7.89761C22.0165 7.42297 21.7896 6.95598 21.5263 6.50001C21.2628 6.04362 20.9715 5.61325 20.6559 5.20982C20.2223 4.65568 19.4412 4.55944 18.8351 4.91665L18.5916 5.06009C17.7929 5.53078 16.8026 5.53519 15.9997 5.07163C15.1971 4.60825 14.7059 3.74891 14.7138 2.82218L14.7162 2.53994C14.7222 1.83708 14.249 1.20945 13.5532 1.10973C12.5308 0.963214 11.4846 0.959581 10.4464 1.10733C9.75011 1.20641 9.27691 1.83473 9.28317 2.53798L9.28569 2.82154C9.29395 3.74862 8.80264 4.60841 7.99973 5.07197ZM14 15.4641C15.9132 14.3595 16.5687 11.9132 15.4641 9.99999C14.3595 8.08682 11.9132 7.43132 10 8.53589C8.08684 9.64046 7.43134 12.0868 8.53591 14C9.64048 15.9132 12.0868 16.5687 14 15.4641Z</PathGeometry>
|
||||
|
||||
</converters:IconNameConverter>
|
||||
</UserControl.Resources>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Border Padding="4" Theme="{DynamicResource CardBorder}">
|
||||
<u:NavigationMenu
|
||||
Name="menu"
|
||||
HorizontalAlignment="Left"
|
||||
ItemsSource="{Binding MenuItems}"
|
||||
ShowCollapseButton="True">
|
||||
<u:NavigationMenu.Header>
|
||||
<TextBlock
|
||||
Classes="H5"
|
||||
Text="Semi Avalonia"
|
||||
Theme="{DynamicResource TitleTextBlock}" />
|
||||
</u:NavigationMenu.Header>
|
||||
<u:NavigationMenu.Icon>
|
||||
<PathIcon
|
||||
Width="32"
|
||||
Height="32"
|
||||
Data="M10.6201 17.5C6.06377 17.5 2.37012 13.8063 2.37012 9.25C2.37012 4.69365 6.06377 1 10.6201 1V17.5ZM13.3701 6.5C17.9265 6.5 21.6201 10.1936 21.6201 14.75C21.6201 19.3063 17.9265 23 13.3701 23V6.5Z" />
|
||||
</u:NavigationMenu.Icon>
|
||||
<u:NavigationMenu.ItemTemplate>
|
||||
<converters:MenuDataTemplateSelector>
|
||||
<converters:MenuDataTemplateSelector.MenuTemplate>
|
||||
<DataTemplate DataType="vm:MenuItemViewModel">
|
||||
<u:NavigationMenuItem Header="{Binding MenuHeader}" ItemsSource="{Binding Children}">
|
||||
<u:NavigationMenuItem.Icon>
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{Binding MenuIconName, Converter={StaticResource IconNameConverter}}" />
|
||||
</u:NavigationMenuItem.Icon>
|
||||
</u:NavigationMenuItem>
|
||||
</DataTemplate>
|
||||
</converters:MenuDataTemplateSelector.MenuTemplate>
|
||||
<converters:MenuDataTemplateSelector.SeparatorTemplate>
|
||||
<DataTemplate DataType="vm:MenuItemViewModel">
|
||||
<u:NavigationMenuSeparator Header="{Binding MenuHeader}" />
|
||||
</DataTemplate>
|
||||
</converters:MenuDataTemplateSelector.SeparatorTemplate>
|
||||
</converters:MenuDataTemplateSelector>
|
||||
</u:NavigationMenu.ItemTemplate>
|
||||
</u:NavigationMenu>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
36
demo/Ursa.Demo/Pages/NumPadDemo.axaml
Normal file
36
demo/Ursa.Demo/Pages/NumPadDemo.axaml
Normal file
@@ -0,0 +1,36 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.NumPadDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<StackPanel HorizontalAlignment="Left">
|
||||
<TextBox
|
||||
HorizontalAlignment="Stretch"
|
||||
u:NumPad.Attach="True"
|
||||
Watermark="Invoke NumPad" />
|
||||
<TextBox
|
||||
HorizontalAlignment="Stretch"
|
||||
u:NumPad.Attach="True"
|
||||
Watermark="Invoke NumPad" />
|
||||
<TextBox
|
||||
HorizontalAlignment="Stretch"
|
||||
u:NumPad.Attach="True"
|
||||
Watermark="Invoke NumPad" />
|
||||
<u:IPv4Box Width="200" u:NumPad.Attach="True" />
|
||||
<u:NumericIntUpDown
|
||||
HorizontalAlignment="Stretch"
|
||||
u:NumPad.Attach="True"
|
||||
Watermark="Invoke NumPad" />
|
||||
<Border Theme="{DynamicResource CardBorder}">
|
||||
<StackPanel>
|
||||
<TextBox Name="text" Width="200" />
|
||||
<u:NumPad Target="{Binding #text}" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
14
demo/Ursa.Demo/Pages/NumPadDemo.axaml.cs
Normal file
14
demo/Ursa.Demo/Pages/NumPadDemo.axaml.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class NumPadDemo : UserControl
|
||||
{
|
||||
public NumPadDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
31
demo/Ursa.Demo/Pages/NumberDisplayerDemo.axaml
Normal file
31
demo/Ursa.Demo/Pages/NumberDisplayerDemo.axaml
Normal file
@@ -0,0 +1,31 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.NumberDisplayerDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="using:Ursa.Demo.ViewModels"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="vm:NumberDisplayerDemoViewModel"
|
||||
mc:Ignorable="d">
|
||||
<StackPanel HorizontalAlignment="Left">
|
||||
<Button Command="{Binding IncreaseCommand}">Change</Button>
|
||||
<u:Int32Displayer Value="{Binding Value}" />
|
||||
<u:DoubleDisplayer StringFormat="N2" Value="{Binding DoubleValue}" />
|
||||
<u:DateDisplay
|
||||
FontSize="30"
|
||||
StringFormat="yyyy-MM-dd"
|
||||
Value="{Binding DateValue}" />
|
||||
<TextBlock Text="Selectable: "></TextBlock>
|
||||
<u:Int32Displayer Value="{Binding Value}" IsSelectable="True" />
|
||||
<u:DoubleDisplayer StringFormat="N2" Value="{Binding DoubleValue}" IsSelectable="True" />
|
||||
<u:DateDisplay
|
||||
FontSize="30"
|
||||
StringFormat="yyyy-MM-dd"
|
||||
IsSelectable="True"
|
||||
Value="{Binding DateValue}" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Pages/NumberDisplayerDemo.axaml.cs
Normal file
13
demo/Ursa.Demo/Pages/NumberDisplayerDemo.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class NumberDisplayerDemo : UserControl
|
||||
{
|
||||
public NumberDisplayerDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
197
demo/Ursa.Demo/Pages/NumericUpDownDemo.axaml
Normal file
197
demo/Ursa.Demo/Pages/NumericUpDownDemo.axaml
Normal file
@@ -0,0 +1,197 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.NumericUpDownDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="using:Ursa.Demo.ViewModels"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="vm:NumericUpDownDemoViewModel"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<UserControl.Styles>
|
||||
<Style Selector=":is(u|NumericUpDown)">
|
||||
<Setter Property="Width" Value="240" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
||||
</Style>
|
||||
</UserControl.Styles>
|
||||
|
||||
<Grid ColumnDefinitions="*,*" RowDefinitions="100,*">
|
||||
<StackPanel Grid.ColumnSpan="2">
|
||||
<u:Divider Content="Demo"/>
|
||||
<u:NumericUIntUpDown
|
||||
Name="numd"
|
||||
Width="{Binding Width}"
|
||||
HorizontalAlignment="{Binding HorizontalAlignment}"
|
||||
HorizontalContentAlignment="{Binding HorizontalContentAlignment}"
|
||||
AllowDrag="{Binding AllowDrag}"
|
||||
AllowSpin="{Binding AllowSpin}"
|
||||
Command="{Binding TrythisCommand}"
|
||||
FontFamily="{Binding FontFamily, Mode=OneWay}"
|
||||
FormatString="{Binding FormatString}"
|
||||
InnerLeftContent="{Binding InnerLeftContent}"
|
||||
IsEnabled="{Binding IsEnable}"
|
||||
IsReadOnly="{Binding IsReadOnly}"
|
||||
Maximum="{Binding Maximum}"
|
||||
Minimum="{Binding Minimum}"
|
||||
ParsingNumberStyle="{Binding ParsingNumberStyle}"
|
||||
ShowButtonSpinner="{Binding ShowButtonSpinner}"
|
||||
Step="{Binding Step}"
|
||||
Watermark="{Binding Watermark}"
|
||||
Value="{Binding Value}" />
|
||||
<TextBox
|
||||
Width="NaN"
|
||||
HorizontalAlignment="Center"
|
||||
IsReadOnly="true"
|
||||
Text="{Binding CommandUpdateText}" />
|
||||
<u:Divider Content="Demo" />
|
||||
</StackPanel>
|
||||
|
||||
<Grid
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
HorizontalAlignment="Left">
|
||||
<StackPanel Grid.Row="1">
|
||||
<u:Divider Content="{Binding #input.Value, StringFormat='Int = {0}'}" />
|
||||
<u:NumericIntUpDown
|
||||
Name="input"
|
||||
Classes="ClearButton"
|
||||
InnerLeftContent="Age"
|
||||
Step="1"
|
||||
Watermark="Input Value"
|
||||
Value="2" />
|
||||
<u:Divider Content="{Binding #inputDouble.Value, StringFormat='Double = {0}'}" />
|
||||
<u:NumericDoubleUpDown
|
||||
Name="inputDouble"
|
||||
EmptyInputValue="1"
|
||||
Step="0.5"
|
||||
Value="3.1" />
|
||||
<u:Divider Content="{Binding #inputByte.Value, StringFormat='Byte = {0}'}" />
|
||||
<u:NumericByteUpDown
|
||||
Name="inputByte"
|
||||
EmptyInputValue="1"
|
||||
Step="1"
|
||||
Value="3" />
|
||||
<u:Divider Content="{Binding #Drag_Int.Value, StringFormat='Drag Int = {0}'}" />
|
||||
<u:NumericIntUpDown
|
||||
Name="Drag_Int"
|
||||
AllowDrag="True"
|
||||
InnerLeftContent="Drag"
|
||||
Step="1"
|
||||
Watermark="Input Value"
|
||||
Value="2" />
|
||||
|
||||
<!-- hex demo -->
|
||||
|
||||
<u:Divider Content="{Binding #uint_HexNumber.Value, StringFormat='Don‘t Use = {0}, hex={0:X}'}" />
|
||||
<!-- =================this is error usage -->
|
||||
<u:NumericUIntUpDown
|
||||
Name="uint_HexNumber"
|
||||
AllowDrag="False"
|
||||
FormatString="{}{0:X8}"
|
||||
InnerLeftContent="HexNumber"
|
||||
ParsingNumberStyle="HexNumber"
|
||||
Step="1"
|
||||
Watermark="Input Value"
|
||||
Value="2" />
|
||||
|
||||
<!-- =================we should use AllowHexSpecifier -->
|
||||
<u:Divider Content="{Binding #uint_AllowHexSpecifier.Value, StringFormat='uint = {0}, hex={0:X}'}" />
|
||||
<u:NumericUIntUpDown
|
||||
Name="uint_AllowHexSpecifier"
|
||||
HorizontalContentAlignment="Right"
|
||||
AllowDrag="False"
|
||||
FontFamily="Consolas"
|
||||
FormatString="{}{0:X8}"
|
||||
InnerLeftContent="AllowHexSpecifier"
|
||||
ParsingNumberStyle="AllowHexSpecifier"
|
||||
Step="1"
|
||||
Watermark="AllowHexSpecifier"
|
||||
Value="2" />
|
||||
|
||||
<u:Divider Content="{Binding #Consolas_uint.Value, StringFormat='Font=Consolas {0}, hex={0:X}'}" />
|
||||
<u:NumericUIntUpDown
|
||||
Name="Consolas_uint"
|
||||
HorizontalContentAlignment="Right"
|
||||
AllowDrag="False"
|
||||
FontFamily="Consolas"
|
||||
FormatString="X8"
|
||||
InnerLeftContent="0x"
|
||||
ParsingNumberStyle="AllowHexSpecifier"
|
||||
Step="1"
|
||||
Watermark="AllowHexSpecifier"
|
||||
Value="2" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Left"
|
||||
Orientation="Vertical">
|
||||
|
||||
<CheckBox Content="AutoWidth" IsChecked="{Binding AutoWidth}" />
|
||||
<u:NumericDoubleUpDown
|
||||
AllowDrag="True"
|
||||
InnerLeftContent="Width"
|
||||
IsEnabled="{Binding !AutoWidth}"
|
||||
Value="{Binding Width}" />
|
||||
|
||||
<TextBox InnerLeftContent="FontFamily" Text="{Binding FontFamily}" />
|
||||
|
||||
<CheckBox Content="AllowDrag" IsChecked="{Binding AllowDrag}" />
|
||||
|
||||
<CheckBox Content="IsReadOnly" IsChecked="{Binding IsReadOnly}" />
|
||||
|
||||
<Label Content="HorizontalAlignment" />
|
||||
<ComboBox ItemsSource="{Binding Array_HorizontalAlignment}" SelectedItem="{Binding HorizontalAlignment}" />
|
||||
<Label Content="HorizontalContentAlignment" />
|
||||
<ComboBox ItemsSource="{Binding Array_HorizontalContentAlignment}" SelectedItem="{Binding HorizontalContentAlignment}" />
|
||||
|
||||
<TextBox
|
||||
InnerLeftContent="InnerLeftContent"
|
||||
InnerRightContent="obj"
|
||||
Text="{Binding InnerLeftContent}" />
|
||||
|
||||
<TextBox InnerLeftContent="Watermark" Text="{Binding Watermark}" />
|
||||
|
||||
<TextBox
|
||||
MinWidth="100"
|
||||
InnerLeftContent="FormatString"
|
||||
MaxLength="100"
|
||||
Text="{Binding FormatString}" />
|
||||
|
||||
<Label Content="ParsingNumberStyle" />
|
||||
<ComboBox ItemsSource="{Binding Array_ParsingNumberStyle}" SelectedItem="{Binding ParsingNumberStyle}" />
|
||||
|
||||
<CheckBox Content="AllowSpin" IsChecked="{Binding AllowSpin}" />
|
||||
|
||||
<CheckBox Content="ShowButtonSpinner" IsChecked="{Binding ShowButtonSpinner}" />
|
||||
|
||||
<u:NumericUIntUpDown
|
||||
Name="nudV"
|
||||
AllowSpin="True"
|
||||
InnerLeftContent="Value"
|
||||
IsEnabled="True"
|
||||
IsReadOnly="False"
|
||||
Value="{Binding Value, Mode=TwoWay}" />
|
||||
|
||||
<u:NumericUIntUpDown InnerLeftContent="Max" Value="{Binding Maximum}" />
|
||||
|
||||
<u:NumericUIntUpDown InnerLeftContent="Min" Value="{Binding Minimum}" />
|
||||
|
||||
<Label Content="{Binding Step, StringFormat='Step {0}'}" />
|
||||
<Slider
|
||||
Minimum="1"
|
||||
ToolTip.Tip="{Binding Step}"
|
||||
Value="{Binding Step}" />
|
||||
|
||||
<CheckBox Content="IsEnable" IsChecked="{Binding IsEnable}" />
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
25
demo/Ursa.Demo/Pages/NumericUpDownDemo.axaml.cs
Normal file
25
demo/Ursa.Demo/Pages/NumericUpDownDemo.axaml.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Ursa.Controls;
|
||||
using Ursa.Demo.ViewModels;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class NumericUpDownDemo : UserControl
|
||||
{
|
||||
public NumericUpDownDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = new NumericUpDownDemoViewModel();
|
||||
numd.ValueChanged += Numd_ValueChanged;
|
||||
}
|
||||
|
||||
private void Numd_ValueChanged(object? sender, ValueChangedEventArgs<uint> e)
|
||||
{
|
||||
Trace.WriteLine($"{(sender as NumericUIntUpDown).Name} {e.OldValue} {e.NewValue}");
|
||||
|
||||
}
|
||||
}
|
||||
@@ -13,12 +13,19 @@
|
||||
<viewModels:PaginationDemoViewModel />
|
||||
</Design.DataContext>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding #page.CurrentPage}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Current Page: "></TextBlock>
|
||||
<TextBlock Text="{Binding #page.CurrentPage}" />
|
||||
</StackPanel>
|
||||
<ToggleSwitch Name="pageSizeSelector" Content="Show Page Size Selector" />
|
||||
<ToggleSwitch Name="quickJumperSelector" Content="Show Quick Jumper"></ToggleSwitch>
|
||||
<u:Pagination
|
||||
Name="page"
|
||||
PageSizeOptions="10, 20, 50, 100"
|
||||
ShowQuickJump="{Binding #quickJumperSelector.IsChecked}"
|
||||
ShowPageSizeSelector="{Binding #pageSizeSelector.IsChecked}"
|
||||
Command="{Binding LoadPageCommand}"
|
||||
CommandParameter="{Binding $self.CurrentPage}"
|
||||
TotalCount="600" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
||||
52
demo/Ursa.Demo/Pages/RangeSliderDemo.axaml
Normal file
52
demo/Ursa.Demo/Pages/RangeSliderDemo.axaml
Normal file
@@ -0,0 +1,52 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.RangeSliderDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="using:Ursa.Demo.ViewModels"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="vm:RangeSliderDemoViewModel"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Styles>
|
||||
<Style Selector="u|NumericDoubleUpDown">
|
||||
<Setter Property="Width" Value="300" />
|
||||
</Style>
|
||||
</UserControl.Styles>
|
||||
<StackPanel>
|
||||
<u:RangeSlider
|
||||
IsSnapToTick="True"
|
||||
TickFrequency="5"
|
||||
TickPlacement="TopLeft"
|
||||
Minimum="{Binding #range.Minimum, Mode=TwoWay}"
|
||||
Maximum="{Binding #range.Maximum, Mode=TwoWay}"
|
||||
LowerValue="{Binding #range.LowerValue, Mode=TwoWay}"
|
||||
UpperValue="{Binding #range.UpperValue, Mode=TwoWay}"/>
|
||||
<u:NumericDoubleUpDown InnerLeftContent="Minimum" Value="{Binding #range.Minimum, Mode=TwoWay}" />
|
||||
<u:NumericDoubleUpDown InnerLeftContent="Maximum" Value="{Binding #range.Maximum, Mode=TwoWay}" />
|
||||
<u:NumericDoubleUpDown InnerLeftContent="LowerValue" Value="{Binding #range.LowerValue, Mode=TwoWay}" />
|
||||
<u:NumericDoubleUpDown InnerLeftContent="UpperValue" Value="{Binding #range.UpperValue, Mode=TwoWay}" />
|
||||
<ComboBox ItemsSource="{Binding Orientations}" SelectedItem="{Binding Orientation}" />
|
||||
<u:RangeSlider
|
||||
Name="range"
|
||||
Margin="8"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Orientation="{Binding Orientation}"
|
||||
TickFrequency="5">
|
||||
<u:RangeSlider.Styles>
|
||||
<Style Selector="u|RangeSlider:horizontal">
|
||||
<Setter Property="Width" Value="400" />
|
||||
<Setter Property="Height" Value="40" />
|
||||
</Style>
|
||||
<Style Selector="u|RangeSlider:vertical">
|
||||
<Setter Property="Width" Value="40" />
|
||||
<Setter Property="Height" Value="400" />
|
||||
</Style>
|
||||
</u:RangeSlider.Styles>
|
||||
</u:RangeSlider>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
@@ -5,11 +5,11 @@ using Ursa.Demo.ViewModels;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class NavigationMenuDemo : UserControl
|
||||
public partial class RangeSliderDemo : UserControl
|
||||
{
|
||||
public NavigationMenuDemo()
|
||||
public RangeSliderDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new NavigationMenuDemoViewModel();
|
||||
this.DataContext = new RangeSliderDemoViewModel();
|
||||
}
|
||||
}
|
||||
77
demo/Ursa.Demo/Pages/ScrollToButtonDemo.axaml
Normal file
77
demo/Ursa.Demo/Pages/ScrollToButtonDemo.axaml
Normal file
@@ -0,0 +1,77 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.ScrollToButtonDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="clr-namespace:Ursa.Demo.ViewModels"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="vm:ScrollToButtonDemoViewModel"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Styles>
|
||||
<Style Selector="ScrollViewer">
|
||||
<Setter Property="Margin" Value="8" />
|
||||
</Style>
|
||||
<Style Selector="ScrollViewer Border.Content">
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<LinearGradientBrush StartPoint="0, 0" EndPoint="2000, 2000">
|
||||
<GradientStop Color="{DynamicResource SemiPurple9Color}" Offset="0.0"></GradientStop>
|
||||
<GradientStop Color="{DynamicResource SemiPurple5Color}" Offset="0.5"></GradientStop>
|
||||
<GradientStop Color="{DynamicResource SemiPurple1Color}" Offset="1.0"></GradientStop>
|
||||
</LinearGradientBrush>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</UserControl.Styles>
|
||||
<Grid ColumnDefinitions="*, *, *, *, *" RowDefinitions="Auto, *">
|
||||
<TextBlock Grid.Row="0" Grid.Column="0">Scroll To Top</TextBlock>
|
||||
<TextBlock Grid.Row="0" Grid.Column="1">Scroll To Bottom</TextBlock>
|
||||
<TextBlock Grid.Row="0" Grid.Column="2">Scroll To Left</TextBlock>
|
||||
<TextBlock Grid.Row="0" Grid.Column="3">Scroll To Right</TextBlock>
|
||||
<TextBlock Grid.Row="0" Grid.Column="4">Scroll To Top</TextBlock>
|
||||
<ScrollViewer
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
u:ScrollTo.Direction="Top"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<Border Classes="Content" Height="2000" HorizontalAlignment="Stretch" />
|
||||
</ScrollViewer>
|
||||
<ScrollViewer
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
u:ScrollTo.Direction="Bottom"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<Border Classes="Content" Height="2000" HorizontalAlignment="Stretch" />
|
||||
</ScrollViewer>
|
||||
<ScrollViewer
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
u:ScrollTo.Direction="Left"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
VerticalScrollBarVisibility="Disabled">
|
||||
<Border Classes="Content" Width="2000" VerticalAlignment="Stretch" />
|
||||
</ScrollViewer>
|
||||
<ScrollViewer
|
||||
Grid.Row="1"
|
||||
Grid.Column="3"
|
||||
u:ScrollTo.Direction="Right"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
VerticalScrollBarVisibility="Disabled">
|
||||
<Border Classes="Content" Width="2000" VerticalAlignment="Stretch" />
|
||||
</ScrollViewer>
|
||||
<ListBox
|
||||
Grid.Row="1"
|
||||
Grid.Column="4"
|
||||
u:ScrollTo.Direction="Top"
|
||||
u:ScrollTo.ButtonTheme="{DynamicResource PrimaryScrollToButton}"
|
||||
ItemsSource="{Binding Items}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Pages/ScrollToButtonDemo.axaml.cs
Normal file
13
demo/Ursa.Demo/Pages/ScrollToButtonDemo.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class ScrollToButtonDemo : UserControl
|
||||
{
|
||||
public ScrollToButtonDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
55
demo/Ursa.Demo/Pages/SelectionBoxDemo.axaml
Normal file
55
demo/Ursa.Demo/Pages/SelectionBoxDemo.axaml
Normal file
@@ -0,0 +1,55 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.SelectionListDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="using:Ursa.Demo.ViewModels"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="vm:SelectionListDemoViewModel"
|
||||
mc:Ignorable="d">
|
||||
<StackPanel HorizontalAlignment="Left">
|
||||
<u:SelectionList ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}">
|
||||
<u:SelectionList.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</u:SelectionList.ItemsPanel>
|
||||
</u:SelectionList>
|
||||
<u:SelectionList ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}" />
|
||||
<u:SelectionList ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}">
|
||||
<u:SelectionList.Indicator>
|
||||
<Border Background="Transparent" CornerRadius="4">
|
||||
<Border
|
||||
Width="4"
|
||||
Margin="0,8"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{DynamicResource SemiBlue6}"
|
||||
CornerRadius="4" />
|
||||
</Border>
|
||||
</u:SelectionList.Indicator>
|
||||
<u:SelectionList.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Panel Height="40">
|
||||
<TextBlock
|
||||
Classes.Active="{Binding $parent[u:SelectionListItem].IsSelected, Mode=OneWay}"
|
||||
Margin="8,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding}">
|
||||
<TextBlock.Styles>
|
||||
<Style Selector="TextBlock.Active">
|
||||
<Setter Property="Foreground" Value="{DynamicResource SemiOrange6}" />
|
||||
</Style>
|
||||
</TextBlock.Styles>
|
||||
</TextBlock>
|
||||
</Panel>
|
||||
</DataTemplate>
|
||||
</u:SelectionList.ItemTemplate>
|
||||
</u:SelectionList>
|
||||
<Button Command="{Binding Clear}">Clear</Button>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Pages/SelectionBoxDemo.axaml.cs
Normal file
13
demo/Ursa.Demo/Pages/SelectionBoxDemo.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class SelectionListDemo : UserControl
|
||||
{
|
||||
public SelectionListDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
62
demo/Ursa.Demo/Pages/SkeletonDemo.axaml
Normal file
62
demo/Ursa.Demo/Pages/SkeletonDemo.axaml
Normal file
@@ -0,0 +1,62 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.SkeletonDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="clr-namespace:Ursa.Demo.ViewModels"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<Design.DataContext>
|
||||
<vm:SkeletonDemoViewModel />
|
||||
</Design.DataContext>
|
||||
<StackPanel>
|
||||
<ToggleSwitch Name="loading" Content="Loading" />
|
||||
<ToggleSwitch Name="active" Content="Active" />
|
||||
<Grid
|
||||
MinWidth="400"
|
||||
HorizontalAlignment="Left"
|
||||
ColumnDefinitions="auto,*">
|
||||
<u:Skeleton
|
||||
Width="100"
|
||||
Height="100"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="2"
|
||||
IsActive="{Binding #active.IsChecked}"
|
||||
IsLoading="{Binding #loading.IsChecked}">
|
||||
<Image RenderOptions.BitmapInterpolationMode="HighQuality" Source="../Assets/Ursa.ico" />
|
||||
</u:Skeleton>
|
||||
<UniformGrid
|
||||
Grid.Column="1"
|
||||
Margin="5,0"
|
||||
Columns="1"
|
||||
Rows="3">
|
||||
<u:Skeleton
|
||||
Margin="0,0,200,0"
|
||||
VerticalAlignment="Top"
|
||||
CornerRadius="2"
|
||||
IsActive="{Binding #active.IsChecked}"
|
||||
IsLoading="{Binding #loading.IsChecked}">
|
||||
<SelectableTextBlock Margin="0,2" Text="是先有鸡还是先有蛋" />
|
||||
</u:Skeleton>
|
||||
<u:Skeleton
|
||||
Margin="0,0,100,0"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="2"
|
||||
IsActive="{Binding #active.IsChecked}"
|
||||
IsLoading="{Binding #loading.IsChecked}">
|
||||
<SelectableTextBlock Margin="0,2" Text="什么是工匠精神" />
|
||||
</u:Skeleton>
|
||||
<u:Skeleton
|
||||
VerticalAlignment="Bottom"
|
||||
CornerRadius="2"
|
||||
IsActive="{Binding #active.IsChecked}"
|
||||
IsLoading="{Binding #loading.IsChecked}">
|
||||
<SelectableTextBlock Margin="0,2" Text="看山不是山,看水不是水,看山还是山,看水还是水" />
|
||||
</u:Skeleton>
|
||||
</UniformGrid>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
14
demo/Ursa.Demo/Pages/SkeletonDemo.axaml.cs
Normal file
14
demo/Ursa.Demo/Pages/SkeletonDemo.axaml.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Avalonia.Controls;
|
||||
using Ursa.Demo.ViewModels;
|
||||
|
||||
namespace Ursa.Demo.Pages
|
||||
{
|
||||
public partial class SkeletonDemo : UserControl
|
||||
{
|
||||
public SkeletonDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = new SkeletonDemoViewModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,9 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="using:Ursa.Demo.ViewModels"
|
||||
x:DataType="vm:TagInputDemoViewModel"
|
||||
x:CompileBindings="True"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
@@ -12,12 +15,15 @@
|
||||
<u:TagInput
|
||||
Name="labels"
|
||||
Margin="20"
|
||||
Separator="-" />
|
||||
AllowDuplicates="True"
|
||||
Separator="-"
|
||||
Tags="{Binding Tags}" />
|
||||
<u:TagInput
|
||||
Margin="20"
|
||||
AllowDuplicates="False"
|
||||
LostFocusBehavior="Clear"
|
||||
Separator="-"
|
||||
Tags="{Binding #labels.Tags}" />
|
||||
<ListBox ItemsSource="{Binding #labels.Tags}" />
|
||||
Tags="{Binding DistinctTags}" />
|
||||
<ListBox ItemsSource="{Binding DistinctTags}" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
||||
28
demo/Ursa.Demo/Pages/ThemeTogglerDemo.axaml
Normal file
28
demo/Ursa.Demo/Pages/ThemeTogglerDemo.axaml
Normal file
@@ -0,0 +1,28 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
mc:Ignorable="d" d:DesignWidth="800"
|
||||
d:DesignHeight="450"
|
||||
x:Class="Ursa.Demo.Pages.ThemeTogglerDemo">
|
||||
<Grid ColumnDefinitions="Auto, *">
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Text="Global"></TextBlock>
|
||||
<u:ThemeToggleButton/>
|
||||
<TextBlock Text="Global Indicator"></TextBlock>
|
||||
<u:ThemeToggleButton Mode="Indicator"/>
|
||||
<TextBlock Text="Target To Scope"></TextBlock>
|
||||
<u:ThemeToggleButton TargetScope="{Binding #scope}"></u:ThemeToggleButton>
|
||||
</StackPanel>
|
||||
<ThemeVariantScope Grid.Column="1" Name="scope" RequestedThemeVariant="Dark">
|
||||
<Border Theme="{DynamicResource CardBorder}">
|
||||
<StackPanel>
|
||||
<Button Content="Hello World"></Button>
|
||||
<Calendar></Calendar>
|
||||
<u:ThemeToggleButton></u:ThemeToggleButton>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</ThemeVariantScope>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Pages/ThemeTogglerDemo.axaml.cs
Normal file
13
demo/Ursa.Demo/Pages/ThemeTogglerDemo.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class ThemeTogglerDemo : UserControl
|
||||
{
|
||||
public ThemeTogglerDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
67
demo/Ursa.Demo/Pages/TimeBoxDemo.axaml
Normal file
67
demo/Ursa.Demo/Pages/TimeBoxDemo.axaml
Normal file
@@ -0,0 +1,67 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.TimeBoxDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="clr-namespace:Ursa.Demo.ViewModels;assembly=Ursa.Demo"
|
||||
x:DataType="vm:TimeBoxDemoViewModel"
|
||||
x:CompileBindings="True"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<StackPanel HorizontalAlignment="Left">
|
||||
<ToggleButton
|
||||
Name="format"
|
||||
Margin="0,0,0,10"
|
||||
Content="Show Leading Zeroes" />
|
||||
<ToggleButton
|
||||
Name="allowDrag"
|
||||
Margin="0,0,0,10"
|
||||
Content="Allow Drag" />
|
||||
<ToggleButton
|
||||
Name="isTimeLoop"
|
||||
Margin="0,0,0,50"
|
||||
Content="Is Time Loop" />
|
||||
<TextBlock Classes="" Text="Normal" />
|
||||
<u:TimeBox
|
||||
Name="box"
|
||||
Width="200"
|
||||
ShowLeadingZero="{Binding #format.IsChecked}"
|
||||
AllowDrag="{Binding #allowDrag.IsChecked}"
|
||||
IsTimeLoop="{Binding #isTimeLoop.IsChecked}"/>
|
||||
|
||||
<TextBlock Text="Time: " />
|
||||
<TextBlock Text="{Binding #box.Time}" />
|
||||
<TextBlock Classes="" Text="Fast input" />
|
||||
<u:TimeBox
|
||||
Width="200"
|
||||
InputMode="Fast"
|
||||
ShowLeadingZero="{Binding #format.IsChecked}"
|
||||
AllowDrag="{Binding #allowDrag.IsChecked}"
|
||||
IsTimeLoop="{Binding #isTimeLoop.IsChecked}"/>
|
||||
|
||||
<TextBlock Classes="" Text="Drag Vertical" />
|
||||
<u:TimeBox
|
||||
Width="200"
|
||||
InputMode="Fast"
|
||||
ShowLeadingZero="{Binding #format.IsChecked}"
|
||||
AllowDrag="{Binding #allowDrag.IsChecked}"
|
||||
IsTimeLoop="{Binding #isTimeLoop.IsChecked}"
|
||||
DragOrientation="Vertical"/>
|
||||
|
||||
<TextBlock Classes="" Text="Binding From Source" />
|
||||
<RepeatButton Command="{Binding ChangeRandomTimeCommand}" Content="Random" />
|
||||
<u:TimeBox
|
||||
Width="200"
|
||||
Time="{Binding TimeSpan}"
|
||||
ShowLeadingZero="{Binding #format.IsChecked}"
|
||||
AllowDrag="{Binding #allowDrag.IsChecked}"
|
||||
IsTimeLoop="{Binding #isTimeLoop.IsChecked}"/>
|
||||
<TextBlock Classes="" Text="Disabled" />
|
||||
<u:TimeBox Width="200" IsEnabled="False" Time="{Binding TimeSpan}"
|
||||
AllowDrag="{Binding #allowDrag.IsChecked}"
|
||||
IsTimeLoop="{Binding #isTimeLoop.IsChecked}"/>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Pages/TimeBoxDemo.axaml.cs
Normal file
13
demo/Ursa.Demo/Pages/TimeBoxDemo.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class TimeBoxDemo : UserControl
|
||||
{
|
||||
public TimeBoxDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
46
demo/Ursa.Demo/Pages/TimePickerDemo.axaml
Normal file
46
demo/Ursa.Demo/Pages/TimePickerDemo.axaml
Normal file
@@ -0,0 +1,46 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.TimePickerDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<StackPanel HorizontalAlignment="Left">
|
||||
<ToggleSwitch Name="needConfirm" Content="Need Confirm" />
|
||||
<TextBlock Text="{Binding #picker.SelectedTime}" />
|
||||
<TextBox
|
||||
Name="displayFormat"
|
||||
Width="300"
|
||||
InnerLeftContent="Display Format"
|
||||
Text="HH 时 mm 分 ss 秒" />
|
||||
<TextBox
|
||||
Name="panelFormat"
|
||||
Width="300"
|
||||
InnerLeftContent="Panel Format"
|
||||
Text="tt HH mm ss" />
|
||||
<u:TimePicker
|
||||
Name="picker"
|
||||
Width="200"
|
||||
HorizontalAlignment="Left"
|
||||
DisplayFormat="{Binding #displayFormat.Text}"
|
||||
NeedConfirmation="{Binding #needConfirm.IsChecked}"
|
||||
PanelFormat="{Binding #panelFormat.Text}" />
|
||||
|
||||
<u:TimePicker
|
||||
Width="300"
|
||||
HorizontalAlignment="Left"
|
||||
Classes="ClearButton"
|
||||
DisplayFormat="{Binding #displayFormat.Text}"
|
||||
InnerLeftContent="时刻"
|
||||
InnerRightContent="截止"
|
||||
NeedConfirmation="True"
|
||||
PanelFormat="{Binding #panelFormat.Text}" />
|
||||
<u:TimeRangePicker
|
||||
Width="300"
|
||||
DisplayFormat="{Binding #displayFormat.Text}"
|
||||
PanelFormat="{Binding #panelFormat.Text}" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Pages/TimePickerDemo.axaml.cs
Normal file
13
demo/Ursa.Demo/Pages/TimePickerDemo.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class TimePickerDemo : UserControl
|
||||
{
|
||||
public TimePickerDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -4,55 +4,84 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:selectors="clr-namespace:Ursa.Demo.TemplateSelectors"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:viewModels="clr-namespace:Ursa.Demo.ViewModels"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:CompileBindings="False"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="viewModels:TimelineDemoViewModel"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<u:TimelineFormatConverter x:Key="FormatConverter" />
|
||||
<ResourceDictionary>
|
||||
<selectors:TimelineIconTemplateSelector x:Key="IconSelector" >
|
||||
<SolidColorBrush x:Key="Default" Color="{DynamicResource SemiGray6Color}"></SolidColorBrush>
|
||||
<SolidColorBrush x:Key="Ongoing" Color="{DynamicResource SemiBlue6Color}"></SolidColorBrush>
|
||||
<SolidColorBrush x:Key="Success" Color="{DynamicResource SemiGreen6Color}"></SolidColorBrush>
|
||||
<SolidColorBrush x:Key="Warning" Color="{DynamicResource SemiOrange6Color}"></SolidColorBrush>
|
||||
<SolidColorBrush x:Key="Error" Color="{DynamicResource SemiRed6Color}"></SolidColorBrush>
|
||||
</selectors:TimelineIconTemplateSelector>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<StackPanel>
|
||||
<u:Timeline>
|
||||
<u:TimelineItem
|
||||
Content="Start"
|
||||
ItemType="Warning"
|
||||
Time="2022-01-01" />
|
||||
<u:TimelineItem
|
||||
Content="In between"
|
||||
ItemType="Ongoing"
|
||||
Time="2022-01-02" />
|
||||
<u:TimelineItem
|
||||
Content="Finished"
|
||||
ItemType="Error"
|
||||
Time="2022-01-03" />
|
||||
<u:TimelineItem
|
||||
Content="Finished"
|
||||
IconForeground="Yellow"
|
||||
ItemType="Default"
|
||||
Time="2022-01-03" />
|
||||
<WrapPanel>
|
||||
<u:Timeline
|
||||
Mode="Alternate"
|
||||
HorizontalAlignment="Left"
|
||||
ContentMemberBinding="{ReflectionBinding Description}"
|
||||
HeaderMemberBinding="{ReflectionBinding Header}"
|
||||
IconMemberBinding="{ReflectionBinding ItemType}"
|
||||
IconTemplate="{StaticResource IconSelector}"
|
||||
ItemsSource="{Binding Items}"
|
||||
TimeMemberBinding="{ReflectionBinding Time}" >
|
||||
|
||||
</u:Timeline>
|
||||
<u:Timeline HorizontalAlignment="Left" ItemsSource="{Binding Items}">
|
||||
<u:Timeline.ItemTemplate>
|
||||
<DataTemplate x:DataType="viewModels:TimelineItemViewModel">
|
||||
<u:TimelineItem
|
||||
Content="{Binding Content}"
|
||||
ItemType="{Binding ItemType}"
|
||||
Time="{Binding Time}"
|
||||
TimeFormat="{Binding TimeFormat}">
|
||||
<u:TimelineItem.ContentTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock
|
||||
MaxWidth="100"
|
||||
Text="{Binding}"
|
||||
TextWrapping="Wrap" />
|
||||
</DataTemplate>
|
||||
</u:TimelineItem.ContentTemplate>
|
||||
</u:TimelineItem>
|
||||
</DataTemplate>
|
||||
</u:Timeline.ItemTemplate>
|
||||
<u:Timeline
|
||||
Mode="Left"
|
||||
HorizontalAlignment="Left"
|
||||
ContentMemberBinding="{ReflectionBinding Description}"
|
||||
HeaderMemberBinding="{ReflectionBinding Header}"
|
||||
IconMemberBinding="{ReflectionBinding ItemType}"
|
||||
IconTemplate="{StaticResource IconSelector}"
|
||||
ItemsSource="{Binding Items}"
|
||||
TimeMemberBinding="{ReflectionBinding Time}" >
|
||||
</u:Timeline>
|
||||
</StackPanel>
|
||||
<u:Timeline
|
||||
Mode="Right"
|
||||
HorizontalAlignment="Left"
|
||||
ContentMemberBinding="{ReflectionBinding Description}"
|
||||
HeaderMemberBinding="{ReflectionBinding Header}"
|
||||
IconMemberBinding="{ReflectionBinding ItemType}"
|
||||
IconTemplate="{StaticResource IconSelector}"
|
||||
ItemsSource="{Binding Items}"
|
||||
TimeMemberBinding="{ReflectionBinding Time}" >
|
||||
</u:Timeline>
|
||||
<u:Timeline HorizontalAlignment="Left" Mode="Alternate">
|
||||
<u:TimelineItem
|
||||
Content="Step 1"
|
||||
Header="第一步"
|
||||
Position="Left"
|
||||
Type="Default" />
|
||||
<u:TimelineItem
|
||||
Content="Step 2"
|
||||
Header="第二步"
|
||||
Position="Right"
|
||||
Type="Success" />
|
||||
<u:TimelineItem
|
||||
Content="Step 3"
|
||||
Header="第三步"
|
||||
Position="Separate"
|
||||
Type="Warning" />
|
||||
<u:TimelineItem
|
||||
Content="Step 4"
|
||||
Header="第四步"
|
||||
Position="Separate"
|
||||
Type="Ongoing" />
|
||||
<u:TimelineItem
|
||||
Content="Step 5"
|
||||
Header="第五步"
|
||||
Position="Separate"
|
||||
TimeFormat="yyyy-MM-dd"
|
||||
Type="Error" />
|
||||
</u:Timeline>
|
||||
</WrapPanel>
|
||||
</UserControl>
|
||||
|
||||
141
demo/Ursa.Demo/Pages/ToolBarDemo.axaml
Normal file
141
demo/Ursa.Demo/Pages/ToolBarDemo.axaml
Normal file
@@ -0,0 +1,141 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.ToolBarDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:template="using:Ursa.Demo.Converters"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="using:Ursa.Demo.ViewModels"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="vm:ToolBarDemoViewModel"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<StreamGeometry x:Key="BoldGlyph">M13.5,15.5H10V12.5H13.5A1.5,1.5 0 0,1 15,14A1.5,1.5 0 0,1 13.5,15.5M10,6.5H13A1.5,1.5 0 0,1 14.5,8A1.5,1.5 0 0,1 13,9.5H10M15.6,10.79C16.57,10.11 17.25,9 17.25,8C17.25,5.74 15.5,4 13.25,4H7V18H14.04C16.14,18 17.75,16.3 17.75,14.21C17.75,12.69 16.89,11.39 15.6,10.79Z</StreamGeometry>
|
||||
<StreamGeometry x:Key="ItalicGlyph">M10,4V7H12.21L8.79,15H6V18H14V15H11.79L15.21,7H18V4H10Z</StreamGeometry>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid ColumnDefinitions="Auto, Auto, *" RowDefinitions="Auto, Auto, *">
|
||||
<u:EnumSelector Name="Orientation" EnumType="Orientation" />
|
||||
<u:ToolBar
|
||||
DockPanel.Dock="Top"
|
||||
Header="Hello World"
|
||||
Orientation="{Binding #Orientation.Value}">
|
||||
<Button u:ToolBar.OverflowMode="Never" Content="Button 1" />
|
||||
<u:ToolBarSeparator />
|
||||
<TextBox Width="100" VerticalAlignment="Center"></TextBox>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<RadioButton Content="A" VerticalAlignment="Center"></RadioButton>
|
||||
<RadioButton Content="B" VerticalAlignment="Center"></RadioButton>
|
||||
</StackPanel>
|
||||
<Button u:ToolBar.OverflowMode="AsNeeded" Content="Button 2" />
|
||||
<Button u:ToolBar.OverflowMode="AsNeeded" Content="Button 3" />
|
||||
<ToggleButton Content="Toggle" />
|
||||
<u:ToolBar.Styles>
|
||||
<Style Selector="u|ToolBar[Orientation=Vertical]">
|
||||
<Setter Property="Grid.Row" Value="1" />
|
||||
<Setter Property="Grid.Column" Value="1" />
|
||||
<Setter Property="Grid.RowSpan" Value="2" />
|
||||
<Setter Property="Grid.ColumnSpan" Value="1" />
|
||||
</Style>
|
||||
<Style Selector="u|ToolBar[Orientation=Horizontal]">
|
||||
<Setter Property="Grid.Row" Value="1" />
|
||||
<Setter Property="Grid.Column" Value="1" />
|
||||
<Setter Property="Grid.RowSpan" Value="1" />
|
||||
<Setter Property="Grid.ColumnSpan" Value="3" />
|
||||
</Style>
|
||||
</u:ToolBar.Styles>
|
||||
</u:ToolBar>
|
||||
<u:ToolBar
|
||||
DockPanel.Dock="Top"
|
||||
ItemsSource="{Binding Items}"
|
||||
Orientation="{Binding #Orientation.Value}">
|
||||
<u:ToolBar.ItemTemplate>
|
||||
<template:ToolBarItemTemplateSelector />
|
||||
</u:ToolBar.ItemTemplate>
|
||||
<u:ToolBar.Styles>
|
||||
<Style Selector="u|ToolBar[Orientation=Vertical]">
|
||||
<Setter Property="Grid.Row" Value="1" />
|
||||
<Setter Property="Grid.Column" Value="0" />
|
||||
<Setter Property="Grid.RowSpan" Value="2" />
|
||||
<Setter Property="Grid.ColumnSpan" Value="1" />
|
||||
</Style>
|
||||
<Style Selector="u|ToolBar[Orientation=Horizontal]">
|
||||
<Setter Property="Grid.Row" Value="0" />
|
||||
<Setter Property="Grid.Column" Value="1" />
|
||||
<Setter Property="Grid.RowSpan" Value="1" />
|
||||
<Setter Property="Grid.ColumnSpan" Value="3" />
|
||||
</Style>
|
||||
</u:ToolBar.Styles>
|
||||
</u:ToolBar>
|
||||
<Grid
|
||||
Grid.Row="2"
|
||||
Grid.Column="2"
|
||||
RowDefinitions="Auto, *">
|
||||
<u:ToolBar Margin="16">
|
||||
<ToggleButton Name="bold">
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{DynamicResource BoldGlyph}" />
|
||||
</ToggleButton>
|
||||
<ToggleButton Name="italic">
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{DynamicResource ItalicGlyph}" />
|
||||
</ToggleButton>
|
||||
<u:ToolBarSeparator />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="8,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Text="Font Size" />
|
||||
<ComboBox
|
||||
Name="size"
|
||||
Width="90"
|
||||
SelectedIndex="0">
|
||||
<x:Double>8</x:Double>
|
||||
<x:Double>16</x:Double>
|
||||
<x:Double>32</x:Double>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
<u:ToolBar.Styles>
|
||||
<Style Selector="u|ToolBar[Orientation=Horizontal]">
|
||||
<Setter Property="Grid.Row" Value="2" />
|
||||
<Setter Property="Grid.Column" Value="1" />
|
||||
<Setter Property="Grid.RowSpan" Value="1" />
|
||||
<Setter Property="Grid.ColumnSpan" Value="3" />
|
||||
</Style>
|
||||
</u:ToolBar.Styles>
|
||||
|
||||
</u:ToolBar>
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Classes.Bold="{Binding #bold.IsChecked}"
|
||||
Classes.Italic="{Binding #italic.IsChecked}"
|
||||
FontSize="{Binding #size.SelectedItem}"
|
||||
Text="Hello Ursa Avalonia">
|
||||
<TextBlock.Styles>
|
||||
<Style Selector="TextBlock">
|
||||
<Setter Property="FontWeight" Value="Regular" />
|
||||
<Setter Property="FontSize" Value="8" />
|
||||
<Setter Property="FontStyle" Value="Normal" />
|
||||
</Style>
|
||||
<Style Selector="TextBlock.Bold">
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
</Style>
|
||||
<Style Selector="TextBlock.Italic">
|
||||
<Setter Property="FontStyle" Value="Italic" />
|
||||
</Style>
|
||||
</TextBlock.Styles>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Pages/ToolBarDemo.axaml.cs
Normal file
13
demo/Ursa.Demo/Pages/ToolBarDemo.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class ToolBarDemo : UserControl
|
||||
{
|
||||
public ToolBarDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
62
demo/Ursa.Demo/Pages/TreeComboBoxDemo.axaml
Normal file
62
demo/Ursa.Demo/Pages/TreeComboBoxDemo.axaml
Normal file
@@ -0,0 +1,62 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.TreeComboBoxDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="clr-namespace:Ursa.Demo.ViewModels"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="vm:TreeComboBoxDemoViewModel"
|
||||
mc:Ignorable="d">
|
||||
<StackPanel>
|
||||
<u:TreeComboBox Width="300" HorizontalAlignment="Left">
|
||||
<u:TreeComboBoxItem Header="Hello">
|
||||
<u:TreeComboBoxItem Header="Hello World">
|
||||
<u:TreeComboBoxItem Header="Hello World 1" />
|
||||
<u:TreeComboBoxItem Header="Hello World 2" />
|
||||
<u:TreeComboBoxItem Header="Hello World 3" />
|
||||
</u:TreeComboBoxItem>
|
||||
<u:TreeComboBoxItem Header="Hello Avalonia" />
|
||||
<u:TreeComboBoxItem Header="Hello Another" />
|
||||
</u:TreeComboBoxItem>
|
||||
<u:TreeComboBoxItem Header="World">
|
||||
<u:TreeComboBoxItem Header="World Hello" />
|
||||
<u:TreeComboBoxItem Header="World Avalonia" />
|
||||
<u:TreeComboBoxItem Header="World Another" />
|
||||
</u:TreeComboBoxItem>
|
||||
</u:TreeComboBox>
|
||||
<u:TreeComboBox
|
||||
Width="300"
|
||||
Watermark="Please select an item. "
|
||||
HorizontalAlignment="Left"
|
||||
SelectedItem="{Binding SelectedItem}"
|
||||
ItemsSource="{Binding Items}">
|
||||
<u:TreeComboBox.ItemTemplate>
|
||||
<TreeDataTemplate ItemsSource="{Binding Children}">
|
||||
<TextBlock Text="{Binding ItemName}" />
|
||||
</TreeDataTemplate>
|
||||
</u:TreeComboBox.ItemTemplate>
|
||||
</u:TreeComboBox>
|
||||
|
||||
<u:TreeComboBox
|
||||
Classes="clearButton"
|
||||
Width="300"
|
||||
Watermark="Please select an item. "
|
||||
HorizontalAlignment="Left"
|
||||
SelectedItem="{Binding SelectedItem}"
|
||||
InnerRightContent="Right"
|
||||
InnerLeftContent="Left"
|
||||
PopupInnerTopContent="Top"
|
||||
PopupInnerBottomContent="Bottom"
|
||||
ItemsSource="{Binding Items}">
|
||||
<u:TreeComboBox.ItemTemplate>
|
||||
<TreeDataTemplate ItemsSource="{Binding Children}">
|
||||
<TextBlock Text="{Binding ItemName}" />
|
||||
</TreeDataTemplate>
|
||||
</u:TreeComboBox.ItemTemplate>
|
||||
</u:TreeComboBox>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Pages/TreeComboBoxDemo.axaml.cs
Normal file
13
demo/Ursa.Demo/Pages/TreeComboBoxDemo.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class TreeComboBoxDemo : UserControl
|
||||
{
|
||||
public TreeComboBoxDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
18
demo/Ursa.Demo/Pages/TwoTonePathIconDemo.axaml
Normal file
18
demo/Ursa.Demo/Pages/TwoTonePathIconDemo.axaml
Normal file
@@ -0,0 +1,18 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Ursa.Demo.Pages.TwoTonePathIconDemo">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Size"></TextBlock>
|
||||
<Slider Name="width" Minimum="0" Maximum="100" Value="20" Width="300"></Slider>
|
||||
<ToggleSwitch Name="active" Content="Active"></ToggleSwitch>
|
||||
<u:TwoTonePathIcon
|
||||
IsActive="{Binding ElementName=active, Path=IsChecked}"
|
||||
Width="{Binding #width.Value}"
|
||||
Height="{Binding #width.Value}"
|
||||
Data="M12 3L2 12H5V20H19V12H22L12 3M13 18H11V16H13V18M13 14H11V8H13V14Z"/>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Pages/TwoTonePathIconDemo.axaml.cs
Normal file
13
demo/Ursa.Demo/Pages/TwoTonePathIconDemo.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class TwoTonePathIconDemo : UserControl
|
||||
{
|
||||
public TwoTonePathIconDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
18
demo/Ursa.Demo/Pages/VerificationCodeDemo.axaml
Normal file
18
demo/Ursa.Demo/Pages/VerificationCodeDemo.axaml
Normal file
@@ -0,0 +1,18 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="using:Ursa.Demo.ViewModels"
|
||||
xmlns:system="clr-namespace:System;assembly=System.Runtime"
|
||||
x:DataType="vm:VerificationCodeDemoViewModel"
|
||||
x:CompileBindings="True"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Ursa.Demo.Pages.VerificationCodeDemo">
|
||||
<StackPanel>
|
||||
<u:VerificationCode Count="4" Name="v4" CompleteCommand="{Binding CompleteCommand}"/>
|
||||
<u:VerificationCode Count="4" Mode="Digit" DataValidationErrors.Errors="{Binding Error}"/>
|
||||
<u:VerificationCode Count="4" Mode="Letter"/>
|
||||
<u:VerificationCode Count="6" PasswordChar="•" Complete="VerificationCode_OnComplete" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
21
demo/Ursa.Demo/Pages/VerificationCodeDemo.axaml.cs
Normal file
21
demo/Ursa.Demo/Pages/VerificationCodeDemo.axaml.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Ursa.Controls;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class VerificationCodeDemo : UserControl
|
||||
{
|
||||
public VerificationCodeDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private async void VerificationCode_OnComplete(object? sender, VerificationCodeCompleteEventArgs e)
|
||||
{
|
||||
var text = string.Join(string.Empty, e.Code);
|
||||
await MessageBox.ShowOverlayAsync(text);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Shapes;
|
||||
using Avalonia.Controls.Templates;
|
||||
using Avalonia.Media;
|
||||
using Ursa.Controls;
|
||||
|
||||
namespace Ursa.Demo.TemplateSelectors;
|
||||
|
||||
public class TimelineIconTemplateSelector: ResourceDictionary, IDataTemplate
|
||||
{
|
||||
|
||||
public Control? Build(object? param)
|
||||
{
|
||||
if (param is TimelineItemType t)
|
||||
{
|
||||
string s = t.ToString();
|
||||
if (ContainsKey(s))
|
||||
{
|
||||
object? o = this[s];
|
||||
if (o is SolidColorBrush c)
|
||||
{
|
||||
var ellipse = new Ellipse() { Width = 12, Height = 12, Fill = c };
|
||||
return ellipse;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool Match(object? data)
|
||||
{
|
||||
return data is TimelineItemType;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<AvaloniaUseCompiledBindingsByDefault>false</AvaloniaUseCompiledBindingsByDefault>
|
||||
@@ -18,12 +18,22 @@
|
||||
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.1.0" />
|
||||
<PackageReference Include="Semi.Avalonia" Version="11.0.0" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.0" />
|
||||
<PackageReference Include="Semi.Avalonia" Version="11.0.7" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Ursa.Themes.Semi\Ursa.Themes.Semi.csproj" />
|
||||
<ProjectReference Include="..\..\src\Ursa\Ursa.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Pages\SkeletonDemo.axaml.cs">
|
||||
<DependentUpon>SkeletonDemo.axaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
41
demo/Ursa.Demo/ViewModels/BreadcrumbDemoViewModel.cs
Normal file
41
demo/Ursa.Demo/ViewModels/BreadcrumbDemoViewModel.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Input;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Ursa.Controls;
|
||||
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
public class BreadcrumbDemoViewModel: ObservableObject
|
||||
{
|
||||
public ObservableCollection<BreadcrumbDemoItem> Items1 { get; set; }
|
||||
|
||||
public BreadcrumbDemoViewModel()
|
||||
{
|
||||
Items1 = new ObservableCollection<BreadcrumbDemoItem>()
|
||||
{
|
||||
new BreadcrumbDemoItem() { Section = "Home", Icon = "Home" },
|
||||
new BreadcrumbDemoItem() { Section = "Page 1", Icon = "Page" },
|
||||
new BreadcrumbDemoItem() { Section = "Page 2", Icon = "Page" },
|
||||
new BreadcrumbDemoItem() { Section = "Page 3", Icon = "Page" },
|
||||
new BreadcrumbDemoItem() { Section = "Page 4", Icon = "Page", IsReadOnly = true},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public partial class BreadcrumbDemoItem: ObservableObject
|
||||
{
|
||||
public string Section { get; set; }
|
||||
public string Icon { get; set; }
|
||||
[ObservableProperty] private bool _isReadOnly;
|
||||
|
||||
public ICommand Command { get; set; }
|
||||
|
||||
public BreadcrumbDemoItem()
|
||||
{
|
||||
Command = new RelayCommand(() =>
|
||||
{
|
||||
MessageBox.ShowOverlayAsync(Section);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,35 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Ursa.Controls;
|
||||
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
public class ButtonGroupDemoViewModel: ViewModelBase
|
||||
{
|
||||
public ObservableCollection<string> Items { get; set; } = new ()
|
||||
public ObservableCollection<ButtonItem> Items { get; set; } = new ()
|
||||
{
|
||||
"Ding", "Otter", "Husky", "Mr. 17", "Cass"
|
||||
new ButtonItem(){Name = "Ding" },
|
||||
new ButtonItem(){Name = "Otter" },
|
||||
new ButtonItem(){Name = "Husky" },
|
||||
new ButtonItem(){Name = "Mr. 17" },
|
||||
new ButtonItem(){Name = "Cass" },
|
||||
};
|
||||
}
|
||||
|
||||
public class ButtonItem
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
public ICommand InvokeCommand { get; set; }
|
||||
|
||||
public ButtonItem()
|
||||
{
|
||||
InvokeCommand = new AsyncRelayCommand(Invoke);
|
||||
}
|
||||
|
||||
private async Task Invoke()
|
||||
{
|
||||
await MessageBox.ShowAsync("Hello " + Name);
|
||||
}
|
||||
}
|
||||
8
demo/Ursa.Demo/ViewModels/ClassInputDemoViewModel.cs
Normal file
8
demo/Ursa.Demo/ViewModels/ClassInputDemoViewModel.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
public class ClassInputDemoViewModel: ObservableObject
|
||||
{
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user