Merge pull request #65 from irihitech/avalonia-preview5
Migrate to Avalonia preview5
This commit is contained in:
commit
b243d3270f
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using Avalonia;
|
||||
using Avalonia.Dialogs;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace Semi.Avalonia.Demo.Desktop;
|
||||
@ -26,7 +27,8 @@ class Program
|
||||
// Avalonia configuration, don't remove; also used by visual designer.
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
=> AppBuilder.Configure<App>()
|
||||
.UseManagedSystemDialogs()
|
||||
.UsePlatformDetect()
|
||||
.With(new Win32PlatformOptions(){ UseCompositor = false})
|
||||
.With(new Win32PlatformOptions())
|
||||
.LogToTrace();
|
||||
}
|
||||
|
@ -11,9 +11,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview5" />
|
||||
<!--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 Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.999-cibuild0029384-beta" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -4,7 +4,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Semi.Avalonia.Demo.Web">
|
||||
<Application.Styles>
|
||||
<FluentTheme Mode="Light" />
|
||||
<FluentTheme />
|
||||
<StyleInclude Source="avares://Semi.Avalonia/Themes/LightTheme.axaml" />
|
||||
</Application.Styles>
|
||||
</Application>
|
@ -1,25 +1,17 @@
|
||||
using System.Runtime.Versioning;
|
||||
using Avalonia;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Web;
|
||||
using Semi.Avalonia.Demo.Web;
|
||||
using Avalonia.Browser;
|
||||
|
||||
[assembly: SupportedOSPlatform("browser")]
|
||||
|
||||
internal partial class Program
|
||||
{
|
||||
private static void Main(string[] args) => BuildAvaloniaApp()
|
||||
.With(new FontManagerOptions
|
||||
{
|
||||
FontFallbacks = new[]
|
||||
{
|
||||
new FontFallback
|
||||
{
|
||||
FontFamily = new FontFamily("avares://Semi.Avalonia.Demo.Web/Assets/SourceHanSansCN-Regular.otf#Source Han Sans CN")
|
||||
}
|
||||
}
|
||||
})
|
||||
.SetupBrowserApp("out");
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
BuildAvaloniaApp().SetupBrowserApp("out");
|
||||
}
|
||||
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
=> AppBuilder.Configure<App>();
|
||||
|
@ -19,8 +19,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.0-preview4" />
|
||||
<PackageReference Include="Avalonia.Web" Version="$(AvaloniaVersion)" />
|
||||
<PackageReference Include="Avalonia.Browser" Version="11.0.0-preview5" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.0-preview5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -3,7 +3,6 @@
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:dialogs="clr-namespace:Avalonia.Dialogs;assembly=Avalonia.Dialogs"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
|
@ -21,7 +21,8 @@ public partial class ManagedFileChooserDemo : UserControl
|
||||
|
||||
private async void OpenFileDialog(object sender, RoutedEventArgs args)
|
||||
{
|
||||
IStorageProvider sp = GetStorageProvider();
|
||||
IStorageProvider? sp = GetStorageProvider();
|
||||
if (sp is null) return;
|
||||
var result = await sp.OpenFilePickerAsync(new FilePickerOpenOptions()
|
||||
{
|
||||
Title = "Open File",
|
||||
@ -31,7 +32,8 @@ public partial class ManagedFileChooserDemo : UserControl
|
||||
}
|
||||
private async void SelectFolderDialog(object sender, RoutedEventArgs args)
|
||||
{
|
||||
IStorageProvider sp = GetStorageProvider();
|
||||
IStorageProvider? sp = GetStorageProvider();
|
||||
if (sp is null) return;
|
||||
var result = await sp.OpenFolderPickerAsync(new FolderPickerOpenOptions()
|
||||
{
|
||||
Title = "Select Folder",
|
||||
@ -40,27 +42,20 @@ public partial class ManagedFileChooserDemo : UserControl
|
||||
}
|
||||
private async void SaveFileDialog(object sender, RoutedEventArgs args)
|
||||
{
|
||||
IStorageProvider sp = GetStorageProvider();
|
||||
IStorageProvider? sp = GetStorageProvider();
|
||||
if (sp is null) return;
|
||||
var result = await sp.SaveFilePickerAsync(new FilePickerSaveOptions()
|
||||
{
|
||||
Title = "Open File",
|
||||
});
|
||||
}
|
||||
|
||||
private IStorageProvider GetStorageProvider()
|
||||
private IStorageProvider? GetStorageProvider()
|
||||
{
|
||||
return new ManagedStorageProvider<Window>(GetWindow(), null);
|
||||
var topLevel = TopLevel.GetTopLevel(this);
|
||||
return topLevel?.StorageProvider;
|
||||
}
|
||||
|
||||
private static string FullPathOrName(IStorageItem? item)
|
||||
{
|
||||
if (item is null) return "(null)";
|
||||
return item.TryGetUri(out var uri) ? uri.ToString() : item.Name;
|
||||
}
|
||||
|
||||
Window GetWindow() => this.VisualRoot as Window ?? throw new NullReferenceException("Invalid Owner");
|
||||
TopLevel GetTopLevel() => this.VisualRoot as TopLevel ?? throw new NullReferenceException("Invalid Owner");
|
||||
|
||||
List<FilePickerFileType>? GetFileTypes()
|
||||
{
|
||||
return new List<FilePickerFileType>
|
||||
|
@ -12,7 +12,7 @@ namespace Semi.Avalonia.Demo.Pages;
|
||||
|
||||
public partial class NotificationDemo : UserControl
|
||||
{
|
||||
private MainWindow? _window;
|
||||
private WindowNotificationManager _manager;
|
||||
public NotificationDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -21,14 +21,15 @@ public partial class NotificationDemo : UserControl
|
||||
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
|
||||
{
|
||||
base.OnAttachedToVisualTree(e);
|
||||
_window = VisualRoot as MainWindow;
|
||||
var topLevel = TopLevel.GetTopLevel(this);
|
||||
_manager = new WindowNotificationManager(topLevel){ MaxItems = 3};
|
||||
}
|
||||
|
||||
private void InfoButton_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is Button b && b.Content is string s && Enum.TryParse<NotificationType>(s, out NotificationType t))
|
||||
{
|
||||
_window?.Notify(t);
|
||||
_manager.Show(new Notification(t.ToString(), "This is message", t));
|
||||
}
|
||||
}
|
||||
}
|
@ -11,9 +11,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="11.0.0-preview4" />
|
||||
<PackageReference Include="Avalonia" Version="11.0.0-preview5" />
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0-preview4" />
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.999-cibuild0029384-beta" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.1.0" />
|
||||
<PackageReference Include="XamlNameReferenceGenerator" Version="1.5.1" />
|
||||
</ItemGroup>
|
||||
|
@ -5,19 +5,8 @@ namespace Semi.Avalonia.Demo.Views;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private readonly WindowNotificationManager _manager;
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
_manager = new WindowNotificationManager(this)
|
||||
{
|
||||
Position = NotificationPosition.TopLeft,
|
||||
MaxItems = 3
|
||||
};
|
||||
}
|
||||
|
||||
internal void Notify(NotificationType t)
|
||||
{
|
||||
_manager.Show(new Notification(t.ToString(), "This is a notification message", t));
|
||||
}
|
||||
}
|
@ -3,19 +3,18 @@
|
||||
<ControlTheme x:Key="{x:Type Carousel}" TargetType="Carousel">
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<Border
|
||||
<ScrollViewer
|
||||
Name="PART_ScrollViewer"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<CarouselPresenter
|
||||
HorizontalScrollBarVisibility="Hidden"
|
||||
VerticalScrollBarVisibility="Hidden">
|
||||
<ItemsPresenter
|
||||
Name="PART_ItemsPresenter"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
IsVirtualized="{TemplateBinding IsVirtualized}"
|
||||
Items="{TemplateBinding Items}"
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}"
|
||||
PageTransition="{TemplateBinding PageTransition}"
|
||||
SelectedIndex="{TemplateBinding SelectedIndex}" />
|
||||
</Border>
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||
</ScrollViewer>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</ControlTheme>
|
||||
|
@ -120,10 +120,7 @@
|
||||
<ItemsPresenter
|
||||
Name="PART_ItemsPresenter"
|
||||
Margin="{DynamicResource ComboBoxDropdownContentMargin}"
|
||||
ItemTemplate="{TemplateBinding ItemTemplate}"
|
||||
Items="{TemplateBinding Items}"
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}"
|
||||
VirtualizationMode="{TemplateBinding VirtualizationMode}" />
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Popup>
|
||||
|
@ -27,8 +27,6 @@
|
||||
<ItemsPresenter
|
||||
Name="PART_ItemsPresenter"
|
||||
Grid.IsSharedSizeScope="True"
|
||||
ItemTemplate="{TemplateBinding ItemTemplate}"
|
||||
Items="{TemplateBinding Items}"
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}"
|
||||
KeyboardNavigation.TabNavigation="Continue" />
|
||||
</ScrollViewer>
|
||||
|
@ -5,7 +5,6 @@
|
||||
<Setter Property="MinWidth" Value="296" />
|
||||
<Setter Property="MaxHeight" Value="300" />
|
||||
<Setter Property="FontWeight" Value="Normal" />
|
||||
<Setter Property="FontWeight" Value="Normal" />
|
||||
<Setter Property="Background" Value="White" />
|
||||
<Setter Property="CornerRadius" Value="6" />
|
||||
<Setter Property="Template">
|
||||
|
@ -8,11 +8,7 @@
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<ItemsPresenter
|
||||
Name="PART_ItemsPresenter"
|
||||
ItemTemplate="{TemplateBinding ItemTemplate}"
|
||||
Items="{TemplateBinding Items}"
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||
<ItemsPresenter Name="PART_ItemsPresenter" ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
@ -30,10 +30,7 @@
|
||||
<ItemsPresenter
|
||||
Name="PART_ItemsPresenter"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
ItemTemplate="{TemplateBinding ItemTemplate}"
|
||||
Items="{TemplateBinding Items}"
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}"
|
||||
VirtualizationMode="{TemplateBinding VirtualizationMode}" />
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
|
@ -1,7 +1,8 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:dialogs="clr-namespace:Avalonia.Dialogs;assembly=Avalonia.Dialogs">
|
||||
xmlns:dialogs="clr-namespace:Avalonia.Dialogs;assembly=Avalonia.Dialogs"
|
||||
xmlns:internal="clr-namespace:Avalonia.Dialogs.Internal;assembly=Avalonia.Dialogs">
|
||||
<!-- Add Resources Here -->
|
||||
<Design.PreviewWith>
|
||||
<Border
|
||||
@ -12,11 +13,11 @@
|
||||
</Border>
|
||||
</Design.PreviewWith>
|
||||
|
||||
<dialogs:ResourceSelectorConverter x:Key="Icons">
|
||||
<internal:ResourceSelectorConverter x:Key="Icons">
|
||||
<PathGeometry x:Key="Icon_Folder">M19,20H4C2.89,20 2,19.1 2,18V6C2,4.89 2.89,4 4,4H10L12,6H19A2,2 0 0,1 21,8H21L4,8V18L6.14,10H23.21L20.93,18.5C20.7,19.37 19.92,20 19,20Z</PathGeometry>
|
||||
<PathGeometry x:Key="Icon_File">M13,9H18.5L13,3.5V9M6,2H14L20,8V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V4C4,2.89 4.89,2 6,2M15,18V16H6V18H15M18,14V12H6V14H18Z</PathGeometry>
|
||||
<PathGeometry x:Key="Icon_Volume">M6,2H18A2,2 0 0,1 20,4V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2M12,4A6,6 0 0,0 6,10C6,13.31 8.69,16 12.1,16L11.22,13.77C10.95,13.29 11.11,12.68 11.59,12.4L12.45,11.9C12.93,11.63 13.54,11.79 13.82,12.27L15.74,14.69C17.12,13.59 18,11.9 18,10A6,6 0 0,0 12,4M12,9A1,1 0 0,1 13,10A1,1 0 0,1 12,11A1,1 0 0,1 11,10A1,1 0 0,1 12,9M7,18A1,1 0 0,0 6,19A1,1 0 0,0 7,20A1,1 0 0,0 8,19A1,1 0 0,0 7,18M12.09,13.27L14.58,19.58L17.17,18.08L12.95,12.77L12.09,13.27Z</PathGeometry>
|
||||
</dialogs:ResourceSelectorConverter>
|
||||
</internal:ResourceSelectorConverter>
|
||||
<ControlTheme x:Key="{x:Type dialogs:ManagedFileChooser}" TargetType="dialogs:ManagedFileChooser">
|
||||
<Setter Property="dialogs:ManagedFileChooser.Template">
|
||||
<ControlTemplate TargetType="dialogs:ManagedFileChooser">
|
||||
@ -169,7 +170,7 @@
|
||||
<TextBlock.Text>
|
||||
<Binding Path="Size">
|
||||
<Binding.Converter>
|
||||
<dialogs:FileSizeStringConverter />
|
||||
<internal:FileSizeStringConverter />
|
||||
</Binding.Converter>
|
||||
</Binding>
|
||||
</TextBlock.Text>
|
||||
|
@ -196,8 +196,6 @@
|
||||
<ItemsPresenter
|
||||
Name="PART_ItemsPresenter"
|
||||
Grid.IsSharedSizeScope="True"
|
||||
ItemTemplate="{TemplateBinding ItemTemplate}"
|
||||
Items="{TemplateBinding Items}"
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
@ -299,8 +297,6 @@
|
||||
<ItemsPresenter
|
||||
Name="PART_ItemsPresenter"
|
||||
Grid.IsSharedSizeScope="True"
|
||||
ItemTemplate="{TemplateBinding ItemTemplate}"
|
||||
Items="{TemplateBinding Items}"
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
@ -343,8 +339,6 @@
|
||||
<ItemsPresenter
|
||||
Name="PART_ItemsPresenter"
|
||||
VerticalAlignment="Stretch"
|
||||
ItemTemplate="{TemplateBinding ItemTemplate}"
|
||||
Items="{TemplateBinding Items}"
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}"
|
||||
KeyboardNavigation.TabNavigation="Continue" />
|
||||
</Border>
|
||||
|
@ -36,8 +36,6 @@
|
||||
Name="PART_ItemsPresenter"
|
||||
Margin="{DynamicResource MenuFlyoutScrollerMargin}"
|
||||
Grid.IsSharedSizeScope="True"
|
||||
ItemTemplate="{TemplateBinding ItemTemplate}"
|
||||
Items="{TemplateBinding Items}"
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}"
|
||||
KeyboardNavigation.TabNavigation="Continue" />
|
||||
</ScrollViewer>
|
||||
|
@ -15,11 +15,7 @@
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<DockPanel>
|
||||
<Panel DockPanel.Dock="{TemplateBinding TabStripPlacement}">
|
||||
<ItemsPresenter
|
||||
Name="PART_ItemsPresenter"
|
||||
ItemTemplate="{TemplateBinding ItemTemplate}"
|
||||
Items="{TemplateBinding Items}"
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||
<ItemsPresenter Name="PART_ItemsPresenter" ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||
<Border Name="PART_BorderSeparator" Background="{DynamicResource TabItemLinePipePressedBorderBrush}" />
|
||||
</Panel>
|
||||
<ContentPresenter
|
||||
|
@ -10,11 +10,7 @@
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<Panel>
|
||||
<ItemsPresenter
|
||||
Name="PART_ItemsPresenter"
|
||||
ItemTemplate="{TemplateBinding ItemTemplate}"
|
||||
Items="{TemplateBinding Items}"
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||
<ItemsPresenter Name="PART_ItemsPresenter" ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||
<Border
|
||||
Name="PART_BorderSeparator"
|
||||
Height="1"
|
||||
|
@ -44,7 +44,6 @@
|
||||
<ItemsPresenter
|
||||
Name="PART_ItemsPresenter"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
Items="{TemplateBinding Items}"
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
@ -139,7 +138,6 @@
|
||||
<ItemsPresenter
|
||||
Name="PART_ItemsPresenter"
|
||||
IsVisible="{TemplateBinding IsExpanded}"
|
||||
Items="{TemplateBinding Items}"
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||
</StackPanel>
|
||||
</ControlTemplate>
|
||||
|
@ -3,40 +3,17 @@
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks>
|
||||
<LangVersion>10</LangVersion>
|
||||
<Version>0.1.0-preview3</Version>
|
||||
<Version>0.1.0-preview5-nightly202302010951</Version>
|
||||
<Title>Semi.Avalonia</Title>
|
||||
<Authors>IRIHI Technology</Authors>
|
||||
<Description>Avalonia Theme inspired by Semi Design. </Description>
|
||||
<PackageProjectUrl>https://github.com/irihitech/Semi.Avalonia</PackageProjectUrl>
|
||||
<PackageReleaseNotes>Add new controls:
|
||||
* Slider
|
||||
* GridSplitter
|
||||
* Carousel
|
||||
* Popup
|
||||
* Tabstrip
|
||||
* Timepicker
|
||||
* DatePicker
|
||||
* Canlendar
|
||||
* CalendarDatePicker
|
||||
* CaptionButtons
|
||||
* TitleBar
|
||||
* SplitView
|
||||
* ManagedFileChooser
|
||||
* DropdownButton
|
||||
* SplitButton
|
||||
|
||||
Fixes:
|
||||
* Fix TextBox and AutoComplete Padding
|
||||
* Fix Button default color
|
||||
* Fix Menu spacing
|
||||
* Fix various Flyout/Popup CornerRadius
|
||||
|
||||
Msic:
|
||||
* Add default ContextFlyout for TextBox</PackageReleaseNotes>
|
||||
<PackageReleaseNotes>Migrate to Avalonia lately nightly build.
|
||||
Please don't update if you are not using Avalonia latest nightly build. </PackageReleaseNotes>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="11.0.0-preview4" />
|
||||
<PackageReference Include="Avalonia" Version="11.0.0-preview5" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
Loading…
x
Reference in New Issue
Block a user