Add marquee for truncated ticket overview headings
This commit is contained in:
@@ -15,6 +15,39 @@
|
||||
<UserControl.Resources>
|
||||
<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 x:Key="RoundedSelectedLabelStyle"
|
||||
TargetType="Label">
|
||||
@@ -130,6 +163,7 @@
|
||||
<!-- Tickets -->
|
||||
<Label Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Style="{StaticResource TicketOverviewRowHeadingStyle}"
|
||||
Foreground="{DynamicResource FontColor.DetailsPage.TitleSection.Header}"
|
||||
Content="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TicketOverview.Row.Heading.Tickets}"
|
||||
FontWeight="Bold"
|
||||
@@ -202,6 +236,7 @@
|
||||
<!-- Incidents -->
|
||||
<Label Grid.Row="3"
|
||||
Grid.Column="0"
|
||||
Style="{StaticResource TicketOverviewRowHeadingStyle}"
|
||||
Foreground="{DynamicResource FontColor.DetailsPage.TitleSection.Header}"
|
||||
Content="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TicketOverview.Row.Heading.Incidents}"
|
||||
FontWeight="Bold"
|
||||
@@ -274,6 +309,7 @@
|
||||
<!-- Service Requests -->
|
||||
<Label Grid.Row="4"
|
||||
Grid.Column="0"
|
||||
Style="{StaticResource TicketOverviewRowHeadingStyle}"
|
||||
Foreground="{DynamicResource FontColor.DetailsPage.TitleSection.Header}"
|
||||
Content="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TicketOverview.Row.Heading.ServiceRequests}"
|
||||
FontWeight="Bold"
|
||||
@@ -346,6 +382,7 @@
|
||||
<!-- Unassigned -->
|
||||
<Label Grid.Row="5"
|
||||
Grid.Column="0"
|
||||
Style="{StaticResource TicketOverviewRowHeadingStyle}"
|
||||
Foreground="{DynamicResource FontColor.DetailsPage.TitleSection.Header}"
|
||||
Content="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TicketOverview.Row.Heading.UnassignedTickets}"
|
||||
FontWeight="Bold"
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.Windows.Threading;
|
||||
|
||||
using C4IT.FASD.Cockpit.Communication;
|
||||
using C4IT.Logging;
|
||||
using FasdDesktopUi.Basics;
|
||||
using FasdDesktopUi.Basics.Models;
|
||||
using FasdDesktopUi.Basics.Services;
|
||||
using FasdDesktopUi.Basics.Services.Models;
|
||||
@@ -187,6 +188,41 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
}
|
||||
#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
|
||||
private async void TicketOverview_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user