-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
1,873 additions
and
1,630 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
src/PicView.Avalonia/Converters/IndexBiggerThanBooleanConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System.Globalization; | ||
using Avalonia.Data; | ||
using Avalonia.Data.Converters; | ||
|
||
namespace PicView.Avalonia.Converters; | ||
|
||
public class IndexBiggerThanBooleanConverter: IValueConverter | ||
{ | ||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) | ||
{ | ||
if (!int.TryParse(value?.ToString(), out var index) || !int.TryParse(parameter?.ToString(), out var parameterIndex)) | ||
{ | ||
return BindingOperations.DoNothing; | ||
} | ||
return index >= parameterIndex; | ||
} | ||
|
||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) | ||
{ | ||
|
||
return BindingOperations.DoNothing; | ||
} | ||
} |
101 changes: 101 additions & 0 deletions
101
src/PicView.Avalonia/PicViewTheme/Controls/ProgressBar.axaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<ResourceDictionary xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:converters="using:Avalonia.Controls.Converters" | ||
x:ClassModifier="internal"> | ||
<converters:StringFormatConverter x:Key="StringFormatConverter" /> | ||
|
||
<ControlTheme x:Key="{x:Type ProgressBar}" | ||
TargetType="ProgressBar"> | ||
<Setter Property="Background" Value="{DynamicResource AccentColor}" /> | ||
<Setter Property="Foreground" Value="{DynamicResource AccentColor}" /> | ||
<Setter Property="Template"> | ||
<ControlTemplate TargetType="ProgressBar"> | ||
<Panel> | ||
<Border Background="{TemplateBinding Background}" | ||
BorderBrush="{TemplateBinding BorderBrush}" | ||
BorderThickness="{TemplateBinding BorderThickness}" | ||
CornerRadius="{TemplateBinding CornerRadius}" | ||
Opacity="0.2"/> | ||
<Border Name="PART_Indicator" | ||
Background="{TemplateBinding Foreground}" | ||
IsVisible="{Binding !IsIndeterminate, RelativeSource={RelativeSource TemplatedParent}}" /> | ||
<Border Name="PART_IndeterminateIndicator" | ||
Background="{TemplateBinding Foreground}" | ||
IsVisible="{Binding IsIndeterminate, RelativeSource={RelativeSource TemplatedParent}}" /> | ||
<LayoutTransformControl Name="PART_LayoutTransformControl" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center" | ||
IsVisible="{Binding ShowProgressText, RelativeSource={RelativeSource TemplatedParent}}"> | ||
<TextBlock Foreground="{DynamicResource MainTextColor}"> | ||
<TextBlock.Text> | ||
<MultiBinding Converter="{StaticResource StringFormatConverter}"> | ||
<TemplateBinding Property="ProgressTextFormat" /> | ||
<Binding Path="Value" | ||
RelativeSource="{RelativeSource TemplatedParent}" /> | ||
<TemplateBinding Property="Percentage" /> | ||
<TemplateBinding Property="Minimum" /> | ||
<TemplateBinding Property="Maximum" /> | ||
</MultiBinding> | ||
</TextBlock.Text> | ||
</TextBlock> | ||
</LayoutTransformControl> | ||
</Panel> | ||
</ControlTemplate> | ||
</Setter> | ||
|
||
<Style Selector="^:horizontal /template/ Border#PART_Indicator"> | ||
<Setter Property="HorizontalAlignment" Value="Left" /> | ||
<Setter Property="VerticalAlignment" Value="Stretch" /> | ||
</Style> | ||
<Style Selector="^:vertical /template/ Border#PART_Indicator"> | ||
<Setter Property="HorizontalAlignment" Value="Stretch" /> | ||
<Setter Property="VerticalAlignment" Value="Bottom" /> | ||
</Style> | ||
<Style Selector="^:horizontal"> | ||
<Setter Property="MinWidth" Value="200" /> | ||
<Setter Property="MinHeight" Value="16" /> | ||
</Style> | ||
<Style Selector="^:vertical"> | ||
<Setter Property="MinWidth" Value="16" /> | ||
<Setter Property="MinHeight" Value="200" /> | ||
</Style> | ||
<Style Selector="^:vertical /template/ LayoutTransformControl#PART_LayoutTransformControl"> | ||
<Setter Property="LayoutTransform"> | ||
<Setter.Value> | ||
<RotateTransform Angle="90" /> | ||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
|
||
<Style Selector="^:horizontal:indeterminate /template/ Border#PART_IndeterminateIndicator"> | ||
<Style.Animations> | ||
<Animation Easing="LinearEasing" | ||
IterationCount="Infinite" | ||
Duration="0:0:3"> | ||
<KeyFrame Cue="0%"> | ||
<Setter Property="TranslateTransform.X" Value="{Binding $parent[ProgressBar].TemplateSettings.IndeterminateStartingOffset}" /> | ||
</KeyFrame> | ||
<KeyFrame Cue="100%"> | ||
<Setter Property="TranslateTransform.X" Value="{Binding $parent[ProgressBar].TemplateSettings.IndeterminateEndingOffset}" /> | ||
</KeyFrame> | ||
</Animation> | ||
</Style.Animations> | ||
<Setter Property="Width" Value="{Binding TemplateSettings.ContainerWidth, RelativeSource={RelativeSource TemplatedParent}}" /> | ||
</Style> | ||
<Style Selector="^:vertical:indeterminate /template/ Border#PART_IndeterminateIndicator"> | ||
<Style.Animations> | ||
<Animation Easing="LinearEasing" | ||
IterationCount="Infinite" | ||
Duration="0:0:3"> | ||
<KeyFrame Cue="0%"> | ||
<Setter Property="TranslateTransform.Y" Value="{Binding $parent[ProgressBar].TemplateSettings.IndeterminateStartingOffset}" /> | ||
</KeyFrame> | ||
<KeyFrame Cue="100%"> | ||
<Setter Property="TranslateTransform.Y" Value="{Binding $parent[ProgressBar].TemplateSettings.IndeterminateEndingOffset}" /> | ||
</KeyFrame> | ||
</Animation> | ||
</Style.Animations> | ||
<Setter Property="Height" Value="{Binding TemplateSettings.ContainerWidth, RelativeSource={RelativeSource TemplatedParent}}" /> | ||
</Style> | ||
</ControlTheme> | ||
</ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.