Skip to content

Commit

Permalink
[#39571] pinned window min width
Browse files Browse the repository at this point in the history
  • Loading branch information
Kharonus committed Nov 4, 2021
1 parent 0e274f1 commit 592a8ae
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/OpenProject.Browser/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace OpenProject.Browser.ViewModels
/// </summary>
public sealed class MainWindowViewModel
{
private const double _windowMinWidth = 800.00;
private const double _windowMinWidth = 320.00;

/// <summary>
/// The view of the nested bcfier panel.
Expand All @@ -19,7 +19,12 @@ public sealed class MainWindowViewModel
/// <summary>
/// The main window calculated width.
/// </summary>
public double Width => Math.Max(_windowMinWidth, SystemParameters.PrimaryScreenHeight * 0.25);
public double MinWidth => _windowMinWidth;

/// <summary>
/// The main window calculated width.
/// </summary>
public double Width => Math.Max(_windowMinWidth, SystemParameters.PrimaryScreenWidth * 0.33);

/// <summary>
/// The main window default height.
Expand Down
3 changes: 3 additions & 0 deletions src/OpenProject.Browser/Views/MainWindowView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ public MainWindowView(MainWindowViewModel viewModel, JavaScriptBridge javaScript
{
DataContext = viewModel;

var primaryScreenHeight = SystemParameters.PrimaryScreenHeight;

// We have to set layout here, as the layout in wpf doesn't work with bindings at runtime.
Width = viewModel.Width;
MinWidth = viewModel.MinWidth;
Height = viewModel.Height;
Top = viewModel.Top;
Left = viewModel.Left;
Expand Down
Binary file not shown.

0 comments on commit 592a8ae

Please sign in to comment.