Files
Ursa.Avalonia/demo/Ursa.Demo/Pages/RatingDemo.axaml
2024-06-07 18:27:09 +08:00

123 lines
5.5 KiB
XML

<UserControl x:Class="Ursa.Demo.Pages.RatingDemo"
xmlns="https://github.com/avaloniaui"
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:vm="clr-namespace:Ursa.Demo.ViewModels"
xmlns:u="https://irihi.tech/ursa"
d:DesignHeight="450"
d:DesignWidth="800"
x:CompileBindings="True"
x:DataType="vm:RatingDemoViewModel"
mc:Ignorable="d">
<UserControl.Resources>
<StreamGeometry x:Key="LoveHeartGeometry">
M12 5.99999C10.5 2.12432 5.75193 2.0557 3.40383 4.4038C0.865423 6.94221 0.999999 10.5 3.50001 14C5.52139 16.8299 9.83088 20.3136 11.4069 21.5438C11.7573 21.8172 12.2427 21.8172 12.5931 21.5438C14.1691 20.3136 18.4786 16.8299 20.5 14C23 10.5 23.1346 6.94221 20.5962 4.4038C18.2481 2.0557 14.5 2.12432 12 5.99999Z
</StreamGeometry>
</UserControl.Resources>
<StackPanel Spacing="20">
<Grid ColumnDefinitions="*, 300">
<Grid Grid.Column="0">
<StackPanel HorizontalAlignment="Center">
<u:Rating
AllowClear="{Binding AllowClear}"
AllowHalf="{Binding AllowHalf}"
IsEnabled="{Binding IsEnabled}"
Value="{Binding Value}"
Count="{Binding Count}"
DefaultValue="{Binding DefaultValue}" />
<u:Rating
Classes="Small"
AllowClear="{Binding AllowClear}"
AllowHalf="{Binding AllowHalf}"
IsEnabled="{Binding IsEnabled}"
Value="{Binding Value}"
Count="{Binding Count}"
DefaultValue="{Binding DefaultValue}" />
<u:Rating
Size="48"
AllowClear="{Binding AllowClear}"
AllowHalf="{Binding AllowHalf}"
IsEnabled="{Binding IsEnabled}"
Value="{Binding Value}"
Count="{Binding Count}"
DefaultValue="{Binding DefaultValue}"
Foreground="{StaticResource SemiRed5}"
Character="{StaticResource LoveHeartGeometry}" />
</StackPanel>
</Grid>
<Border Grid.Column="1" VerticalAlignment="Top">
<Grid ColumnDefinitions="*, Auto" RowDefinitions="*,*,*,*,*,*,*,*">
<Label
Grid.Row="0"
Grid.Column="0"
VerticalAlignment="Center"
Content="AllowClear" />
<ToggleSwitch
Grid.Row="0"
Grid.Column="1"
MinWidth="200"
IsChecked="{Binding AllowClear}" />
<Label
Grid.Row="1"
Grid.Column="0"
VerticalAlignment="Center"
Content="AllowHalf" />
<ToggleSwitch
Grid.Row="1"
Grid.Column="1"
VerticalAlignment="Center"
IsChecked="{Binding AllowHalf}" />
<Label
Grid.Row="3"
Grid.Column="0"
VerticalAlignment="Center"
Content="IsEnabled" />
<ToggleSwitch
Grid.Row="3"
Grid.Column="1"
VerticalAlignment="Center"
IsChecked="{Binding IsEnabled}" />
<Label
Grid.Row="4"
Grid.Column="0"
VerticalAlignment="Center"
Content="DefaultValue" />
<Label
Grid.Row="4"
Grid.Column="1"
Theme="{StaticResource TagLabel}"
Classes="Large"
VerticalAlignment="Center"
Content="{Binding DefaultValue}" />
<Label
Grid.Row="5"
Grid.Column="0"
VerticalAlignment="Center"
Content="Value" />
<NumericUpDown
Grid.Row="5"
Grid.Column="1"
Maximum="100"
Minimum="-10"
Increment="0.1"
VerticalAlignment="Center"
Value="{Binding Value}" />
<Label
Grid.Row="6"
Grid.Column="0"
VerticalAlignment="Center"
Content="Count" />
<NumericUpDown
Grid.Row="6"
Grid.Column="1"
Maximum="100"
Minimum="-10"
Increment="1"
VerticalAlignment="Center"
Value="{Binding Count}" />
</Grid>
</Border>
</Grid>
</StackPanel>
</UserControl>