Skip to content
Open
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,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
Expand Up @@ -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}}">
Copy link
Contributor

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)

Copy link
Contributor

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)

Copy link
Contributor

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?

<Setter Property="Width" Value="0"/>
<Setter Property="Margin" Value="0"/>
</DataTrigger>
</Style.Triggers>
</Style>
Copy link
Contributor

Choose a reason for hiding this comment

The 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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public DirectoryPicker()
InitializeComponent();
}

[ObsoleteEx(Message = "This property will be deprecated", TreatAsErrorFromVersion ="5.0.0", RemoveInVersion = "6.0.0")]
[ViewToViewModel(MappingType = ViewToViewModelMappingType.TwoWayViewWins)]
public double LabelWidth
{
Expand All @@ -30,9 +31,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 ="5.0.0", RemoveInVersion = "6.0.0")]
public static readonly DependencyProperty LabelWidthProperty = DependencyProperty.Register(nameof(LabelWidth),
typeof(double), typeof(DirectoryPicker), new PropertyMetadata(125d));
typeof(double), typeof(DirectoryPicker), new PropertyMetadata(0d));

[ObsoleteEx(Message = "This property will be deprecated", TreatAsErrorFromVersion ="5.0.0", RemoveInVersion = "6.0.0")]
[ViewToViewModel(MappingType = ViewToViewModelMappingType.TwoWayViewWins)]
public string LabelText
{
Expand All @@ -41,6 +44,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 ="5.0.0", RemoveInVersion = "6.0.0")]
public static readonly DependencyProperty LabelTextProperty =
DependencyProperty.Register(nameof(LabelText), typeof(string), typeof(DirectoryPicker), new PropertyMetadata(string.Empty));

Expand Down
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>
24 changes: 18 additions & 6 deletions src/Orc.Controls/Controls/OpenFilePicker/Views/OpenFilePicker.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,38 @@

<Label Grid.Column="0"
Content="{Binding LabelText}"
Width="{Binding LabelWidth}" />
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>
</Label.Style>
</Label>

<TextBox AutomationProperties.AutomationId="{x:Static automation:OpenFilePickerMap.SelectedFileTextBoxId}"
Grid.Column="1"
IsReadOnly="True"
Text="{Binding SelectedFileDisplayName, Mode=OneWay}"
Height="{Binding ElementName=OpenFileButton, Path=ActualHeight}"/>
Text="{Binding SelectedFileDisplayName, Mode=OneWay}"
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 +63,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 @@ -25,6 +25,7 @@ public OpenFilePicker()
}

#region Properties
[ObsoleteEx(Message = "This property will be deprecated", TreatAsErrorFromVersion ="5.0.0", RemoveInVersion = "6.0.0")]
[ViewToViewModel(MappingType = ViewToViewModelMappingType.TwoWayViewWins)]
public double LabelWidth
{
Expand All @@ -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 ="5.0.0", RemoveInVersion = "6.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 ="5.0.0", RemoveInVersion = "6.0.0")]
[ViewToViewModel(MappingType = ViewToViewModelMappingType.TwoWayViewWins)]
public string LabelText
{
Expand All @@ -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 ="5.0.0", RemoveInVersion = "6.0.0")]
public static readonly DependencyProperty LabelTextProperty = DependencyProperty.Register(nameof(LabelText),
typeof(string), typeof(OpenFilePicker), new PropertyMetadata(string.Empty));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
xmlns:controls="clr-namespace:Orc.Controls">

<Style x:Key="{x:Type controls:SaveFilePicker}"
TargetType="{x:Type controls:SaveFilePicker}"/>
TargetType="{x:Type controls:SaveFilePicker}">
</Style>

</ResourceDictionary>
58 changes: 34 additions & 24 deletions src/Orc.Controls/Controls/SaveFilePicker/Views/SaveFilePicker.xaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<catel:UserControl x:Class="Orc.Controls.SaveFilePicker"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:catel="http://schemas.catelproject.com"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:Orc.Controls"
mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"
d:DataContext="{d:DesignInstance controls:SaveFilePickerViewModel}">
Expand All @@ -17,48 +17,58 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<Label Grid.Column="0"
Content="{Binding LabelText}"
Width="{Binding LabelWidth}" />
<Label Grid.Column="0"
Content="{Binding LabelText}"
Width="{Binding LabelWidth}"
VerticalAlignment="Center">
<Label.Style>
<Style TargetType="Label">
<Style.Triggers>
<Trigger Property="Content" Value="">
<Setter Property="Visibility" Value="Collapsed"/>
</Trigger>

</Style.Triggers>
</Style>
</Label.Style>
</Label>

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

<Button x:Name="SaveFileButton"
Grid.Column="2"
Margin="0,6,2,6"
Grid.Column="2"
Margin="0"
Width="24"
Content="..."
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}"
Visibility="{Binding SelectedFile, Converter={catel:EmptyStringToCollapsingVisibilityConverter}}">

<Image Source="/Orc.Controls;component/Resources/Images/Folder.png"
Width="16"
Height="16" />

<Image Source="/Orc.Controls;component/Resources/Images/Folder.png"
Width="16"
Height="16" />
</Button>

