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">
                                        <Grid>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="*" />
                                            </Grid.RowDefinitions>
                                            <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"  />
                                        </Grid>
                                    </StackPanel>
                                </Border>

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.

Thanks

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.

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.

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.

In this episode, Michael Hawker sits down with Jeremy to introduce us to XAML Studio application. He walks us through the experience of editing and inspecting live XAML updates without the need for a build or compile step. We also get to see demos of the debugging experience, the control toolbox, and even how to work with 3rd party controls.


[T02:40] - What is XAML Studio?

[T03:16] - First look at XAML Studio

[T06:33] - What’s the scope of XAML Studio ?

[T07:55] - Using 3rd party libraries

[T09:16] - Debugging XAML bindings

[T12:52] - What are features might show up next?

[T14:17] - What is the garage?

[T15:48] - Is there support for the visual state manager?

[T16:43] - Exploring the toolbox in XAML Studio

Learn More

Learn Enterprise WPF with XAML from Scratch

Windows Presentation Foundation Masterclass

Top 10 Podcasts for Web Developers

An Introduction to Web Components

Build a Basic Website with ASP.NET MVC and Angular

Building Web App using ASP.NET Web API Angular 7 and SQL Server

ListBox control not resizing when window is maximized

I am still new to VS, C# and XAML. I have this code below

I am still new to VS, C# and XAML. I have this code below

<Window x:Class="KANASoft___Xplora.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        WindowStartupLocation="CenterScreen" Icon="folder.gif" ResizeMode="CanResizeWithGrip"
        Title="KANASoft - Xplora" Height="700" Width="535" Background="Black" Name="mainWindow">
    <Grid Height="{Binding ElementName=mainWindow, Path=Height}" Width="{Binding ElementName=mainWindow, Path=Width}">
        <ListBox Background="Black" Name="LBHeader" BorderBrush="Aqua" ScrollViewer.HorizontalScrollBarVisibility="Disabled" BorderThickness="0 0 0 1" Height="80" VerticalAlignment="Top">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel Orientation="Horizontal" Width="{Binding ElementName=mainWindow, Path=Width}"/>
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
        </ListBox>
    </Grid>
</Window>

I want my <ListBox Name="LBHeader"> to resize according to the window's width when the window is resized and it works fine when I resize the window by dragging the window edges. But the problem is that when I maximize the window, the <ListBox Name="LBHeader"> doesn't resize with the window.

Please I need help on this.