parent
5d8bb4d688
commit
f26b307edb
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
xmlns:conv="clr-namespace:Stim.Converter"
|
||||||
|
x:Class="Stim.StarsContainer"
|
||||||
|
x:Name="StarsContainerView">
|
||||||
|
|
||||||
|
<ContentView.Resources>
|
||||||
|
<conv:DoubleToStar x:Key="DoubleToStar" EtoilePleine="etoile_pleine.png" EtoileMiPleine="etoile_mi_pleine.png" EtoileVide="etoile_vide.png"/>
|
||||||
|
</ContentView.Resources>
|
||||||
|
|
||||||
|
<HorizontalStackLayout Grid.Column="1" HorizontalOptions="End" BindingContext="{x:Reference StarsContainerView}">
|
||||||
|
<Label Text="{Binding Rate, FallbackValue='0', StringFormat='{0}/5'}" FontSize="20"/>
|
||||||
|
<Image Style="{StaticResource star}" Source="{Binding Rate, FallbackValue='0', Converter={StaticResource DoubleToStar}, ConverterParameter='1'}"/>
|
||||||
|
<Image Style="{StaticResource star}" Source="{Binding Rate, FallbackValue='0', Converter={StaticResource DoubleToStar}, ConverterParameter='2'}"/>
|
||||||
|
<Image Style="{StaticResource star}" Source="{Binding Rate, FallbackValue='0', Converter={StaticResource DoubleToStar}, ConverterParameter='3'}"/>
|
||||||
|
<Image Style="{StaticResource star}" Source="{Binding Rate, FallbackValue='0', Converter={StaticResource DoubleToStar}, ConverterParameter='4'}"/>
|
||||||
|
<Image Style="{StaticResource star}" Source="{Binding Rate, FallbackValue='0', Converter={StaticResource DoubleToStar}, ConverterParameter='5'}"/>
|
||||||
|
</HorizontalStackLayout>
|
||||||
|
</ContentView>
|
@ -0,0 +1,18 @@
|
|||||||
|
namespace Stim;
|
||||||
|
|
||||||
|
public partial class StarsContainer : ContentView
|
||||||
|
{
|
||||||
|
public static readonly BindableProperty RateProperty =
|
||||||
|
BindableProperty.Create(nameof(Rate), typeof(double), typeof(StarsContainer), double.NaN);
|
||||||
|
|
||||||
|
public double Rate
|
||||||
|
{
|
||||||
|
get => (double)GetValue(StarsContainer.RateProperty);
|
||||||
|
set => SetValue(StarsContainer.RateProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StarsContainer()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue