mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-18 06:29:44 +08:00
FancyZonesEditor: open a tab with the selected layout on startup (#715)
This commit is contained in:
parent
0082f56b58
commit
cb13cfdda7
@ -1,4 +1,4 @@
|
||||
<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:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
@ -18,6 +18,7 @@
|
||||
<Window.Resources>
|
||||
<local:BooleanToBrushConverter x:Key="BooleanToBrushConverter" />
|
||||
<local:ModelToVisibilityConverter x:Key="ModelToVisibilityConverter" />
|
||||
<local:BooleanToIntConverter x:Key="BooleanToIntConverter" />
|
||||
|
||||
<Style x:Key="titleText" TargetType="TextBlock">
|
||||
<Setter Property="FontFamily" Value="Segoe UI" />
|
||||
@ -176,8 +177,8 @@
|
||||
<StackPanel>
|
||||
|
||||
<TextBlock Name="dialog_Title" Text="Choose your layout" Style="{StaticResource titleText}" />
|
||||
|
||||
<TabControl BorderThickness="0" x:Name="TemplateTab">
|
||||
|
||||
<TabControl BorderThickness="0" x:Name="TemplateTab" SelectedIndex="{Binding IsCustomLayoutActive, Mode=OneWay, Converter={StaticResource BooleanToIntConverter}}">
|
||||
<TabItem Header="Templates" Template="{StaticResource myTabs}">
|
||||
<StackPanel>
|
||||
<StackPanel Margin="0,15,0,8" Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
@ -38,7 +38,8 @@ namespace FancyZonesEditor
|
||||
}
|
||||
|
||||
private int _WrapPanelItemSize = 262;
|
||||
public int WrapPanelItemSize {
|
||||
public int WrapPanelItemSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return _WrapPanelItemSize;
|
||||
@ -238,4 +239,23 @@ namespace FancyZonesEditor
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public class BooleanToIntConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
if (value is bool)
|
||||
{
|
||||
return (bool)value == true ? 1 : 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
if (value is int)
|
||||
{
|
||||
return (int)value == 1;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,21 @@ namespace FancyZonesEditor
|
||||
//
|
||||
public class Settings : INotifyPropertyChanged
|
||||
{
|
||||
public bool IsCustomLayoutActive
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (LayoutModel model in CustomModels)
|
||||
{
|
||||
if (model.IsSelected)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public Settings()
|
||||
{
|
||||
ParseCommandLineArgs();
|
||||
|
Loading…
Reference in New Issue
Block a user