Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Progress Bar progress text implementation in FluentTheme #7288

Merged
merged 7 commits into from
Jan 1, 2022
7 changes: 6 additions & 1 deletion src/Avalonia.Themes.Fluent/Controls/ProgressBar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<Setter Property="Template">
<ControlTemplate>
<Border x:Name="ProgressBarRoot" ClipToBounds="True" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}">
<Grid>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is no row or columns, better to go with Panel instead. Less overhead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens to the percentage text color when progress is >=50%. Seems like it wouldn't be visible.

  1. I think lightweight resource and potentially another brush property are needed to control this.
  2. A new property should be added to disable this without re-templating.

The Default theme has a similar issue. I will try to make a new pr to fix both of them in the near future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is no row or columns, better to go with Panel instead. Less overhead.

Fixed that on the current commit.

<Panel>
<Panel x:Name="DeterminateRoot">
<Border CornerRadius="{TemplateBinding CornerRadius}" x:Name="PART_Indicator" Margin="{TemplateBinding Padding}" Background="{TemplateBinding Foreground}" />
Expand All @@ -29,7 +30,11 @@
<Border x:Name="IndeterminateProgressBarIndicator" CornerRadius="{TemplateBinding CornerRadius}" Margin="{TemplateBinding Padding}" Background="{TemplateBinding Foreground}" />
<Border x:Name="IndeterminateProgressBarIndicator2" CornerRadius="{TemplateBinding CornerRadius}" Margin="{TemplateBinding Padding}" Background="{TemplateBinding Foreground}" />
</Panel>
</Panel>
</Panel>
<LayoutTransformControl HorizontalAlignment="Center" VerticalAlignment="Center" IsVisible="{Binding ShowProgressText, RelativeSource={RelativeSource TemplatedParent}}" x:Name="PART_LayoutTransformControl">
<TextBlock Foreground="{DynamicResource ThemeForegroundBrush}" Text="{Binding Value, RelativeSource={RelativeSource TemplatedParent}, StringFormat={}{0:0}%}" />
maxkatz6 marked this conversation as resolved.
Show resolved Hide resolved
</LayoutTransformControl>
</Grid>
</Border>
</ControlTemplate>
</Setter>
Expand Down