Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OpenFile, SaveFile, Directory pickers style #622

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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,10 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Orc.Controls">

<Style x:Key="{x:Type controls:DirectoryPicker}"
TargetType="{x:Type controls:DirectoryPicker}">
<Setter Property="Margin" Value="{DynamicResource Margin.TextBox}" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this setter to DefaultDirectoryPickerStyle (See overall comments)

</Style>

</ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<Label Grid.Column="0" Content="{Binding LabelText}" Width="{Binding LabelWidth}" />
<TextBox Grid.Column="1" IsReadOnly="True" Text="{Binding SelectedDirectory}" />
<Label Grid.Column="0" Content="{Binding LabelText}" Width="{Binding LabelWidth}" Margin="3,0,3,0" VerticalAlignment="Center"/>
<TextBox Grid.Column="1" IsReadOnly="True" Text="{Binding SelectedDirectory}" Margin="0,0,4,0"/>

<Button Grid.Column="2" Margin="0,6,2,6" Width="24" Content="..."
<Button Grid.Column="2" Margin="0" Width="24" Content="..."
ToolTip="{catel:LanguageBinding Controls_BrowseForFile}"
Command="{Binding SelectDirectory}" />

<Button Grid.Column="3" Margin="2,6,2,6" Width="24" ToolTip="{catel:LanguageBinding Controls_OpenFolder}"
<Button Grid.Column="3" Margin="4,0,2,0" Width="24" ToolTip="{catel:LanguageBinding Controls_OpenFolder}"
Command="{Binding OpenDirectory}"
Visibility="{Binding SelectedDirectory, Converter={catel:EmptyStringToCollapsingVisibilityConverter}}">
<Image Source="/Orc.Controls;component/Resources/Images/Folder.png" Width="16" Height="16" />
</Button>

<Button Grid.Column="4" Margin="2,6,0,6" Width="24" ToolTip="{catel:LanguageBinding Controls_Clear}"
<Button Grid.Column="4" Margin="2,0,0,0" Width="24" ToolTip="{catel:LanguageBinding Controls_Clear}"
Command="{Binding Clear}" Visibility="{Binding SelectedDirectory, Converter={catel:EmptyStringToCollapsingVisibilityConverter}}">
<Image Source="/Orc.Controls;component/Resources/Images/Delete.png" Width="16" Height="16" />
</Button>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Orc.Controls">

<Style x:Key="{x:Type controls:OpenFilePicker}"
TargetType="{x:Type controls:OpenFilePicker}">
<Setter Property="Margin" Value="{DynamicResource Margin.TextBox}" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this setter to DefaultOpenFilePickerStyle (See overall comments)

</Style>

</ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,29 @@

<Label Grid.Column="0"
Content="{Binding LabelText}"
Width="{Binding LabelWidth}" />
Width="{Binding LabelWidth}"
VerticalAlignment="Center"
Margin="0"/>

<TextBox AutomationProperties.AutomationId="{x:Static automation:OpenFilePickerMap.SelectedFileTextBoxId}"
Grid.Column="1"
IsReadOnly="True"
Text="{Binding SelectedFileDisplayName, Mode=OneWay}"
Height="{Binding ElementName=OpenFileButton, Path=ActualHeight}"/>
Height="{Binding ElementName=OpenFileButton, Path=ActualHeight}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove it (and also remove it from other pickers, if they have it too) Binding to sizes 95% in cases is wrong solution. I understand that maybe it's not your code, but as long as we noticed it - we should get rid of it: please try to remove it or use VerticalAlignment=Stretch -> whatever will work

Margin="0,0,4,0"/>

<Button x:Name="OpenFileButton"
AutomationProperties.AutomationId="{x:Static automation:OpenFilePickerMap.OpenFileButtonId}"
Grid.Column="2"
Margin="0,6,2,6"
Margin="0"
Width="24"
Content="..."
ToolTip="{catel:LanguageBinding Controls_BrowseForFile}"
Command="{Binding SelectFile}" />

