From 381655c17bf6376948dc8bd3cf551e08be907b06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Lariv=C3=A9?= Date: Fri, 10 Nov 2023 17:28:12 +0100 Subject: [PATCH] Dialogs try fix --- .../Interfaces/IMainWindowState.cs | 3 +-- .../ViewModels/DialogsDemoViewModel.cs | 8 +++--- .../Windows/MainWindow.axaml | 26 ++++++++++--------- .../ViewModels/ApplicationModelBase.cs | 2 ++ .../Windows/ViewModels/MainViewModel.cs | 16 ++++++++++++ 5 files changed, 37 insertions(+), 18 deletions(-) diff --git a/Neumorphism.Avalonia.Demo/Interfaces/IMainWindowState.cs b/Neumorphism.Avalonia.Demo/Interfaces/IMainWindowState.cs index 7b7b5c6..35bf119 100644 --- a/Neumorphism.Avalonia.Demo/Interfaces/IMainWindowState.cs +++ b/Neumorphism.Avalonia.Demo/Interfaces/IMainWindowState.cs @@ -4,5 +4,4 @@ public interface IMainWindowState { int CurrentPageIndex { get; set; } } -} - +} \ No newline at end of file diff --git a/Neumorphism.Avalonia.Demo/ViewModels/DialogsDemoViewModel.cs b/Neumorphism.Avalonia.Demo/ViewModels/DialogsDemoViewModel.cs index f90f822..df94843 100644 --- a/Neumorphism.Avalonia.Demo/ViewModels/DialogsDemoViewModel.cs +++ b/Neumorphism.Avalonia.Demo/ViewModels/DialogsDemoViewModel.cs @@ -452,13 +452,13 @@ private async IAsyncEnumerable CreateCustomDialog() var dialog = CustomDialogHelper.CreateCustomDialog(new SampleCustomDialogBuilderParams { ContentHeader = "Welcome to this custom dialog !", - SupportingText = "Following contant is coming from a custom template...", + SupportingText = "Following content is coming from a custom template...", WindowTitle = "Info dialog", DialogHeaderIcon = DialogIconKind.Info, DialogIcon = DialogIconKind.Info, - Content = _window.Resources["TestCustomWindow"], - //ContentTemplate = _window.Resources["TestCustomWindow"] as DataTemplate, - Width = 480, + //Content = _window.Resources["TestCustomWindow"], + ContentTemplate = _window.Resources["TestCustomWindow"] as DataTemplate, + Width = 880, Borderless = true, CenterDialogButtons = new[] { diff --git a/Neumorphism.Avalonia.Demo/Windows/MainWindow.axaml b/Neumorphism.Avalonia.Demo/Windows/MainWindow.axaml index 9f50e09..56d531e 100644 --- a/Neumorphism.Avalonia.Demo/Windows/MainWindow.axaml +++ b/Neumorphism.Avalonia.Demo/Windows/MainWindow.axaml @@ -2,8 +2,9 @@ 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:localcontrols="clr-namespace:Neumorphism.Avalonia.Demo.Controls" - xmlns:viewModels1="clr-namespace:Neumorphism.Avalonia.Demo.Windows.ViewModels" + xmlns:local="clr-namespace:Neumorphism.Avalonia.Demo.Windows" + xmlns:localcontrols="clr-namespace:Neumorphism.Avalonia.Demo.Controls" + xmlns:viewModels="clr-namespace:Neumorphism.Avalonia.Demo.Windows.ViewModels" xmlns:pages="clr-namespace:Neumorphism.Avalonia.Demo.Pages" xmlns:models="clr-namespace:Neumorphism.Avalonia.Demo.Models" xmlns:controls="clr-namespace:Avalonia.Themes.Neumorphism.Controls;assembly=Avalonia.Themes.Neumorphism" @@ -17,7 +18,8 @@ Title="Neumorphism.Avalonia.Demo" Icon="avares://Neumorphism.Avalonia.Demo/Assets/app.ico" x:CompileBindings="True" - x:DataType="viewModels1:ApplicationModelBase" + Name="zzz" + x:DataType="viewModels:ApplicationModelBase" x:Class="Neumorphism.Avalonia.Demo.Windows.MainWindow"> @@ -81,21 +83,21 @@ - + - + diff --git a/Neumorphism.Avalonia.Demo/Windows/ViewModels/ApplicationModelBase.cs b/Neumorphism.Avalonia.Demo/Windows/ViewModels/ApplicationModelBase.cs index 046ca53..97ce0e1 100644 --- a/Neumorphism.Avalonia.Demo/Windows/ViewModels/ApplicationModelBase.cs +++ b/Neumorphism.Avalonia.Demo/Windows/ViewModels/ApplicationModelBase.cs @@ -64,6 +64,8 @@ public bool IsDialogOpened + + public ApplicationModelBase(IThemeSwitch themeSwitch) { AboutEnabled = true; diff --git a/Neumorphism.Avalonia.Demo/Windows/ViewModels/MainViewModel.cs b/Neumorphism.Avalonia.Demo/Windows/ViewModels/MainViewModel.cs index 56554ba..43007fa 100644 --- a/Neumorphism.Avalonia.Demo/Windows/ViewModels/MainViewModel.cs +++ b/Neumorphism.Avalonia.Demo/Windows/ViewModels/MainViewModel.cs @@ -9,6 +9,22 @@ internal sealed class MainViewModel : ApplicationModelBase { private readonly TWindow _window; + + private int _number = 0; + public int Number + { + get { return _number; } + set + { + _number = value; + OnPropertyChanged(nameof(Number)); + } + } + + + + + public MainViewModel(TWindow window) : base(window.ThemeSwitch) {