Setting textblock margin based on content size

Setting textblock margin based on content size

I am trying to show the overall progress of current playing song in below format.

I am trying to show the overall progress of current playing song in below format.

hh:mm:ss / hh:mm:ss ---> current time in hh:mm:ss / total time in hh:mm:ss

<Border Margin="30,0,20,0" Name="NowPlayingScurbberPanel" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" RelativePanel.Below="NowPlayingButtonPanel" RelativePanel.AlignBottomWithPanel="True">
                                    <StackPanel Visibility="{Binding Path=ShouldProgressBarBeVisible, Converter={StaticResource BoolToVisibilityConverter}}" MinHeight="40">
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="*" />
                                            <TextBlock x:Uid="NowPlayingCurrentMediaTimeText" Margin="0,0,80,30" Style="{StaticResource NowPlayingMediaTimeStyle}" Grid.Row="0" Text="{Binding Path=DisplayedMediaTimeCurrent}" HorizontalAlignment="Right" />
                                            <TextBlock x:Uid="slash" Margin="0,0,60,30" Style="{StaticResource NowPlayingMediaTimeStyle}" Grid.Row="0" Text=" / " HorizontalAlignment="Right"  />
                                            <Slider x:Uid="NowPlayingScrubber" Margin="0,20,0,0" Style="{StaticResource NowPlayingMediaScrubberStyle}" Grid.Column="1" x:Name="NowPlayingScrubber" Value="{Binding Path=ProgressBarPercentage, Mode=TwoWay}" DragStarting="OnScrubberDragStarted" DropCompleted="OnScrubberDragCompleted" ValueChanged="OnScrubberDragDelta" IsEnabled="{Binding Path=ScrubberEnabled}"  />
                                            <TextBlock x:Uid="NowPlayingTotalMediaTimeText" Margin="60,0,0,30" Style="{StaticResource NowPlayingMediaTimeStyle}" Grid.Row="0" Text="{Binding Path=DisplayedMediaTimeTotal}" HorizontalAlignment="Right"  />

Things are working fine if total and current played time in less than an hour but when it cross more than a hour than "Slash" overlap with total time. If i give additional margin then content with less than an hour time looks bad.

How can i give margin based on content length or is there any better solution to solve this problem.


Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

XAML Islands

In this episode, Robert is joined by Adam Braden. They continue the 2 part conversation they had on modernizing existing Windows applications and have a deeper discussion on XAML Islands. XAML Islands is a technology that enables Windows developers to use new pieces of UI from the Universal Windows Platform (UWP) on their existing Win32 Applications, including Windows Forms and WPF technologies. This enables them to gradually modernize their apps at their own pace, making use of their current code as much as they want.

Introducing XAML Studio

As a XAML developer, you may sometimes wish you had the ability to quickly prototype your UI and debug your markup without having to load a project in Visual Studio. This can be a huge workflow boost for designers or even for developers just wanting to try out new ideas. With the release of XAML Studio, we are able to close this grab for creators and also enable much more.

Learn Enterprise WPF with XAML from Scratch | Simpliv Course

Looking for a course that gives you the concepts of WPF and XAML concepts and tools with which to build fully functional UI-applications with this UI-building framework? This Enterprise WPF with XAML course is for you. Start from scratch and build a solid foundation, at just $9!