From 42ae76db4b28b97a67a3f16122bae4c1ffbafdfe Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Fri, 12 Jun 2026 12:13:46 +0200 Subject: [PATCH] Context Menu nur wenn commands vorhanden --- .../CollectionCountToBoolConverter.cs | 19 +- .../CollectionCountToVisibilityConverter.cs | 19 +- BeWo/Styles/Features/AIChatStyles.xaml | 3 +- BeWo/View/Detail/SendMailView.xaml | 455 ++++++++++++------ BeWo/View/Detail/ViewMailView.xaml | 307 +++++++----- 5 files changed, 540 insertions(+), 263 deletions(-) diff --git a/BeWo/Converter/CollectionCountToBoolConverter.cs b/BeWo/Converter/CollectionCountToBoolConverter.cs index bbee61a55..8bccca2b4 100644 --- a/BeWo/Converter/CollectionCountToBoolConverter.cs +++ b/BeWo/Converter/CollectionCountToBoolConverter.cs @@ -1,5 +1,7 @@ using System; +using System.Collections; using System.Globalization; +using System.Linq; using System.Windows; using System.Windows.Data; @@ -11,7 +13,22 @@ namespace BeWo.Converter { try { - var count = (int) value; + int count; + + switch (value) + { + case int i: + count = i; + break; + case ICollection collection: + count = collection.Count; + break; + case IEnumerable enumerable: + count = enumerable.Cast().Count(); + break; + default: + return false; + } if (parameter is string s && s == "reverse") { diff --git a/BeWo/Converter/CollectionCountToVisibilityConverter.cs b/BeWo/Converter/CollectionCountToVisibilityConverter.cs index fbf96c071..88f082c19 100644 --- a/BeWo/Converter/CollectionCountToVisibilityConverter.cs +++ b/BeWo/Converter/CollectionCountToVisibilityConverter.cs @@ -1,5 +1,7 @@ using System; +using System.Collections; using System.Globalization; +using System.Linq; using System.Windows; using System.Windows.Data; @@ -11,7 +13,22 @@ namespace BeWo.Converter { try { - var count = (int)value; + int count; + + switch (value) + { + case int i: + count = i; + break; + case ICollection collection: + count = collection.Count; + break; + case IEnumerable enumerable: + count = enumerable.Cast().Count(); + break; + default: + return Visibility.Collapsed; + } if (parameter is string s && s == "reverse") { diff --git a/BeWo/Styles/Features/AIChatStyles.xaml b/BeWo/Styles/Features/AIChatStyles.xaml index ec39f0172..47f0faa74 100644 --- a/BeWo/Styles/Features/AIChatStyles.xaml +++ b/BeWo/Styles/Features/AIChatStyles.xaml @@ -151,7 +151,8 @@ + Tag="{Binding DataContext, RelativeSource={RelativeSource AncestorType=ItemsControl}}" + ContextMenuService.IsEnabled="{Binding DataContext.AssistentCommands, Converter={StaticResource CollectionCountToBoolConverter}, RelativeSource={RelativeSource AncestorType=ItemsControl}}"> diff --git a/BeWo/View/Detail/SendMailView.xaml b/BeWo/View/Detail/SendMailView.xaml index 9b869833f..927a68d84 100644 --- a/BeWo/View/Detail/SendMailView.xaml +++ b/BeWo/View/Detail/SendMailView.xaml @@ -1,114 +1,211 @@ - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -