I have a question concerning wpf as I am still a beginner. I have a MetroProgressbar which works fine, I use bindings for several properties like foregroundcolor(because on certain conditions it gets changed..) and of course value. So it worked all out for me until I tried to display a text inside the progressbar, and I can't really find a solution, however I tried this so far:
<Controls:MetroProgressBar Minimum="{Binding ProgressMin}" Maximum="{Binding ProgressMax}" BorderBrush="{Binding ProgressBarBorderBrush}" Background="White" Foreground="{Binding ProgressBarForeground}" HorizontalAlignment="Stretch" Margin="5 5 5 5" VerticalAlignment="Top" Height="30" Value="{Binding ProgressValue}" BorderThickness="2" FlowDirection="LeftToRight">
<Controls:MetroProgressBar.Template>
<ControlTemplate TargetType="ProgressBar">
<Grid >
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Text="test123" Foreground="{Binding ProgressBarForeground}" FontSize="12" Margin="5 0 0 0" HorizontalAlignment="Left" VerticalAlignment="Center"/>
</Grid>
</ControlTemplate>
</Controls:MetroProgressBar.Template>
</Controls:MetroProgressBar>
Now the only thing that works is the Textblock correctly bound to the foreground property. The progressbar does not display any value anymore, but when I set the background of the grid to a color, the progressbar still gets filled.
Any fix or better ideas? Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire