Add marquee for truncated ticket overview headings

This commit is contained in:
Meik
2026-07-18 23:45:34 +02:00
parent 62a5c97cbd
commit 2fbf2e2d2d
2 changed files with 73 additions and 0 deletions

View File

@@ -15,6 +15,39 @@
<UserControl.Resources> <UserControl.Resources>
<vc:LanguageDefinitionsConverter x:Key="LanguageConverter" /> <vc:LanguageDefinitionsConverter x:Key="LanguageConverter" />
<Style x:Key="TicketOverviewRowHeadingStyle"
TargetType="Label">
<Setter Property="HorizontalContentAlignment"
Value="Stretch" />
<Setter Property="VerticalContentAlignment"
Value="Center" />
<EventSetter Event="MouseEnter"
Handler="RowHeading_MouseEnter" />
<EventSetter Event="MouseLeave"
Handler="RowHeading_MouseLeave" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Label">
<Border x:Name="PART_TickerContainer"
Background="Transparent"
ClipToBounds="True"
Padding="{TemplateBinding Padding}">
<TextBlock x:Name="PART_TickerText"
Text="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}"
Foreground="{TemplateBinding Foreground}"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontStretch="{TemplateBinding FontStretch}"
FontStyle="{TemplateBinding FontStyle}"
FontWeight="{TemplateBinding FontWeight}"
TextTrimming="CharacterEllipsis"
VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Style für Labels mit Auswahlzustand --> <!-- Style für Labels mit Auswahlzustand -->
<Style x:Key="RoundedSelectedLabelStyle" <Style x:Key="RoundedSelectedLabelStyle"
TargetType="Label"> TargetType="Label">
@@ -130,6 +163,7 @@
<!-- Tickets --> <!-- Tickets -->
<Label Grid.Row="2" <Label Grid.Row="2"
Grid.Column="0" Grid.Column="0"
Style="{StaticResource TicketOverviewRowHeadingStyle}"
Foreground="{DynamicResource FontColor.DetailsPage.TitleSection.Header}" Foreground="{DynamicResource FontColor.DetailsPage.TitleSection.Header}"
Content="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TicketOverview.Row.Heading.Tickets}" Content="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TicketOverview.Row.Heading.Tickets}"
FontWeight="Bold" FontWeight="Bold"
@@ -202,6 +236,7 @@
<!-- Incidents --> <!-- Incidents -->
<Label Grid.Row="3" <Label Grid.Row="3"
Grid.Column="0" Grid.Column="0"
Style="{StaticResource TicketOverviewRowHeadingStyle}"
Foreground="{DynamicResource FontColor.DetailsPage.TitleSection.Header}" Foreground="{DynamicResource FontColor.DetailsPage.TitleSection.Header}"
Content="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TicketOverview.Row.Heading.Incidents}" Content="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TicketOverview.Row.Heading.Incidents}"
FontWeight="Bold" FontWeight="Bold"
@@ -274,6 +309,7 @@
<!-- Service Requests --> <!-- Service Requests -->
<Label Grid.Row="4" <Label Grid.Row="4"
Grid.Column="0" Grid.Column="0"
Style="{StaticResource TicketOverviewRowHeadingStyle}"
Foreground="{DynamicResource FontColor.DetailsPage.TitleSection.Header}" Foreground="{DynamicResource FontColor.DetailsPage.TitleSection.Header}"
Content="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TicketOverview.Row.Heading.ServiceRequests}" Content="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TicketOverview.Row.Heading.ServiceRequests}"
FontWeight="Bold" FontWeight="Bold"
@@ -346,6 +382,7 @@
<!-- Unassigned --> <!-- Unassigned -->
<Label Grid.Row="5" <Label Grid.Row="5"
Grid.Column="0" Grid.Column="0"
Style="{StaticResource TicketOverviewRowHeadingStyle}"
Foreground="{DynamicResource FontColor.DetailsPage.TitleSection.Header}" Foreground="{DynamicResource FontColor.DetailsPage.TitleSection.Header}"
Content="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TicketOverview.Row.Heading.UnassignedTickets}" Content="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TicketOverview.Row.Heading.UnassignedTickets}"
FontWeight="Bold" FontWeight="Bold"

View File

@@ -10,6 +10,7 @@ using System.Windows.Threading;
using C4IT.FASD.Cockpit.Communication; using C4IT.FASD.Cockpit.Communication;
using C4IT.Logging; using C4IT.Logging;
using FasdDesktopUi.Basics;
using FasdDesktopUi.Basics.Models; using FasdDesktopUi.Basics.Models;
using FasdDesktopUi.Basics.Services; using FasdDesktopUi.Basics.Services;
using FasdDesktopUi.Basics.Services.Models; using FasdDesktopUi.Basics.Services.Models;
@@ -187,6 +188,41 @@ namespace FasdDesktopUi.Basics.UserControls
} }
#endregion #endregion
#region Row Heading Ticker
private void RowHeading_MouseEnter(object sender, MouseEventArgs e)
{
if (!TryGetRowHeadingTickerParts(sender, out var textBlock, out var container))
return;
cUtility.SetTickerTextAnimation(textBlock, container);
}
private void RowHeading_MouseLeave(object sender, MouseEventArgs e)
{
if (!TryGetRowHeadingTickerParts(sender, out var textBlock, out var container))
return;
textBlock.TextTrimming = TextTrimming.CharacterEllipsis;
textBlock.BeginAnimation(MarginProperty, null);
container.ClearValue(WidthProperty);
}
private static bool TryGetRowHeadingTickerParts(object sender, out TextBlock textBlock, out Border container)
{
textBlock = null;
container = null;
if (!(sender is Label label) || label.Template == null)
return false;
textBlock = label.Template.FindName("PART_TickerText", label) as TextBlock;
container = label.Template.FindName("PART_TickerContainer", label) as Border;
return textBlock != null && container != null;
}
#endregion
#region Methods #region Methods
private async void TicketOverview_Loaded(object sender, RoutedEventArgs e) private async void TicketOverview_Loaded(object sender, RoutedEventArgs e)
{ {