Skip to content

Commit

Permalink
FZ Editor support for small screens
Browse files Browse the repository at this point in the history
  • Loading branch information
enricogior committed Oct 22, 2019
1 parent 123999f commit 425a418
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<Controls:MetroWindow x:Class="FancyZonesEditor.MainWindow"
x:Name="MainWindow1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:local="clr-namespace:FancyZonesEditor"
mc:Ignorable="d"
Title="" Width="810"
Title=""
Width="810"
SizeToContent="Height"
Background="White"
ResizeMode="NoResize"
ResizeMode="CanMinimize"
WindowStartupLocation="CenterScreen"
Loaded="OnLoaded"
Closed="OnClosed">
Expand Down Expand Up @@ -174,8 +176,7 @@
<StackPanel>

<TextBlock Name="dialog_Title" Text="Choose your layout" Style="{StaticResource titleText}" />



<TabControl BorderThickness="0" x:Name="TemplateTab">
<TabItem Header="Templates" Template="{StaticResource myTabs}">
<StackPanel>
Expand All @@ -187,13 +188,13 @@
<ItemsControl ItemsSource="{Binding DefaultModels}" Margin="8,0,0,0">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" ItemWidth="262" ItemHeight="262" />
<WrapPanel Orientation="Horizontal" ItemWidth="{Binding ElementName=MainWindow1, Mode=OneWay, UpdateSourceTrigger=PropertyChanged, Path=WrapPanelItemSize}" ItemHeight="{Binding ElementName=WrapPanel1, Path=ItemWidth}" x:Name="WrapPanel1" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Margin="8"
BorderBrush="{Binding Path=IsSelected, Converter={StaticResource BooleanToBrushConverter}}"
BorderBrush="{Binding Path=IsSelected, Converter={StaticResource BooleanToBrushConverter}}"
Style="{StaticResource templateBackground}"
MouseDown="LayoutItem_Click">
<DockPanel Margin="0,20,0,0"
Expand Down Expand Up @@ -234,7 +235,7 @@
<ItemsControl ItemsSource="{Binding CustomModels}" Margin="8,8,0,0">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" ItemWidth="262" ItemHeight="262" />
<WrapPanel Orientation="Horizontal" ItemWidth="{Binding ElementName=MainWindow1, Mode=OneWay, UpdateSourceTrigger=PropertyChanged, Path=WrapPanelItemSize}" ItemHeight="{Binding ElementName=WrapPanel2, Path=ItemWidth}" x:Name="WrapPanel2" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
Expand Down
18 changes: 18 additions & 0 deletions src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,24 @@ public MainWindow()
{
InitializeComponent();
DataContext = _settings;
if (_settings.WorkArea.Height < 900)
{
this.SizeToContent = SizeToContent.WidthAndHeight;
this.WrapPanelItemSize = 180;
}
}

private int _WrapPanelItemSize = 262;
public int WrapPanelItemSize {
get
{
return _WrapPanelItemSize;
}

set
{
_WrapPanelItemSize = value;
}
}

private void DecrementZones_Click(object sender, RoutedEventArgs e)
Expand Down

0 comments on commit 425a418

Please sign in to comment.