improve RecipeCase by bind only the ImageSource property

pull/19/head
Alexandre Agostinho 2 years ago
parent 58f854bd4d
commit 8af8063ac5

@ -41,41 +41,15 @@
AlignItems="Center" AlignItems="Center"
AlignContent="SpaceEvenly"> AlignContent="SpaceEvenly">
<local:RecipeCase> <local:RecipeCase CaseImageSource="room_service_icon.png"/>
<local:RecipeCase.CaseContent> <local:RecipeCase CaseImageSource="room_service_icon.png"/>
<Image Source="room_service_icon.png"/> <local:RecipeCase CaseImageSource="room_service_icon.png"/>
</local:RecipeCase.CaseContent> <local:RecipeCase CaseImageSource="room_service_icon.png"/>
</local:RecipeCase> <local:RecipeCase CaseImageSource="room_service_icon.png"/>
<local:RecipeCase> <local:RecipeCase CaseImageSource="room_service_icon.png"/>
<local:RecipeCase.CaseContent> <local:RecipeCase CaseImageSource="room_service_icon.png"/>
<Image Source="room_service_icon.png"/> <local:RecipeCase CaseImageSource="room_service_icon.png"/>
</local:RecipeCase.CaseContent> <local:RecipeCase CaseImageSource="room_service_icon.png"/>
</local:RecipeCase>
<local:RecipeCase>
<local:RecipeCase.CaseContent>
<Image Source="room_service_icon.png"/>
</local:RecipeCase.CaseContent>
</local:RecipeCase>
<local:RecipeCase>
<local:RecipeCase.CaseContent>
<Image Source="room_service_icon.png"/>
</local:RecipeCase.CaseContent>
</local:RecipeCase>
<local:RecipeCase>
<local:RecipeCase.CaseContent>
<Image Source="room_service_icon.png"/>
</local:RecipeCase.CaseContent>
</local:RecipeCase>
<local:RecipeCase>
<local:RecipeCase.CaseContent>
<Image Source="room_service_icon.png"/>
</local:RecipeCase.CaseContent>
</local:RecipeCase>
<local:RecipeCase>
<local:RecipeCase.CaseContent>
<Image Source="room_service_icon.png"/>
</local:RecipeCase.CaseContent>
</local:RecipeCase>
</FlexLayout> </FlexLayout>
</StackLayout> </StackLayout>

@ -8,9 +8,9 @@
<Border Style="{StaticResource recipeCase}"> <Border Style="{StaticResource recipeCase}">
<Grid RowDefinitions="*, 40"> <Grid RowDefinitions="*, 40">
<ContentView <Image
Grid.Row="0" VerticalOptions="Fill" Grid.Row="0" VerticalOptions="Fill"
Content="{Binding CaseContent, Source={x:Reference rCase}}"/> Source="{Binding CaseImageSource, Source={x:Reference rCase}}"/>
<Label Text="Recette 1" FontSize="18" <Label Text="Recette 1" FontSize="18"
Grid.Row="1" HorizontalOptions="Center"/> Grid.Row="1" HorizontalOptions="Center"/>

@ -7,12 +7,12 @@ public partial class RecipeCase : ContentView
InitializeComponent(); InitializeComponent();
} }
public static readonly BindableProperty CaseContentProperty = public static readonly BindableProperty CaseImageSourceProperty =
BindableProperty.Create("CaseContent", typeof(View), typeof(RecipeCase), new Grid()); BindableProperty.Create("CaseImageSource", typeof(ImageSource), typeof(Image));
public View CaseContent public ImageSource CaseImageSource
{ {
get => (View)GetValue(CaseContentProperty); get => (ImageSource)GetValue(CaseImageSourceProperty);
set => SetValue(CaseContentProperty, value); set => SetValue(CaseImageSourceProperty, value);
} }
} }

Loading…
Cancel
Save