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" <Controls:MetroWindow x:Class="FancyZonesEditor.MainWindow"
x:Name="MainWindow1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@@ -6,10 +7,11 @@
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:local="clr-namespace:FancyZonesEditor" xmlns:local="clr-namespace:FancyZonesEditor"
mc:Ignorable="d" mc:Ignorable="d"
Title="" Width="810" Title=""
Width="810"
SizeToContent="Height" SizeToContent="Height"
Background="White" Background="White"
ResizeMode="NoResize" ResizeMode="CanMinimize"
WindowStartupLocation="CenterScreen" WindowStartupLocation="CenterScreen"
Loaded="OnLoaded" Loaded="OnLoaded"
Closed="OnClosed"> Closed="OnClosed">
@@ -175,7 +177,6 @@
<TextBlock Name="dialog_Title" Text="Choose your layout" Style="{StaticResource titleText}" /> <TextBlock Name="dialog_Title" Text="Choose your layout" Style="{StaticResource titleText}" />
<TabControl BorderThickness="0" x:Name="TemplateTab"> <TabControl BorderThickness="0" x:Name="TemplateTab">
<TabItem Header="Templates" Template="{StaticResource myTabs}"> <TabItem Header="Templates" Template="{StaticResource myTabs}">
<StackPanel> <StackPanel>
@@ -187,7 +188,7 @@
<ItemsControl ItemsSource="{Binding DefaultModels}" Margin="8,0,0,0"> <ItemsControl ItemsSource="{Binding DefaultModels}" Margin="8,0,0,0">
<ItemsControl.ItemsPanel> <ItemsControl.ItemsPanel>
<ItemsPanelTemplate> <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> </ItemsPanelTemplate>
</ItemsControl.ItemsPanel> </ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>
@@ -234,7 +235,7 @@
<ItemsControl ItemsSource="{Binding CustomModels}" Margin="8,8,0,0"> <ItemsControl ItemsSource="{Binding CustomModels}" Margin="8,8,0,0">
<ItemsControl.ItemsPanel> <ItemsControl.ItemsPanel>
<ItemsPanelTemplate> <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> </ItemsPanelTemplate>
</ItemsControl.ItemsPanel> </ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>

View File

@@ -27,6 +27,24 @@ namespace FancyZonesEditor
{ {
InitializeComponent(); InitializeComponent();
DataContext = _settings; 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) private void DecrementZones_Click(object sender, RoutedEventArgs e)