Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Windows;
using System.Windows.Data;
using FancyZonesEditor.Models;

namespace FancyZonesEditor.Converters
{
public class LayoutModelTypeToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return value is CanvasLayoutModel ? Visibility.Collapsed : Visibility.Visible;
}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return null;
}
}
}
20 changes: 14 additions & 6 deletions src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
ResizeMode="CanResize">
<Window.Resources>

<Converters:LayoutModelTypeToVisibilityConverter x:Key="LayoutModelTypeToVisibilityConverter" />

<DataTemplate x:Key="MonitorItemTemplate">
<Border x:Name="MonitorItem"
Width="{Binding DisplayWidth}"
Expand Down Expand Up @@ -153,20 +155,23 @@
Orientation="Vertical">
<ui:ToggleSwitch x:Name="spaceAroundSetting"
Header="{x:Static props:Resources.Show_Space_Zones}"
IsOn="true" />
IsOn="true"
Visibility="{Binding Converter={StaticResource LayoutModelTypeToVisibilityConverter}}"/>

<TextBlock x:Name="paddingValue"
Text="{x:Static props:Resources.Space_Around_Zones}"
IsEnabled="{Binding ShowSpacing}"
Margin="0,8,0,0"
Foreground="{DynamicResource PrimaryForegroundBrush}" />
Foreground="{DynamicResource PrimaryForegroundBrush}"
Visibility="{Binding Converter={StaticResource LayoutModelTypeToVisibilityConverter}}"/>

<TextBox Margin="0,6,0,0"
IsEnabled="{Binding ShowSpacing}"
Text="32"
Width="86"
HorizontalAlignment="Left"
AutomationProperties.LabeledBy="{Binding ElementName=paddingValue}" />
AutomationProperties.LabeledBy="{Binding ElementName=paddingValue}"
Visibility="{Binding Converter={StaticResource LayoutModelTypeToVisibilityConverter}}"/>

<TextBlock Text="{x:Static props:Resources.Distance_adjacent_zones}"
IsEnabled="{Binding ShowSpacing}"
Expand Down Expand Up @@ -323,20 +328,23 @@
Orientation="Vertical">
<ui:ToggleSwitch x:Name="spaceAroundSetting"
Header="{x:Static props:Resources.Show_Space_Zones}"
IsOn="true" />
IsOn="true"
Visibility="{Binding Converter={StaticResource LayoutModelTypeToVisibilityConverter}}"/>

<TextBlock x:Name="paddingValue"
Text="{x:Static props:Resources.Space_Around_Zones}"
IsEnabled="{Binding ShowSpacing}"
Margin="0,8,0,0"
Foreground="{DynamicResource PrimaryForegroundBrush}" />
Foreground="{DynamicResource PrimaryForegroundBrush}"
Visibility="{Binding Converter={StaticResource LayoutModelTypeToVisibilityConverter}}" />

<TextBox Margin="0,6,0,0"
IsEnabled="{Binding ShowSpacing}"
Text="32"
Width="86"
HorizontalAlignment="Left"
AutomationProperties.LabeledBy="{Binding ElementName=paddingValue}" />
AutomationProperties.LabeledBy="{Binding ElementName=paddingValue}"
Visibility="{Binding Converter={StaticResource LayoutModelTypeToVisibilityConverter}}"/>

<TextBlock Text="{x:Static props:Resources.Distance_adjacent_zones}"
IsEnabled="{Binding ShowSpacing}"
Expand Down