<Button AutomationProperties.AutomationId="{x:Static automation:OpenFilePickerMap.OpenDirectoryButtonId}"
Grid.Column="3"
Margin="2,6,2,6"
Margin="4,0,2,0"
Width="24"
ToolTip="{catel:LanguageBinding Controls_OpenFolder}"
Command="{Binding OpenDirectory}"
Expand All @@ -51,7 +54,7 @@

<Button AutomationProperties.AutomationId="{x:Static automation:OpenFilePickerMap.ClearButtonId}"
Grid.Column="4"
Margin="2,6,0,6"
Margin="2,0,0,0"
Width="24"
ToolTip="{catel:LanguageBinding Controls_Clear}"
Command="{Binding Clear}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
xmlns:controls="clr-namespace:Orc.Controls">

<Style x:Key="{x:Type controls:SaveFilePicker}"
TargetType="{x:Type controls:SaveFilePicker}"/>
TargetType="{x:Type controls:SaveFilePicker}">
<Setter Property="Margin" Value="{DynamicResource Margin.TextBox}" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this setter to DefaultSaveFilePicker (See overall comments)

</Style>

</ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,26 @@

<Label Grid.Column="0"
Content="{Binding LabelText}"
Width="{Binding LabelWidth}" />
Width="{Binding LabelWidth}"
Margin="3,0,3,0"
VerticalAlignment="Center"/>

<TextBox Grid.Column="1"
IsReadOnly="True"
Text="{Binding SelectedFile}"
Height="{Binding ElementName=SaveFileButton, Path=ActualHeight}"/>
Height="{Binding ElementName=SaveFileButton, Path=ActualHeight}"
Margin="0,0,4,0"/>

<Button x:Name="SaveFileButton"
Grid.Column="2"
Margin="0,6,2,6"
Margin="0"
Width="24"
Content="..."
ToolTip="{catel:LanguageBinding Controls_BrowseForFile}"
Command="{Binding SelectFile}" />

<Button Grid.Column="3"
Margin="2,6,2,6"
Margin="4,0,2,0"
Width="24"
ToolTip="{catel:LanguageBinding Controls_OpenFolder}"
Command="{Binding OpenDirectory}"
Expand All @@ -48,7 +51,7 @@
</Button>

<Button Grid.Column="4"
Margin="2,6,0,6"
Margin="2,0,0,0"
Width="24"
ToolTip="{catel:LanguageBinding Controls_Clear}"
Command="{Binding Clear}"
Expand Down
6 changes: 5 additions & 1 deletion src/Orc.Controls/Themes/Generic.generated.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Orc.Controls" xmlns:catel="http://schemas.catelproject.com" xmlns:automation="clr-namespace:Orc.Controls.Automation" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:converters="clr-namespace:Orc.Controls.Converters" xmlns:xamlbehaviors="http://schemas.microsoft.com/xaml/behaviors" xmlns:orctheming="http://schemas.wildgums.com/orc/theming">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Orc.Theming;component/themes/generic.xaml" />
<ResourceDictionary Source="/Orc.Controls;component/Controls/DirectoryPicker/Themes/DirectoryPicker.generic.xaml" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks as it something wrong with generated xaml

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should not be merged dictionaries ...because generated.xaml itself solves a problem with merged dictionaries

