Skip to content

Commit

Permalink
docs: 变更 readme
Browse files Browse the repository at this point in the history
  • Loading branch information
SlimeNull committed Apr 14, 2024
1 parent 860c91f commit 193bd94
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 21 deletions.
2 changes: 1 addition & 1 deletion EleCho.WpfSuite/EleCho.WpfSuite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<UseWPF>true</UseWPF>
<EnableWindowsTargeting>true</EnableWindowsTargeting>

<Version>0.0.10</Version>
<Version>0.0.11</Version>

<Authors>EleCho</Authors>
<Copyright>Copyright © 2024 EleCho</Copyright>
Expand Down
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,69 @@
# EleCho.WpfSuite

WPF layout panels, controls, value converters and utilities

## Usage

Add XML namespace to your XAML file:

```xml
<Window x:Class="WpfTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfTest"
xmlns:ws="https://github.com/OrgEleCho/EleCho.WpfSuite"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">

...

</Window>
```

Enjoy!

```xml
<Window x:Class="WpfTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfTest"
xmlns:ws="https://github.com/OrgEleCho/EleCho.WpfSuite"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">

<ws:ScrollViewer Margin="12"
ScrollWithWheelDelta="True">
<ws:StackPanel Spacing="8">
<ws:TextBox Width="200"
Placeholder="This is a text box with placeholder"/>
<ws:Image Source="/Assets/TestAvatar.jpg"
CornerRadius="10"/>

<StackPanel>
<TextBlock Text="WrapPanel with spacing"/>
<ItemsControl ItemsSource="{Binding TestItems}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<ws:WrapPanel HorizontalSpacing="8"
VerticalSpacing="8"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</StackPanel>
</ws:StackPanel>
</ws:ScrollViewer>

</Window>
```


## Features


Layout panels:

- StackPanel: Origin stack panel with `Spacing` property
Expand All @@ -11,6 +75,7 @@ Controls:
- Image: Simple image control with `CornerRadius` property
- ScrollViewer: Origin scroll viewer with 'MouseWheelDelta' based scrolling
- ConditionalControl: Display the control based on the condition
- TextBox: Origin text box with `Placeholder` property

Value converters:

Expand Down
40 changes: 20 additions & 20 deletions WpfTest/Tests/TempPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@
Title="TempPage"
d:DataContext="{d:DesignInstance Type=local:TempPage}">

<Grid>
<ws:StackPanel Orientation="Vertical" Spacing="12">
<Border Width="200"
Height="200"
BorderThickness="{Binding ElementName=BorderThicknessSlider,Path=Value}"
BorderBrush="Blue">
<Image Source="/Assets/TestImage1.jpg" />
</Border>
<Slider Name="BorderThicknessSlider" />
<ws:StackPanel Orientation="Horizontal"
Spacing="30"
HorizontalAlignment="Center">
<ws:Image Source="/Assets/TestImage2.jpg"
Width="200"
Height="200"/>
<ws:Image Source="/Assets/TestImage1.jpg"
Width="200"
Height="200"/>
</ws:StackPanel>
<ws:ScrollViewer Margin="12"
ScrollWithWheelDelta="True">
<ws:StackPanel Spacing="8">
<ws:TextBox Width="200"
Placeholder="This is a text box with placeholder"/>
<ws:Image Source="/Assets/TestAvatar.jpg"
CornerRadius="10"/>

<StackPanel>
<TextBlock Text="WrapPanel with spacing"/>
<ItemsControl ItemsSource="{Binding TestItems}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<ws:WrapPanel HorizontalSpacing="8"
VerticalSpacing="8"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</StackPanel>
</ws:StackPanel>
</Grid>
</ws:ScrollViewer>
</Page>

0 comments on commit 193bd94

Please sign in to comment.