diff --git a/demo/Sandbox/ViewModels/MainWindowViewModel.cs b/demo/Sandbox/ViewModels/MainWindowViewModel.cs index d7998a1..2fe691b 100644 --- a/demo/Sandbox/ViewModels/MainWindowViewModel.cs +++ b/demo/Sandbox/ViewModels/MainWindowViewModel.cs @@ -5,26 +5,5 @@ namespace Sandbox.ViewModels; public partial class MainWindowViewModel : ViewModelBase { - public ObservableCollection Items { get; set; } - - public MainWindowViewModel() - { - Items = new ObservableCollection() - { - new DataGridItem() { Name = "John Doe", Age = 42 }, - new DataGridItem() { Name = "Jane Doe", Age = 39 }, - new DataGridItem() { Name = "Sammy Doe", Age = 13 }, - new DataGridItem() { Name = "Barry Doe", Age = 7 }, - new DataGridItem() { Name = "Molly Doe", Age = 5 }, - }; - } - -} - -public class DataGridItem -{ - public string? Name { get; set; } - public int Age { get; set; } - public IPAddress? Address { get; set; } } \ No newline at end of file diff --git a/demo/Sandbox/Views/MainWindow.axaml b/demo/Sandbox/Views/MainWindow.axaml index a4db4ff..6293b8e 100644 --- a/demo/Sandbox/Views/MainWindow.axaml +++ b/demo/Sandbox/Views/MainWindow.axaml @@ -7,19 +7,28 @@ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Sandbox.Views.MainWindow" x:DataType="vm:MainWindowViewModel" - xmlns:sys="using:System" Icon="/Assets/avalonia-logo.ico" Title="Sandbox"> - - - - - - - + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/demo/Sandbox/Views/MainWindow.axaml.cs b/demo/Sandbox/Views/MainWindow.axaml.cs index 937a796..f2cdeb4 100644 --- a/demo/Sandbox/Views/MainWindow.axaml.cs +++ b/demo/Sandbox/Views/MainWindow.axaml.cs @@ -13,6 +13,13 @@ public partial class MainWindow : Window private async void Button_OnClick(object? sender, RoutedEventArgs e) { - var res = await OverlayDialog.ShowModal(new TextBlock() { Text = "sdfksjdl" }, "root"); + if (content.Content is int s) + { + content.Content = 1.1; + } + else + { + content.Content = 1; + } } } \ No newline at end of file diff --git a/demo/Sandbox/Views/PW.axaml b/demo/Sandbox/Views/PW.axaml deleted file mode 100644 index 48b31a9..0000000 --- a/demo/Sandbox/Views/PW.axaml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/demo/Sandbox/Views/PW.axaml.cs b/demo/Sandbox/Views/PW.axaml.cs deleted file mode 100644 index 0cc6d85..0000000 --- a/demo/Sandbox/Views/PW.axaml.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.IO; -using Avalonia; -using Avalonia.Controls; -using Avalonia.Interactivity; -using Avalonia.Markup.Xaml; -using Irihi.Avalonia.Shared.Contracts; -using Sandbox.ViewModels; -using Ursa.Controls; - -namespace Sandbox.Views; - -public partial class PW : UserControl -{ - public PW() - { - InitializeComponent(); - _overlayDialogHost.HostId = _hostid; - } - - private string _hostid = Path.GetRandomFileName(); - - private async void Button_OnClick(object? sender, RoutedEventArgs e) - { - Drawer.ShowCustom(new PW(), new TestVM(), _hostid); - } - - private void Close(object? sender, RoutedEventArgs e) - { - (DataContext as TestVM)?.Close(); - } -} - -public class TestVM : ViewModelBase, IDialogContext -{ - public void Close() - { - RequestClose?.Invoke(this, 12456789); - } - - public event EventHandler? RequestClose; -} \ No newline at end of file diff --git a/src/Ursa/Controls/Breadcrumb/Breadcrumb.cs b/src/Ursa/Controls/Breadcrumb/Breadcrumb.cs index 9ad968c..6d426e2 100644 --- a/src/Ursa/Controls/Breadcrumb/Breadcrumb.cs +++ b/src/Ursa/Controls/Breadcrumb/Breadcrumb.cs @@ -73,8 +73,21 @@ public class Breadcrumb: ItemsControl static Breadcrumb() { ItemsPanelProperty.OverrideDefaultValue(_defaultPanel); + SeparatorProperty.Changed.AddClassHandler((b, args) => b.OnSeparatorChanged(args)); } - + + private void OnSeparatorChanged(AvaloniaPropertyChangedEventArgs args) + { + if (GetSeparatorInstance(Separator) is { } a) + { + var breadcrumbItems = this.GetVisualDescendants().OfType().ToList(); + foreach (var item in breadcrumbItems) + { + item.Separator = a; + } + } + } + protected override bool NeedsContainerOverride(object? item, int index, out object? recycleKey) { return NeedsContainer(item, out recycleKey); @@ -94,11 +107,6 @@ public class Breadcrumb: ItemsControl { breadcrumbItem.Separator = a; } - SeparatorProperty.Changed.AddClassHandler((_, args) => - { - if (GetSeparatorInstance(args.NewValue.Value) is { } b) - breadcrumbItem.Separator = b; - }); } if (container == item) return;