Я пытаюсь изменить уникальный элемент пользовательского интерфейса XAML (не созданный мной), чтобы содержимое его метки центрировалось по центру элемента (Content = "{Binding Counter}"). До сих пор я пытался использовать Margins, Vertical и дажеГоризонтальное выравнивание без лучшей идеи (добавление и изменение существующих)
Есть идеи?
Код и картинка ниже:
<Grid Margin="10,10,0,0"
Visibility="{Binding Path=DataContext.Visibility, RelativeSource={RelativeSource TemplatedParent}}"
IsEnabled="{Binding Path=DataContext.Enabled, RelativeSource={RelativeSource TemplatedParent}}">
<Grid Height="{Binding Path=ActualHeight, ElementName=lbl}" Width="{Binding Path=ActualHeight, ElementName=lbl}"
Margin="-195,-95,0,0" Panel.ZIndex="300" ClipToBounds="False" Visibility="{Binding CounterVisibility}">
<Canvas>
<Ellipse Fill="{DynamicResource AlarmNotificationHomeView}" Stroke="{DynamicResource AlarmNotificationStrokeHomeView}"
StrokeThickness="3" Width="50" Height="50" Canvas.Left="0" Canvas.Top="0" Canvas.Right="50" Canvas.Bottom="50" Name="Ellipse" />
<Label Name="lbl" Padding="11,13,10,10" HorizontalAlignment="Center" VerticalAlignment="Center"
Content="{Binding Counter}" FontWeight="Bold" FontSize="16" Foreground="{DynamicResource AlarmNotificationForegroundHomeView}"/>
<Canvas.Triggers>
<EventTrigger RoutedEvent="Canvas.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="Ellipse"
Storyboard.TargetProperty="Width"
From="50" To="65" Duration="0:0:0.8"
AutoReverse="True"
RepeatBehavior="Forever" />
<DoubleAnimation Storyboard.TargetName="Ellipse"
Storyboard.TargetProperty="Height"
From="50" To="65" Duration="0:0:0.8"
AutoReverse="True"
RepeatBehavior="Forever" />
<DoubleAnimation Storyboard.TargetName="Ellipse"
Storyboard.TargetProperty="(Canvas.Left)"
From="0" To="-5" Duration="0:0:0.8"
AutoReverse="True"
RepeatBehavior="Forever" />
<DoubleAnimation Storyboard.TargetName="Ellipse"
Storyboard.TargetProperty="(Canvas.Top)"
From="0" To="-5" Duration="0:0:0.8"
AutoReverse="True"
RepeatBehavior="Forever" />
</Storyboard>
</BeginStoryboard>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="lbl"
Storyboard.TargetProperty="FontSize"
From="16" To="20" Duration="0:0:0.8"
AutoReverse="True"
RepeatBehavior="Forever" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Canvas.Triggers>
</Canvas>
</Grid>