Skip to content

Commit

Permalink
发版本
Browse files Browse the repository at this point in the history
  • Loading branch information
SlimeNull committed May 25, 2024
1 parent 9d8f493 commit 71bd0fc
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 25 deletions.
2 changes: 1 addition & 1 deletion EleCho.WpfSuite/EleCho.WpfSuite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<RootNamespace>EleCho.WpfSuite</RootNamespace>

<Version>0.2.1</Version>
<Version>0.3.0</Version>

<Authors>EleCho</Authors>
<Copyright>Copyright © 2024 EleCho</Copyright>
Expand Down
112 changes: 88 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,42 +53,103 @@ Enjoy!

## Features

The following is a summary of the features of WPF Suite.

Layout panels:

### Layout panels:

- StackPanel: Origin stack panel with `Spacing` property
- WrapPanel: Origin wrap panel with `HorizontalSpacing` and `VerticalSpacing` property
- FlexPanel: Flex layout implementation with `HorizontalSpacing` and `VerticalSpacing` property
- MasonryPanel: Masonry layout implementation with `FlowSpacing` and `ItemSpacing` property

### Controls:

The WPF Suite has overridden many native controls, added some properties, or optimized their logic.
You can directly access the corresponding controls via the WPF Suite namespace.

Almost all controls have added the CornerRadius property, so now if you need to adjust the corner radius of a certain control,
you just need to set this property instead of changing the control template.

```xml
<ws:Button Content="Hello world"
CornerRadius="3">
```

If a corresponding control has multiple states, such as "mouse hover" and "mouse press",
WPF Suite also exposes certain values corresponding to these states directly through properties,
such as "HoverBackground" which represents the background color used by the control in the hover state.
Therefore, if you need to change the style of certain controls in different states,
you just need to set the corresponding properties.


```xml
<ws:Button Content="Hello world"
HoverBackground="Pink">
```

When using the default Border in WPF, it allows the content to exceed the bounds of the Border.
Even if you set a CornerRadius and ClipToBounds, it won't be able to clip the content to fit within the rounded corners.
However, when using the Border provided by the WPF Suite,
you can achieve automatic clipping by binding the content's Clip property to the Border's ContentClip property.

```xml
<ws:Border CornerRadius="5" Width="50" Height="50">
<Rectangle Fill="Pink"
Clip="{Binding RelativeSource={RelativeSource AncestorType=ws:Border},Path=ContentClip}"/>
</ws:Border>

<ws:Border x:Name="NamedBorder" CornerRadius="5" Width="50" Height="50">
<Rectangle Fill="Pink"
Clip="{Binding ElementName=NamedBorder,Path=ContentClip}"/>
</ws:Border>
```

TransitioningContentControl can be understood as a ContentControl with added transition effects.
After setting the transition effects, the specified transition effect will be executed when the content changes.

```xml
<ws:TransitioningContentControl Content="Some content">
<ws:TransitioningContentControl.Transition>
<ws:SlideFadeTransition Duration="0:0:0.200"/>
</ws:TransitioningContentControl.Transition>
</ws:TransitioningContentControl>
```

WPF Suite has also made several optimizations for ScrollViewer.
For example, it now supports smooth scrolling with the mouse and allows for finer scrolling using touchpad,
which was not available in the original ScrollViewer.

```xml
<ws:ScrollViewer>
<ws:StackPanel Spacing="8">
<TextBlock Text="Some content"/>
<!--And more-->
</ws:StackPanel>
</ws:ScrollViewer>
```

> The enhanced features of ScrollViewer can be disabled via its properties.
Controls:

- Image: Simple image control with `CornerRadius` property
- SlicedImage: Simple image control for drawing '9SliceSprite'
- Button: Origin button with `CornerRadius` property
- ToggleButton: Origin toggle button with `CornerRadius` property
- ScrollViewer: Origin scroll viewer with 'MouseWheelDelta' based scrolling and scroll smoothing feature
- ConditionalControl: Display the control based on the condition
- TextBox: Origin text box with `Placeholder` and `CornerRadius` property
- ListBox: Origin list box with `CornerRadius` property
- ListBoxItem: Origin list box item with `CornerRadius` property
- TransitioningContentControl: ContentControl that allows you to set transitions
- Frame: Frame that allows you to set transitions
- ProgressBar: Origin progress bar with `CornerRadius` property
- Border: Origin border with `ContentClip` property for binding

Transitions:
### Transitions:

- SlideTransition: Moves the old page out of view, and the new page into view
- FadeTransition: Fades out the current page and fades in the new page by animating the opacity
- SlideFadeTransition: SlideTransition and FadeTransition
- ScaleTransition: Scale the old page to smaller and fade out, and scale the new page from a larger zoom to 1 and fade in
- FadeTransition: Fades out the current content and fades in the new content by animating the opacity
- SlideTransition: Moves the old content out of view, and the new content into view
- SlideFadeTransition: Composite of SlideTransition and FadeTransition
- ScaleTransition: Scale the old content to smaller and fade out, and scale the new content from a larger zoom to 1
- ScaleFadeTransition: Composite of ScaleTransition and FadeTransition
- RotateTransition: Rotate the old content and new content by specified angle
- RotateFadeTransition: Composite of RotateTransition and FadeTransition

Value converters:
### Value converters:

- AddNumberConverter: Mathematical calculations, addition
- SubtractNumberConverter: Mathematical calculations, subtraction
- MultiplyNumberConverter: Mathematical calculations, multiplication
- DivideNumberConverter: Mathematical calculations, division
- ClampNumberConverter: Clamps the given value between the given minimum float and maximum values
- NumberCompareConverter: Compare between numbers, support `equal`, `not equal`, `greator than`, `greator or equal`, `less than`, `less or equal`
- EqualConverter: Check if the value equals converter parameter
- NotEqualConverter: Check if the value not equal to converter parameter
Expand All @@ -105,8 +166,9 @@ Value converters:
- StringToImageSourceConverter: Convert any valid URI string to image source
- NumberToThicknessConverter: Convert number to uniform thickness
- NumberToCornerRadiusConverter: Convert number to uniform corner radius
- InvertThicknessConverter: Invert the given thickness value

Markup extensions:
### Markup extensions:

- String: Represents text as a sequence of UTF-16 code units. (returns System.String)
- Char: Represents a character as a UTF-16 code unit. (returns System.Char)
Expand All @@ -120,11 +182,13 @@ Markup extensions:
- Decimal: Represents a decimal floating-point number. (returns System.Decimal)
- HsvColor: Represents a color from HSV color space values (returns System.Windows.Media.Color)

Animations:
### Animations:

- CornerRadiusAnimation: Animates the value of a CornerRadius property between two target values using linear interpolation over a specified Duration.
- QuadraticBezierEase: Quadratic bezier curve easing function
- CubicBezierEase: Cubic bezier curve easing function

Utilities:
### Utilities:

- BindingProxy: A utility class for binding, commonly used when a collection element has property to be bound to a page DataContext
- ScrollViewerUtils: Utilities for set vertical offset and horizontal offset of scroll viewer and scroll content presenter
Expand Down

0 comments on commit 71bd0fc

Please sign in to comment.