Skip to content

Commit

Permalink
Dialogs try fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Frédéric Larivé committed Nov 10, 2023
1 parent 26eab05 commit 381655c
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 18 deletions.
3 changes: 1 addition & 2 deletions Neumorphism.Avalonia.Demo/Interfaces/IMainWindowState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ public interface IMainWindowState
{
int CurrentPageIndex { get; set; }
}
}

}
8 changes: 4 additions & 4 deletions Neumorphism.Avalonia.Demo/ViewModels/DialogsDemoViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -452,13 +452,13 @@ private async IAsyncEnumerable<string> 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[]
{
Expand Down
26 changes: 14 additions & 12 deletions Neumorphism.Avalonia.Demo/Windows/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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">


Expand Down Expand Up @@ -81,21 +83,21 @@
</StackPanel>


<!--<DataTemplate x:Key="TestCustomWindow" DataType="models:DialogSampleModel">
<StackPanel Orientation="Vertical">
<DataTemplate x:Key="TestCustomWindow">
<StackPanel Orientation="Vertical" DataContext="">
<TextBlock Margin="0,15,0,0" TextAlignment="Center">Your lucky number:</TextBlock>
<TextBlock Classes="Body1"
<TextBlock Classes="Body1" Background="Yellow"
TextAlignment="Center"
Text="{Binding Number}"/>
Text="{Binding $self.Number, RelativeSource={RelativeSource AncestorType={local:MainWindow}}, FallbackValue=none}"/>
</StackPanel>
</DataTemplate>-->
</DataTemplate>

<StackPanel x:Key="TestCustomWindow" Orientation="Vertical">
<!--<StackPanel x:Key="TestCustomWindow2" Orientation="Vertical">
<TextBlock Margin="0,15,0,0" TextAlignment="Center">Your lucky number:</TextBlock>
<TextBlock Classes="Body1"
<TextBlock Classes="Body1" Background="Yellow"
TextAlignment="Center"
Text="{Binding CurrentPageIndex}"/>
</StackPanel>
Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=viewModels:ApplicationModelBase}, Path=Number, FallbackValue=none}"/>
</StackPanel>-->



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public bool IsDialogOpened





public ApplicationModelBase(IThemeSwitch themeSwitch)
{
AboutEnabled = true;
Expand Down
16 changes: 16 additions & 0 deletions Neumorphism.Avalonia.Demo/Windows/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@ internal sealed class MainViewModel<TWindow> : 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)
{
Expand Down

0 comments on commit 381655c

Please sign in to comment.