Kategorie
This commit is contained in:
@@ -30,14 +30,14 @@
|
|||||||
BorderThickness="{TemplateBinding BorderThickness}"
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
Style="{StaticResource ComboBoxToggleButton}" />
|
Style="{StaticResource ComboBoxToggleButton}" />
|
||||||
|
|
||||||
<ContentPresenter x:Name="contentPresenter"
|
<TextBlock x:Name="SelectedPathText"
|
||||||
IsHitTestVisible="False"
|
IsHitTestVisible="False"
|
||||||
Content="{TemplateBinding SelectionBoxItem}"
|
Text="{Binding SelectedItem.FullPath, RelativeSource={RelativeSource AncestorType={x:Type local:HierarchicalSelectionControl}}}"
|
||||||
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
|
Margin="6 0"
|
||||||
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
|
VerticalAlignment="Center"
|
||||||
Margin="6 0"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Center"
|
Foreground="{DynamicResource FontColor.Menu.Categories}"
|
||||||
HorizontalAlignment="Stretch" />
|
TextTrimming="CharacterEllipsis" />
|
||||||
|
|
||||||
<Popup x:Name="PART_Popup"
|
<Popup x:Name="PART_Popup"
|
||||||
Placement="Bottom"
|
Placement="Bottom"
|
||||||
@@ -128,9 +128,10 @@
|
|||||||
BorderBrush="{Binding ElementName=HierarchySelector, Path=BorderBrush}"
|
BorderBrush="{Binding ElementName=HierarchySelector, Path=BorderBrush}"
|
||||||
Foreground="{DynamicResource FontColor.Menu.Categories}"
|
Foreground="{DynamicResource FontColor.Menu.Categories}"
|
||||||
ItemsSource="{Binding VisibleItems, ElementName=HierarchySelector}"
|
ItemsSource="{Binding VisibleItems, ElementName=HierarchySelector}"
|
||||||
SelectedItem="{Binding SelectedItem, ElementName=HierarchySelector, Mode=TwoWay}"
|
|
||||||
DisplayMemberPath="FullPath"
|
DisplayMemberPath="FullPath"
|
||||||
Template="{StaticResource HierarchicalComboBoxTemplate}"
|
Template="{StaticResource HierarchicalComboBoxTemplate}"
|
||||||
|
SelectedIndex="-1"
|
||||||
|
IsSynchronizedWithCurrentItem="False"
|
||||||
DropDownOpened="ComboBoxControl_DropDownOpened"
|
DropDownOpened="ComboBoxControl_DropDownOpened"
|
||||||
DropDownClosed="ComboBoxControl_DropDownClosed"
|
DropDownClosed="ComboBoxControl_DropDownClosed"
|
||||||
IsEditable="False"
|
IsEditable="False"
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
|||||||
private readonly Dictionary<string, HierarchicalSelectionItem> itemLookup = new Dictionary<string, HierarchicalSelectionItem>();
|
private readonly Dictionary<string, HierarchicalSelectionItem> itemLookup = new Dictionary<string, HierarchicalSelectionItem>();
|
||||||
private readonly DispatcherTimer searchDelayTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(250) };
|
private readonly DispatcherTimer searchDelayTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(250) };
|
||||||
private string lastSearchText = string.Empty;
|
private string lastSearchText = string.Empty;
|
||||||
|
private bool suppressTreeSelectionChanged;
|
||||||
|
|
||||||
private TextBox searchTextBox;
|
private TextBox searchTextBox;
|
||||||
private TreeView treeViewControl;
|
private TreeView treeViewControl;
|
||||||
@@ -82,6 +83,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
|||||||
{
|
{
|
||||||
if (d is HierarchicalSelectionControl control)
|
if (d is HierarchicalSelectionControl control)
|
||||||
{
|
{
|
||||||
|
control.LogSelectedItemChange(e.NewValue as HierarchicalSelectionItem);
|
||||||
control.TryExpandToSelectedItem();
|
control.TryExpandToSelectedItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -111,6 +113,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
|||||||
EnsureTemplateParts();
|
EnsureTemplateParts();
|
||||||
searchTextBox?.Focus();
|
searchTextBox?.Focus();
|
||||||
searchTextBox?.SelectAll();
|
searchTextBox?.SelectAll();
|
||||||
|
suppressTreeSelectionChanged = false;
|
||||||
LogEntry($"[CategoryPicker] DropDownOpened. Selected={SelectedItem?.FullPath ?? "<null>"}");
|
LogEntry($"[CategoryPicker] DropDownOpened. Selected={SelectedItem?.FullPath ?? "<null>"}");
|
||||||
DropDownOpened?.Invoke(this, e);
|
DropDownOpened?.Invoke(this, e);
|
||||||
}
|
}
|
||||||
@@ -118,6 +121,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
|||||||
private void ComboBoxControl_DropDownClosed(object sender, EventArgs e)
|
private void ComboBoxControl_DropDownClosed(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
searchDelayTimer.Stop();
|
searchDelayTimer.Stop();
|
||||||
|
suppressTreeSelectionChanged = false;
|
||||||
LogEntry("[CategoryPicker] DropDownClosed");
|
LogEntry("[CategoryPicker] DropDownClosed");
|
||||||
DropDownClosed?.Invoke(this, e);
|
DropDownClosed?.Invoke(this, e);
|
||||||
}
|
}
|
||||||
@@ -138,6 +142,9 @@ namespace FasdDesktopUi.Basics.UserControls
|
|||||||
|
|
||||||
private void TreeViewControl_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
|
private void TreeViewControl_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
|
||||||
{
|
{
|
||||||
|
if (suppressTreeSelectionChanged)
|
||||||
|
return;
|
||||||
|
|
||||||
if (e.NewValue is HierarchicalSelectionItem selected)
|
if (e.NewValue is HierarchicalSelectionItem selected)
|
||||||
{
|
{
|
||||||
var original = ResolveOriginalItem(selected);
|
var original = ResolveOriginalItem(selected);
|
||||||
@@ -147,6 +154,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
|||||||
LogEntry($"[CategoryPicker] Tree selection changed: {original.FullPath}");
|
LogEntry($"[CategoryPicker] Tree selection changed: {original.FullPath}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suppressTreeSelectionChanged = true;
|
||||||
ComboBoxControl.IsDropDownOpen = false;
|
ComboBoxControl.IsDropDownOpen = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -251,7 +259,20 @@ namespace FasdDesktopUi.Basics.UserControls
|
|||||||
|
|
||||||
private void UpdateDisplaySelection()
|
private void UpdateDisplaySelection()
|
||||||
{
|
{
|
||||||
// Display handled by ComboBox DisplayMemberPath (FullPath).
|
// Display handled by template TextBlock bound to SelectedItem.FullPath.
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LogSelectedItemChange(HierarchicalSelectionItem newValue)
|
||||||
|
{
|
||||||
|
var description = "<null>";
|
||||||
|
if (newValue != null)
|
||||||
|
{
|
||||||
|
var fullPath = string.IsNullOrWhiteSpace(newValue.FullPath) ? newValue.DisplayName : newValue.FullPath;
|
||||||
|
var id = string.IsNullOrWhiteSpace(newValue.Id) ? "<null>" : newValue.Id;
|
||||||
|
description = $"{fullPath} (Id={id})";
|
||||||
|
}
|
||||||
|
|
||||||
|
LogEntry($"[CategoryPicker] DependencyProperty SelectedItem updated -> {description}");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnPreviewKeyDown(KeyEventArgs e)
|
protected override void OnPreviewKeyDown(KeyEventArgs e)
|
||||||
|
|||||||
@@ -229,11 +229,28 @@ namespace FasdDesktopUi.Basics.UserControls
|
|||||||
|
|
||||||
private static void OnSelectedCategoryChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
private static void OnSelectedCategoryChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
// Reserved for future use when additional reactions are required.
|
if (d is CloseCaseDialogWithTicket instance)
|
||||||
|
instance.LogSelectedCategoryChanged(e.NewValue as HierarchicalSelectionItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private void LogSelectedCategoryChanged(HierarchicalSelectionItem category)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var fullPath = category == null
|
||||||
|
? "<null>"
|
||||||
|
: string.IsNullOrWhiteSpace(category.FullPath) ? category.DisplayName : category.FullPath;
|
||||||
|
var id = category == null || string.IsNullOrWhiteSpace(category.Id) ? "<null>" : category.Id;
|
||||||
|
LogEntry($"[CloseCaseDialog] SelectedCategory updated -> {fullPath} (Id={id})");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool ShowServiceHasBeenChangedWarning
|
public bool ShowServiceHasBeenChangedWarning
|
||||||
{
|
{
|
||||||
get { return ServiceHasBeenChanged && SetOrUpdateServiceInTicket; }
|
get { return ServiceHasBeenChanged && SetOrUpdateServiceInTicket; }
|
||||||
|
|||||||
Reference in New Issue
Block a user