Themes/RunningTextStyle.xaml
(完整代码) 2KB<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ctrls="clr-namespace:Micro.Ui.RunningTextStyle.Controls">
<ControlTemplate x:Key="Template.Horizontal" TargetType="{x:Type ctrls:RunningText}">
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
<Canvas x:Name="PART_Canvas" ClipToBounds="{TemplateBinding ClipToBounds}" Height="{Binding ActualHeight,ElementName=PART_Txt1}" VerticalAlignment="Center">
<TextBlock x:Name="PART_Txt1" Text="{TemplateBinding Text}" />
<TextBlock x:Name="PART_Txt2" Text="{TemplateBinding Text}" />
</Canvas>
</Border>
</ControlTemplate>
<ControlTemplate x:Key="Template.Vertical" TargetType="{x:Type ctrls:RunningText}">
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
<Canvas x:Name="PART_Canvas" ClipToBounds="{TemplateBinding ClipToBounds}" MinWidth="{TemplateBinding FontSize}" HorizontalAlignment="Center">
<TextBlock x:Name="PART_Txt1" Text="{TemplateBinding Text}" TextWrapping="Wrap" MaxWidth="{Binding ActualWidth,ElementName=PART_Canvas}" />
<TextBlock x:Name="PART_Txt2" Text="{TemplateBinding Text}" TextWrapping="Wrap" MaxWidth="{Binding ActualWidth,ElementName=PART_Canvas}" />
</Canvas>
</Border>
</ControlTemplate>
<Style TargetType="{x:Type ctrls:RunningText}">
<Setter Property="Padding" Value="6 3" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="IsHitTestVisible" Value="False" />
<Setter Property="ClipToBounds" Value="True" />
<Style.Triggers>
<Trigger Property="Direction" Value="RightToLeft">
<Setter Property="Template" Value="{StaticResource Template.Horizontal}" />
</Trigger>
<Trigger Property="Direction" Value="LeftToRight">
<Setter Property="Template" Value="{StaticResource Template.Horizontal}" />
</Trigger>
<Trigger Property="Direction" Value="BottomToTop">
<Setter Property="Template" Value="{StaticResource Template.Vertical}" />
</Trigger>
<Trigger Property="Direction" Value="TopToBottom">
<Setter Property="Template" Value="{StaticResource Template.Vertical}" />
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
