Kategorie
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<UserControl x:Class="FasdDesktopUi.Basics.UserControls.HierarchicalSelectionControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:FasdDesktopUi.Basics.UserControls"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
|
||||
@@ -15,146 +16,124 @@
|
||||
<UserControl.Resources>
|
||||
<vc:LanguageDefinitionsConverter x:Key="LanguageConverter" />
|
||||
<vc:NullValueToVisibilityConverter x:Key="NullToVisibility" />
|
||||
|
||||
<ControlTemplate x:Key="HierarchicalComboBoxTemplate"
|
||||
TargetType="{x:Type ComboBox}">
|
||||
<Grid>
|
||||
<ToggleButton x:Name="toggleButton"
|
||||
Grid.ColumnSpan="2"
|
||||
Focusable="False"
|
||||
ClickMode="Press"
|
||||
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Style="{StaticResource ComboBoxToggleButton}" />
|
||||
|
||||
<ContentPresenter x:Name="contentPresenter"
|
||||
IsHitTestVisible="False"
|
||||
Content="{TemplateBinding SelectionBoxItem}"
|
||||
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
|
||||
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
|
||||
Margin="6 0"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Stretch" />
|
||||
|
||||
<Popup x:Name="PART_Popup"
|
||||
Placement="Bottom"
|
||||
PlacementTarget="{Binding ElementName=toggleButton}"
|
||||
AllowsTransparency="True"
|
||||
Focusable="False"
|
||||
IsOpen="{TemplateBinding IsDropDownOpen}"
|
||||
PopupAnimation="Fade">
|
||||
<Border Width="{Binding ActualWidth, ElementName=HierarchySelector}"
|
||||
Background="{DynamicResource BackgroundColor.Menu.SubCategory}"
|
||||
CornerRadius="7.5"
|
||||
Padding="10">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="10"
|
||||
Color="{DynamicResource DropShadowColor.Menu}"
|
||||
Direction="55"
|
||||
ShadowDepth="10"
|
||||
Opacity="0.35" />
|
||||
</Border.Effect>
|
||||
<StackPanel>
|
||||
<Grid Margin="0 0 10 0">
|
||||
<TextBox x:Name="PART_SearchTextBox"
|
||||
Style="{DynamicResource Customizable.Editable.TextBox.EditOnly}"
|
||||
Background="{TemplateBinding Background}"
|
||||
Padding="27 5 5 5"
|
||||
VerticalContentAlignment="Center" />
|
||||
<ico:AdaptableIcon SelectedInternIcon="menuBar_search"
|
||||
Style="{DynamicResource Menu.MenuBar.PinnedIcon.Base}"
|
||||
BorderPadding="5 5 5 7"
|
||||
Margin="0"
|
||||
IconBackgroundColor="Transparent"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center" />
|
||||
<TextBlock Margin="30 0 0 0"
|
||||
Foreground="{DynamicResource FontColor.DetailsPage.DataHistory.Date}"
|
||||
IsHitTestVisible="False"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Text, ElementName=PART_SearchTextBox}"
|
||||
Value="">
|
||||
<Setter Property="Text"
|
||||
Value="{Binding Path=SearchPlaceholderText, RelativeSource={RelativeSource AncestorType={x:Type local:HierarchicalSelectionControl}}}" />
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
|
||||
<Border Margin="0 10 0 0"
|
||||
Background="{DynamicResource BackgroundColor.Menu.SubCategory}"
|
||||
BorderThickness="0"
|
||||
CornerRadius="5">
|
||||
<ScrollViewer MaxHeight="300"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<TreeView x:Name="PART_TreeView"
|
||||
Background="{DynamicResource BackgroundColor.Menu.SubCategory}"
|
||||
ItemsSource="{Binding ItemsSource, RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<TreeView.Resources>
|
||||
<Style TargetType="TreeViewItem">
|
||||
<Setter Property="IsExpanded"
|
||||
Value="{Binding IsExpanded, Mode=TwoWay}" />
|
||||
</Style>
|
||||
<HierarchicalDataTemplate DataType="{x:Type models:HierarchicalSelectionItem}"
|
||||
ItemsSource="{Binding Children}">
|
||||
<TextBlock Text="{Binding DisplayName}"
|
||||
Foreground="{DynamicResource FontColor.Menu.Categories}"
|
||||
Margin="0 2 0 2" />
|
||||
</HierarchicalDataTemplate>
|
||||
</TreeView.Resources>
|
||||
</TreeView>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Popup>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<Border x:Name="DisplayBorder"
|
||||
Height="28"
|
||||
Background="{Binding ElementName=HierarchySelector, Path=ComboBoxBackground}"
|
||||
BorderBrush="{Binding ElementName=HierarchySelector, Path=BorderBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="7.5"
|
||||
Padding="6 0"
|
||||
MouseLeftButtonUp="DisplayBorder_MouseLeftButtonUp">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="Opacity" Value="1" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsOpen, ElementName=DropDownPopup}"
|
||||
Value="True">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BackgroundColor.Menu.SubCategory.Hover}" />
|
||||
<Setter Property="Background" Value="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}" />
|
||||
</DataTrigger>
|
||||
<Trigger Property="IsMouseOver"
|
||||
Value="True">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BackgroundColor.Menu.SubCategory.Hover}" />
|
||||
</Trigger>
|
||||
<DataTrigger Binding="{Binding ElementName=HierarchySelector, Path=IsEnabled}"
|
||||
Value="False">
|
||||
<Setter Property="Opacity" Value="0.5" />
|
||||
<Setter Property="Cursor" Value="Arrow" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Column="0"
|
||||
Margin="0 0 10 0"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding ElementName=HierarchySelector, Path=SelectedItem.FullPath}"
|
||||
Foreground="{DynamicResource FontColor.Menu.Categories}"
|
||||
VerticalAlignment="Center"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
ToolTip="{Binding ElementName=HierarchySelector, Path=SelectedItem.FullPath}" />
|
||||
</Grid>
|
||||
<Path Grid.Column="1"
|
||||
Margin="0 0 6 0"
|
||||
Data="F1 M 2.89067,4.99467C 2.89067,4.22933 3.724,3.74533 4.39067,4.13067L 10.8227,7.844L 17.26,4.13067C 18.412,3.48 19.4013,5.19333 18.26,5.86533L 11.3227,9.86533C 11.016,10.0413 10.636,10.0413 10.3227,9.86533L 3.39067,5.86533C 3.07867,5.688 2.89067,5.35467 2.89067,4.99467 Z"
|
||||
Fill="{DynamicResource Color.Menu.Icon}"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Width="10"
|
||||
Height="6"
|
||||
Stretch="Uniform"
|
||||
IsHitTestVisible="False" />
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Popup x:Name="DropDownPopup"
|
||||
PlacementTarget="{Binding ElementName=DisplayBorder}"
|
||||
Placement="Bottom"
|
||||
StaysOpen="False"
|
||||
AllowsTransparency="True"
|
||||
Width="{Binding ElementName=DisplayBorder, Path=ActualWidth}"
|
||||
Opened="DropDownPopup_Opened"
|
||||
Closed="DropDownPopup_Closed">
|
||||
<Border Background="{DynamicResource BackgroundColor.Menu.SubCategory}"
|
||||
CornerRadius="7.5"
|
||||
Padding="10">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="10"
|
||||
Color="{DynamicResource DropShadowColor.Menu}"
|
||||
Direction="55"
|
||||
ShadowDepth="10"
|
||||
Opacity="0.35" />
|
||||
</Border.Effect>
|
||||
<StackPanel>
|
||||
<Grid Margin="0 0 10 0">
|
||||
<TextBox x:Name="SearchTextBox"
|
||||
Style="{DynamicResource Customizable.Editable.TextBox.EditOnly}"
|
||||
Background="{Binding ElementName=HierarchySelector, Path=ComboBoxBackground}"
|
||||
Padding="27 5 5 5"
|
||||
VerticalContentAlignment="Center"
|
||||
TextChanged="SearchTextBox_TextChanged" />
|
||||
<ico:AdaptableIcon SelectedInternIcon="menuBar_search"
|
||||
Style="{DynamicResource Menu.MenuBar.PinnedIcon.Base}"
|
||||
BorderPadding="5 5 5 7"
|
||||
Margin="0"
|
||||
IconBackgroundColor="Transparent"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center" />
|
||||
<TextBlock Margin="30 0 0 0"
|
||||
Foreground="{DynamicResource FontColor.DetailsPage.DataHistory.Date}"
|
||||
IsHitTestVisible="False"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Text, ElementName=SearchTextBox}"
|
||||
Value="">
|
||||
<Setter Property="Text"
|
||||
Value="{Binding ElementName=HierarchySelector, Path=SearchPlaceholderText}" />
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
|
||||
<Border Margin="0 10 0 0"
|
||||
Background="{DynamicResource BackgroundColor.Menu.SubCategory}"
|
||||
BorderThickness="0"
|
||||
CornerRadius="5">
|
||||
<ScrollViewer MaxHeight="300"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<TreeView x:Name="TreeViewControl"
|
||||
Background="{Binding ElementName=HierarchySelector, Path=ComboBoxBackground}"
|
||||
ItemsSource="{Binding VisibleItems, ElementName=HierarchySelector}"
|
||||
SelectedItemChanged="TreeViewControl_SelectedItemChanged">
|
||||
<TreeView.Resources>
|
||||
<Style TargetType="TreeViewItem">
|
||||
<Setter Property="IsExpanded"
|
||||
Value="{Binding IsExpanded, Mode=TwoWay}" />
|
||||
</Style>
|
||||
<HierarchicalDataTemplate DataType="{x:Type models:HierarchicalSelectionItem}"
|
||||
ItemsSource="{Binding Children}">
|
||||
<TextBlock Text="{Binding DisplayName}"
|
||||
Foreground="{DynamicResource FontColor.Menu.Categories}"
|
||||
Margin="0 2 0 2" />
|
||||
</HierarchicalDataTemplate>
|
||||
</TreeView.Resources>
|
||||
</TreeView>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Popup>
|
||||
<ComboBox x:Name="ComboBoxControl"
|
||||
Background="{Binding ElementName=HierarchySelector, Path=ComboBoxBackground}"
|
||||
BorderBrush="{Binding ElementName=HierarchySelector, Path=BorderBrush}"
|
||||
Foreground="{DynamicResource FontColor.Menu.Categories}"
|
||||
ItemsSource="{Binding VisibleItems, ElementName=HierarchySelector}"
|
||||
SelectedItem="{Binding SelectedItem, ElementName=HierarchySelector, Mode=TwoWay}"
|
||||
DisplayMemberPath="FullPath"
|
||||
Template="{StaticResource HierarchicalComboBoxTemplate}"
|
||||
DropDownOpened="ComboBoxControl_DropDownOpened"
|
||||
DropDownClosed="ComboBoxControl_DropDownClosed"
|
||||
IsEditable="False"
|
||||
Padding="0" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
Reference in New Issue
Block a user