<ResourceDictionary Source="/Orc.Controls;component/Controls/OpenFilePicker/Themes/OpenFilePicker.generic.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style x:Key="{x:Type local:AlignmentGrid}" TargetType="{x:Type local:AlignmentGrid}" />
<Style x:Key="{x:Type local:AnimatedGif}" TargetType="{x:Type local:AnimatedGif}" />
Expand Down Expand Up @@ -58,7 +60,6 @@
</Setter.Value>
</Setter>
</Style>
<Style x:Key="{x:Type local:SaveFilePicker}" TargetType="{x:Type local:SaveFilePicker}" />
<Geometry x:Key="RectangleGeometry">M4,2L20,2C21.1,2 22,2.9 22,4L22,20C22,21.1 21.1,22 20,22L4,22C2.9,22 2,21.1 2,20L2,4C2,2.9 2.9,2 4,2ZM4,4L4,20L20,20L20,4L4,4ZM13,15L11,15L11,17L13,17L13,15ZM13,7L11,7L11,13L13,13L13,7Z</Geometry>
<Geometry x:Key="TriangleGeometry">M2,21.9997L12,2.00026L20.6247,19.2199L20.6291,19.2199L22,21.9997L22,21.9997L22,21.9997L2,21.9997ZM5.0287,19.9997L18.9638,19.9997L12,6.11526L5.0287,19.9997ZM12.9376,16.5456L11.2947,16.5456L11.2947,18.2081L12.9376,18.2081L12.9376,16.5456ZM12.9376,11.5581L11.2947,11.5581L11.2947,14.8831L12.9376,14.8831L12.9376,11.5581Z</Geometry>
<Geometry x:Key="ArrowsOutGeometry">M9.5,13.09L10.91,14.5L6.41,19H10V21H3V14H5V17.59L9.5,13.09M10.91,9.5L9.5,10.91L5,6.41V10H3V3H10V5H6.41L10.91,9.5M14.5,13.09L19,17.59V14H21V21H14V19H17.59L13.09,14.5L14.5,13.09M13.09,9.5L17.59,5H14V3H21V10H19V6.41L14.5,10.91L13.09,9.5Z</Geometry>
Expand Down Expand Up @@ -1481,6 +1482,9 @@
</Setter.Value>
</Setter>
</Style>
<Style x:Key="{x:Type local:SaveFilePicker}" TargetType="{x:Type local:SaveFilePicker}">
<Setter Property="Margin" Value="{DynamicResource Margin.TextBox}" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also strange...Margin should be only on Default***Style

</Style>
<Style x:Key="{x:Type local:SpinButton}" TargetType="{x:Type local:SpinButton}" BasedOn="{StaticResource Orc.Styles.Control}">
<Setter Property="Template">
<Setter.Value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
<ResourceDictionary Source="/Orc.Controls;component/Controls/ColorLegend/Themes/ColorLegend.generic.xaml" />
<ResourceDictionary Source="/Orc.Controls;component/Controls/ColorPicker/Themes/ColorPicker.generic.xaml" />
<ResourceDictionary Source="/Orc.Controls;component/Controls/DateTimePicker/Themes/DateTimePicker.generic.xaml" />
<ResourceDictionary Source="/Orc.Controls;component/Controls/DirectoryPicker/Themes/DirectoryPicker.generic.xaml" />
<ResourceDictionary Source="/Orc.Controls;component/Controls/DropDownButton/Themes/DropDownButton.generic.xaml" />
<ResourceDictionary Source="/Orc.Controls;component/Controls/Expander/Themes/Expander.generic.xaml" />
<ResourceDictionary Source="/Orc.Controls;component/Controls/FilterBox/Themes/FilterBox.generic.xaml" />
<ResourceDictionary Source="/Orc.Controls;component/Controls/FluidProgressBar/Themes/FluidProgressBar.generic.xaml" />
<ResourceDictionary Source="/Orc.Controls;component/Controls/FluidProgressBar/Themes/FluidProgressBar.generic.xaml" />
<ResourceDictionary Source="/Orc.Controls;component/Controls/FontImage/Themes/FontImage.generic.xaml" />
<ResourceDictionary Source="/Orc.Controls;component/Controls/OpenFilePicker/Themes/OpenFilePicker.generic.xaml" />
<ResourceDictionary Source="/Orc.Controls;component/Controls/SaveFilePicker/Themes/SaveFilePicker.generic.xaml" />
<ResourceDictionary Source="/Orc.Controls;component/Controls/HeaderBar/Themes/HeaderBar.generic.xaml" />
<ResourceDictionary Source="/Orc.Controls;component/Controls/LinkLabel/Themes/LinkLabel.generic.xaml" />
Expand Down