FZ Editor support for small screens

This commit is contained in:
Enrico Giordani 2019-10-22 09:34:31 +02:00
parent 123999febd
commit 425a418599
2 changed files with 26 additions and 7 deletions

View File

@ -1,4 +1,5 @@
<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"
@ -6,10 +7,11 @@
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">
@ -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>
@ -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"
@ -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>

View File

@ -27,6 +27,24 @@ namespace FancyZonesEditor
{
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)