<Button Grid.Column="4"
Margin="2,6,0,6"
<Button Grid.Column="4"
Margin="2,0,0,0"
Width="24"
ToolTip="{catel:LanguageBinding Controls_Clear}"
Command="{Binding Clear}"
Visibility="{Binding SelectedFile, Converter={catel:EmptyStringToCollapsingVisibilityConverter}}">

<Image Source="/Orc.Controls;component/Resources/Images/Delete.png"
Width="16"
<Image Source="/Orc.Controls;component/Resources/Images/Delete.png"
Width="16"
Height="16" />

</Button>
</Grid>

</catel:UserControl>
</catel:UserControl>
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,27 @@ public SaveFilePicker()
InitializeComponent();
}

[ObsoleteEx(Message = "This property will be deprecated", TreatAsErrorFromVersion ="5.0.0", RemoveInVersion = "6.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 ="5.0.0", RemoveInVersion = "6.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 ="5.0.0", RemoveInVersion = "6.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 ="5.0.0", RemoveInVersion = "6.0.0")]
public static readonly DependencyProperty LabelTextProperty = DependencyProperty.Register(nameof(LabelText), typeof(string),
typeof(SaveFilePicker), new PropertyMetadata(string.Empty));

Expand Down
14 changes: 14 additions & 0 deletions src/Orc.Controls/Themes/Generic.generated.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
</Setter>
</Style>
<x:Static x:Key="Empty" Member="sys:String.Empty" />
<Style x:Key="{x:Type local:DirectoryPicker}" TargetType="{x:Type local:DirectoryPicker}" />
<Style x:Key="{x:Type local:LogMessageCategoryControl}" TargetType="{x:Type local:LogMessageCategoryControl}">
<Setter Property="Template">
<Setter.Value>
Expand Down Expand Up @@ -58,6 +59,7 @@
</Setter.Value>
</Setter>
</Style>
<Style x:Key="{x:Type local:OpenFilePicker}" TargetType="{x:Type local:OpenFilePicker}" />
<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>
Expand Down Expand Up @@ -2224,4 +2226,16 @@
<Style x:Key="DefaultLogViewerControlStyle" TargetType="{x:Type local:LogViewerControl}" BasedOn="{StaticResource {x:Type local:LogViewerControl}}">
<Setter Property="Margin" Value="{DynamicResource Margin.TextBox}" />
</Style>
<Style x:Key="DefaultDirectoryPickerStyle" TargetType="{x:Type local:DirectoryPicker}" BasedOn="{StaticResource {x:Type local:DirectoryPicker}}">
<Setter Property="Margin" Value="{DynamicResource Margin.TextBox}" />
<Setter Property="Height" Value="{DynamicResource Size.Height}" />
</Style>
<Style x:Key="DefaultSaveFilePickerStyle" TargetType="{x:Type local:SaveFilePicker}" BasedOn="{StaticResource {x:Type local:SaveFilePicker}}">
<Setter Property="Margin" Value="{DynamicResource Margin.TextBox}" />
<Setter Property="Height" Value="{DynamicResource Size.Height}" />
</Style>
<Style x:Key="DefaultOpenFilePickerStyle" TargetType="{x:Type local:OpenFilePicker}" BasedOn="{StaticResource {x:Type local:OpenFilePicker}}">
<Setter Property="Margin" Value="{DynamicResource Margin.TextBox}" />
<Setter Property="Height" Value="{DynamicResource Size.Height}" />
</Style>
</ResourceDictionary>
27 changes: 27 additions & 0 deletions src/Orc.Controls/Themes/Theming.defaultstyles.orccontrols.xaml
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 Expand Up @@ -417,5 +419,30 @@
BasedOn="{StaticResource {x:Type orccontrols:LogViewerControl}}">
<Setter Property="Margin" Value="{DynamicResource Margin.TextBox}"/>
</Style>

<!-- DirectoryPickerControl -->
<Style x:Key="DefaultDirectoryPickerStyle"
TargetType="{x:Type orccontrols:DirectoryPicker}"
BasedOn="{StaticResource {x:Type orccontrols:DirectoryPicker}}">
<Setter Property="Margin" Value="{DynamicResource Margin.TextBox}" />
<Setter Property="Height" Value="{DynamicResource Size.Height}" />
</Style>

<!-- SaveFilePickerControl -->
<Style x:Key="DefaultSaveFilePickerStyle"
TargetType="{x:Type orccontrols:SaveFilePicker}"
BasedOn="{StaticResource {x:Type orccontrols:SaveFilePicker}}">
<Setter Property="Margin" Value="{DynamicResource Margin.TextBox}" />
<Setter Property="Height" Value="{DynamicResource Size.Height}" />
</Style>

<!-- OpenFilePickerControl -->
<Style x:Key="DefaultOpenFilePickerStyle"
TargetType="{x:Type orccontrols:OpenFilePicker}"
BasedOn="{StaticResource {x:Type orccontrols:OpenFilePicker}}">
<Setter Property="Margin" Value="{DynamicResource Margin.TextBox}" />
<Setter Property="Height" Value="{DynamicResource Size.Height}" />
</Style>


</ResourceDictionary>