I've create a control template for a progress bar that includes a textblock where I want to put the update the text based on the % of a file downloaded.
I've no problem getting the % etc. I just want to know how from the c# code do I target the textblock.
Here is my controltemplate
<Style TargetType="{x:Type ProgressBar}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ProgressBar}">
<Grid>
<Rectangle Stroke="#FF000000" RenderTransformOrigin="0.5,0.5" x:Name="PART_Track" RadiusX="5" RadiusY="50">
<Rectangle.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="Gray" Offset="1"/>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle Stroke="#FF000000" RenderTransformOrigin="0.5,0.5" x:Name="PART_Indicator" HorizontalAlignment="Left" RadiusX="5" RadiusY="50">
<Rectangle.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF023501" Offset="1.0"/>
<GradientStop Color="#FFB6F9B4" Offset="0"/>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Viewbox>
<TextBlock TextAlignment="Center" Background="Transparent" FontFamily="Times" Foreground="Black" x:Name="ProgressText" Margin="2,2,2,2">Test
</TextBlock>
</Viewbox>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Looks like on my screen it's not showing all that code for some reason, anyway, I'm trying to target that TextBlock x:Name "ProgressText"