Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix binding errors while open a dialog #181

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Exmaple2.0/Exmaple2.0.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.5" />
<PackageReference Include="Avalonia.Diagnostics" Version="11.0.5" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.5" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.5" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.5" />
<PackageReference Include="Avalonia" Version="11.0.7" />
<PackageReference Include="Avalonia.Diagnostics" Version="11.0.7" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.7" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.7" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.7" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion MsBox.Avalonia/Controls/MsBoxCustomView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ public partial class MsBoxCustomView : UserControl, IFullApi<string>, ISetCloseA
private string _buttonResult;
private Action _closeAction;

public MsBoxCustomView()
public MsBoxCustomView(AbstractMsBoxViewModel viewModel)
{
this.DataContext = viewModel;
InitializeComponent();
}

Expand Down
3 changes: 2 additions & 1 deletion MsBox.Avalonia/Controls/MsBoxStandardView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ public partial class MsBoxStandardView : UserControl, IFullApi<ButtonResult>, IS
private ButtonResult _buttonResult = ButtonResult.None;
private Action _closeAction;

public MsBoxStandardView()
public MsBoxStandardView(AbstractMsBoxViewModel viewModel)
{
this.DataContext = viewModel;
InitializeComponent();
}

Expand Down
10 changes: 2 additions & 8 deletions MsBox.Avalonia/MessageBoxManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,14 @@ public static class MessageBoxManager
public static IMsBox<string> GetMessageBoxCustom(MessageBoxCustomParams @params)
{
var msBoxCustomViewModel = new MsBoxCustomViewModel(@params);
var msBoxCustomView = new MsBoxCustomView
{
DataContext = msBoxCustomViewModel
};
var msBoxCustomView = new MsBoxCustomView(msBoxCustomViewModel);
return new MsBox<MsBoxCustomView, MsBoxCustomViewModel, string>(msBoxCustomView, msBoxCustomViewModel);
}

public static IMsBox<ButtonResult> GetMessageBoxStandard(MessageBoxStandardParams @params)
{
var msBoxStandardViewModel = new MsBoxStandardViewModel(@params);
var msBoxStandardView = new MsBoxStandardView
{
DataContext = msBoxStandardViewModel
};
var msBoxStandardView = new MsBoxStandardView(msBoxStandardViewModel);
return new MsBox<MsBoxStandardView, MsBoxStandardViewModel, ButtonResult>(msBoxStandardView,
msBoxStandardViewModel);
}
Expand Down
4 changes: 2 additions & 2 deletions MsBox.Avalonia/MsBox.Avalonia.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<PackageVersion>3.1.5.1</PackageVersion>
Expand Down Expand Up @@ -26,7 +26,7 @@
<AvaloniaResource Include="Assets\*" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.5" />
<PackageReference Include="Avalonia" Version="11.0.7" />
<PackageReference Include="DialogHost.Avalonia" Version="0.7.7" />
<PackageReference Include="Markdown.Avalonia.Tight" Version="11.0.2" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions MsBox.Avalonia/MsBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public Task<T> ShowWindowAsync()
{
_viewModel.SetFullApi(_view);
var window = new MsBoxWindow();
window.Content = _view;
window.DataContext = _viewModel;
window.Content = _view;
window.Closed += _view.CloseWindow;

var tcs = new TaskCompletionSource<T>();
Expand All @@ -80,8 +80,8 @@ public Task<T> ShowWindowDialogAsync(Window owner)
{
_viewModel.SetFullApi(_view);
var window = new MsBoxWindow();
window.Content = _view;
window.DataContext = _viewModel;
window.Content = _view;
window.Closed += _view.CloseWindow;
var tcs = new TaskCompletionSource<T>();

Expand Down