-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
base: develop
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<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}"> | ||
</Style> | ||
|
||
</ResourceDictionary> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,20 +17,31 @@ | |
<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}" VerticalAlignment="Center"> | ||
<Label.Style> | ||
<Style TargetType="Label"> | ||
<Style.Triggers> | ||
<DataTrigger Binding="{Binding LabelText, Converter={catel:EmptyStringToCollapsingVisibilityConverter}}"> | ||
<Setter Property="Width" Value="0"/> | ||
<Setter Property="Margin" Value="0"/> | ||
</DataTrigger> | ||
</Style.Triggers> | ||
</Style> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please re-style the code |
||
</Label.Style> | ||
</Label> | ||
<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> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<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}"> | ||
</Style> | ||
|
||
</ResourceDictionary> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ public OpenFilePicker() | |
} | ||
|
||
#region Properties | ||
[ObsoleteEx(Message = "This property will be deprecated", TreatAsErrorFromVersion ="4.9.0", RemoveInVersion = "6.0.0")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TreatAsErrorFromVersion ="5.0.0" |
||
[ViewToViewModel(MappingType = ViewToViewModelMappingType.TwoWayViewWins)] | ||
public double LabelWidth | ||
{ | ||
|
@@ -33,9 +34,11 @@ public double LabelWidth | |
} | ||
|
||
// Using a DependencyProperty as the backing store for LabelWidth. This enables animation, styling, binding, etc... | ||
[ObsoleteEx(Message = "This property will be deprecated", TreatAsErrorFromVersion ="4.9.0", RemoveInVersion = "6.0.0")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TreatAsErrorFromVersion ="5.0.0" |
||
public static readonly DependencyProperty LabelWidthProperty = DependencyProperty.Register(nameof(LabelWidth), | ||
typeof(double), typeof(OpenFilePicker), new PropertyMetadata(125d)); | ||
typeof(double), typeof(OpenFilePicker), new PropertyMetadata(0d)); | ||
|
||
[ObsoleteEx(Message = "This property will be deprecated", TreatAsErrorFromVersion ="4.9.0", RemoveInVersion = "6.0.0")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TreatAsErrorFromVersion ="5.0.0" |
||
[ViewToViewModel(MappingType = ViewToViewModelMappingType.TwoWayViewWins)] | ||
public string LabelText | ||
{ | ||
|
@@ -44,6 +47,7 @@ public string LabelText | |
} | ||
|
||
// Using a DependencyProperty as the backing store for LabelText. This enables animation, styling, binding, etc... | ||
[ObsoleteEx(Message = "This property will be deprecated", TreatAsErrorFromVersion ="4.9.0", RemoveInVersion = "6.0.0")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TreatAsErrorFromVersion ="5.0.0" |
||
public static readonly DependencyProperty LabelTextProperty = DependencyProperty.Register(nameof(LabelText), | ||
typeof(string), typeof(OpenFilePicker), new PropertyMetadata(string.Empty)); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,24 +24,27 @@ public SaveFilePicker() | |
InitializeComponent(); | ||
} | ||
|
||
[ObsoleteEx(Message = "This property will be deprecated", TreatAsErrorFromVersion ="4.9.0", RemoveInVersion = "6.0.0")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TreatAsErrorFromVersion ="5.0.0" |
||
[ViewToViewModel(MappingType = ViewToViewModelMappingType.TwoWayViewWins)] | ||
public double LabelWidth | ||
{ | ||
get { return (double)GetValue(LabelWidthProperty); } | ||
set { SetValue(LabelWidthProperty, value); } | ||
} | ||
|
||
[ObsoleteEx(Message = "This property will be deprecated", TreatAsErrorFromVersion ="4.9.0", RemoveInVersion = "6.0.0")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TreatAsErrorFromVersion ="5.0.0" |
||
public static readonly DependencyProperty LabelWidthProperty = DependencyProperty.Register(nameof(LabelWidth), typeof(double), | ||
typeof(SaveFilePicker), new PropertyMetadata(125d)); | ||
|
||
typeof(SaveFilePicker), new PropertyMetadata(0d)); | ||
|
||
[ObsoleteEx(Message = "This property will be deprecated", TreatAsErrorFromVersion ="4.9.0", RemoveInVersion = "6.0.0")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TreatAsErrorFromVersion ="5.0.0" |
||
[ViewToViewModel(MappingType = ViewToViewModelMappingType.TwoWayViewWins)] | ||
public string LabelText | ||
{ | ||
get { return (string)GetValue(LabelTextProperty); } | ||
set { SetValue(LabelTextProperty, value); } | ||
} | ||
|
||
[ObsoleteEx(Message = "This property will be deprecated", TreatAsErrorFromVersion ="4.9.0", RemoveInVersion = "6.0.0")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TreatAsErrorFromVersion ="5.0.0" |
||
public static readonly DependencyProperty LabelTextProperty = DependencyProperty.Register(nameof(LabelText), typeof(string), | ||
typeof(SaveFilePicker), new PropertyMetadata(string.Empty)); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks as it something wrong with generated xaml There was a problem hiding this comment. Choose a reason for hiding this commentThe 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}" /> | ||
|
@@ -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> | ||
|
@@ -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}" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does the trigger works without Value property specified? (Same in other cases)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer not to use DataTrigger...why not use Content property and simple Trigger? (but as for me it's not critical as long as it would be deprecated)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another one: what if LabelWidth would be 0 -> what kind of margin it would be?