How to fullfill this UI in Xamarin forms?
I want to fulfill this UI in Xamarin Forms. This is the screenshot of my UI.
So I have no clue how to do this UI in xamarin forms. I'm confused is it cardview or just a view in which I have to add all this images and labels. I need some suggestions for implementing this UI.
user-interface xamarin.forms cardview
add a comment |
I want to fulfill this UI in Xamarin Forms. This is the screenshot of my UI.
So I have no clue how to do this UI in xamarin forms. I'm confused is it cardview or just a view in which I have to add all this images and labels. I need some suggestions for implementing this UI.
user-interface xamarin.forms cardview
this and this is what you need
– G.hakim
Nov 22 '18 at 7:45
@User3452 Are you able to add that " HEART SHAPE " as well. if so kindly tell me how ?
– Hashir Malik
Feb 14 at 17:56
@HashirMalik its simple u just have to add two images in asset. One white heart and one orange heart. And write an event in which when u click on white heart image the image should be replaced by orange heart.
– user3452
Feb 15 at 7:48
add a comment |
I want to fulfill this UI in Xamarin Forms. This is the screenshot of my UI.
So I have no clue how to do this UI in xamarin forms. I'm confused is it cardview or just a view in which I have to add all this images and labels. I need some suggestions for implementing this UI.
user-interface xamarin.forms cardview
I want to fulfill this UI in Xamarin Forms. This is the screenshot of my UI.
So I have no clue how to do this UI in xamarin forms. I'm confused is it cardview or just a view in which I have to add all this images and labels. I need some suggestions for implementing this UI.
user-interface xamarin.forms cardview
user-interface xamarin.forms cardview
asked Nov 22 '18 at 6:41
user3452user3452
549
549
this and this is what you need
– G.hakim
Nov 22 '18 at 7:45
@User3452 Are you able to add that " HEART SHAPE " as well. if so kindly tell me how ?
– Hashir Malik
Feb 14 at 17:56
@HashirMalik its simple u just have to add two images in asset. One white heart and one orange heart. And write an event in which when u click on white heart image the image should be replaced by orange heart.
– user3452
Feb 15 at 7:48
add a comment |
this and this is what you need
– G.hakim
Nov 22 '18 at 7:45
@User3452 Are you able to add that " HEART SHAPE " as well. if so kindly tell me how ?
– Hashir Malik
Feb 14 at 17:56
@HashirMalik its simple u just have to add two images in asset. One white heart and one orange heart. And write an event in which when u click on white heart image the image should be replaced by orange heart.
– user3452
Feb 15 at 7:48
this and this is what you need
– G.hakim
Nov 22 '18 at 7:45
this and this is what you need
– G.hakim
Nov 22 '18 at 7:45
@User3452 Are you able to add that " HEART SHAPE " as well. if so kindly tell me how ?
– Hashir Malik
Feb 14 at 17:56
@User3452 Are you able to add that " HEART SHAPE " as well. if so kindly tell me how ?
– Hashir Malik
Feb 14 at 17:56
@HashirMalik its simple u just have to add two images in asset. One white heart and one orange heart. And write an event in which when u click on white heart image the image should be replaced by orange heart.
– user3452
Feb 15 at 7:48
@HashirMalik its simple u just have to add two images in asset. One white heart and one orange heart. And write an event in which when u click on white heart image the image should be replaced by orange heart.
– user3452
Feb 15 at 7:48
add a comment |
3 Answers
3
active
oldest
votes
I assume that you will have several restaurants as some kind of search result and presumably the view will have to be scrollable if there are many results?
I would implement that with a ListView:
<ListView ItemsSource="{Binding Restaurants} HasUnevenRows="True">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell Height="100">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*">
<RowDefinition Height="*">
<RowDefinition Height="*">
<RowDefinition Height="*">
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Row="0" Grid.Column="0" Grid.RowSpan="4" Source="{Binding PreviewImage}" .... />
<Label Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding Title}" ... />
<Label Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding Address}" ... />
<Label Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding FoodTypes}" ... />
<!-- Add implementations for Rating, Like-Button and other labels in according rows and columns -->
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
You would also need a Model class for your restaurant item which will contain all Data as I have sketched out within the {Binding XXX} tags. In your codebehind you have to create a List (or better an ObservableCollection ) and set that as the ListView's Itemssource.
Also you will probably need to add some effects or custom renderers for the visual touch-ups such as drop shadows, etc.
add a comment |
You can create a "CardView" using the “Frame” layout available in Xamarin.Forms.
The code is as follows:
CardViewTemplate.xml:
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="App68.CardViewTemplate">
<ContentView.Content>
<Frame IsClippedToBounds="True"
HasShadow="True"
Margin="30"
BorderColor="White"
BackgroundColor="White" >
<Frame.OutlineColor>
<OnPlatform x:TypeArguments="Color"
Android="Gray"
iOS="Gray"/>
</Frame.OutlineColor>
<Frame.Margin>
<OnPlatform x:TypeArguments="Thickness"
Android="10"
iOS="10"/>
</Frame.Margin>
<StackLayout Orientation="Horizontal">
<Grid VerticalOptions="CenterAndExpand"
Padding="0"
HorizontalOptions="FillAndExpand"
BackgroundColor="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Row="0" Grid.Column="0" Grid.RowSpan="4" Source="{Binding PreviewImage}" />
<Label Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" Text="{Binding RestaurantName}" />
<Label Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding Address}" />
<Label Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding FoodTypes}" />
<Label Grid.Row="3" Grid.Column="1" Text="{Binding Rating}" />
<Label Grid.Row="3" Grid.Column="2" Text="{Binding Time}" />
<Label Grid.Row="3" Grid.Column="3" Text="{Binding Distance}" />
</Grid>
</StackLayout>
</Frame>
</ContentView.Content>
</ContentView>
MainPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:App68"
x:Class="App68.MainPage">
<StackLayout Orientation="Vertical">
<Label Text="CardView Demo in Xamarin Forms"
FontAttributes="Bold"
FontSize="Medium"
VerticalOptions="Start"
HorizontalTextAlignment="Center"
VerticalTextAlignment="Center"
BackgroundColor="Transparent"
HorizontalOptions="CenterAndExpand" />
<ListView x:Name="listView"
SelectedItem="{Binding SelcetedItem,Mode=TwoWay}"
HasUnevenRows="True"
ItemsSource="{Binding lstRestaurants}" >
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<local:CardViewTemplate/>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage>
Restaurant.cs
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms;
namespace App68
{
class Restaurant
{
public String PreviewImage { get; set; }
public string RestaurantName { get; set; }
public bool IsFavorite { get; set; }
public string Address { get; set; }
public string FoodTypes { get; set; }
public Image RatingIcon { get; set; }
public double Rating { get; set; }
public Image TimeIcon { get; set; }
public double Time { get; set; }
public Image DistanceIcon { get; set; }
public double Distance { get; set; }
}
}
RestaurantViewModel.cs
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms;
namespace App68
{
class RestaurantViewModel
{
public IList<Restaurant> lstRestaurants { get; set; }
public object SelectedItem { get; set; }
public RestaurantViewModel()
{
lstRestaurants = new List<Restaurant>();
GenerateCardModel();
}
private void GenerateCardModel()
{
var restaurant1 = new Restaurant()
{
PreviewImage = "Restaurant_1.jpg",
RestaurantName = "Premera restaurant",
IsFavorite = true,
Address = "Avenue Road 256",
FoodTypes = "India Italy Chinese kitchen",
Rating = 4.3,
Time = 150,
Distance = 3
};
lstRestaurants.Add(restaurant1);
var restaurant2 = new Restaurant()
{
PreviewImage = "Restaurant_2.jpg",
RestaurantName = "Premera restaurant",
IsFavorite = true,
Address = "Avenue Road 256",
FoodTypes = "India Italy Chinese kitchen",
Rating = 4.3,
Time = 150,
Distance = 3
};
lstRestaurants.Add(restaurant2);
}
}
}
The effect is as the follows:
This is perfect. Great job AbbyWang.
– user3452
Nov 27 '18 at 5:47
add a comment |
I used XFXCardview for this UI. And it seems to work pretty well. This is the GitHub link. So these are the changes I did in my code -
<xfx:XfxCardView
BackgroundColor="White"
CornerRadius="30"
Elevation="20"
HeightRequest="150" IsClippedToBounds="True">
<Grid RowSpacing="0" >
<Grid ColumnSpacing="0">
<Grid.RowDefinitions >
<RowDefinition Height="2*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Frame Margin="10,10,10,-20" Padding="-30" CornerRadius="10" Grid.RowSpan="3" BackgroundColor="LightBlue" IsClippedToBounds="True">
<Image Margin="-70,0,0,0" Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" BackgroundColor="AliceBlue" Source="restaurantimage1.jpg" />
</Frame>
<Label Grid.Row="0" Grid.Column="1" Margin="0,30,30,0" HorizontalOptions="Start" Text="Premera restaurant" TextColor="Black" FontFamily="Bold,20"/>
<Image Grid.Row="0" Grid.Column="1" Margin="0,30,10,0" HorizontalOptions="End" Source="whitehearticon3.jpg"/>
<Label Grid.Row="1" Grid.Column="1" Margin="0,-20,40,0" HorizontalTextAlignment="Start" Text="Avenue Road,256" TextColor="Blue"/>
<Label Grid.Row="2" Grid.Column="1" Margin="0,-40,40,0" VerticalTextAlignment="Start" Text="Indian,Italy,Chinese Kitchen" TextColor="LightGray"/>
<Image Grid.Row="3" Grid.Column="1" Margin="0,-20,30,0" Source="whitestaricon1.png" WidthRequest="10" HeightRequest="10" BackgroundColor="Blue"/>
<Label Grid.Row="3" Grid.Column="1" Margin="0,-20,40,0" HorizontalTextAlignment="Center" Text="4,3"/>
</Grid>
</Grid>
</xfx:XfxCardView>
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53425207%2fhow-to-fullfill-this-ui-in-xamarin-forms%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
I assume that you will have several restaurants as some kind of search result and presumably the view will have to be scrollable if there are many results?
I would implement that with a ListView:
<ListView ItemsSource="{Binding Restaurants} HasUnevenRows="True">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell Height="100">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*">
<RowDefinition Height="*">
<RowDefinition Height="*">
<RowDefinition Height="*">
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Row="0" Grid.Column="0" Grid.RowSpan="4" Source="{Binding PreviewImage}" .... />
<Label Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding Title}" ... />
<Label Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding Address}" ... />
<Label Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding FoodTypes}" ... />
<!-- Add implementations for Rating, Like-Button and other labels in according rows and columns -->
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
You would also need a Model class for your restaurant item which will contain all Data as I have sketched out within the {Binding XXX} tags. In your codebehind you have to create a List (or better an ObservableCollection ) and set that as the ListView's Itemssource.
Also you will probably need to add some effects or custom renderers for the visual touch-ups such as drop shadows, etc.
add a comment |
I assume that you will have several restaurants as some kind of search result and presumably the view will have to be scrollable if there are many results?
I would implement that with a ListView:
<ListView ItemsSource="{Binding Restaurants} HasUnevenRows="True">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell Height="100">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*">
<RowDefinition Height="*">
<RowDefinition Height="*">
<RowDefinition Height="*">
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Row="0" Grid.Column="0" Grid.RowSpan="4" Source="{Binding PreviewImage}" .... />
<Label Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding Title}" ... />
<Label Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding Address}" ... />
<Label Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding FoodTypes}" ... />
<!-- Add implementations for Rating, Like-Button and other labels in according rows and columns -->
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
You would also need a Model class for your restaurant item which will contain all Data as I have sketched out within the {Binding XXX} tags. In your codebehind you have to create a List (or better an ObservableCollection ) and set that as the ListView's Itemssource.
Also you will probably need to add some effects or custom renderers for the visual touch-ups such as drop shadows, etc.
add a comment |
I assume that you will have several restaurants as some kind of search result and presumably the view will have to be scrollable if there are many results?
I would implement that with a ListView:
<ListView ItemsSource="{Binding Restaurants} HasUnevenRows="True">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell Height="100">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*">
<RowDefinition Height="*">
<RowDefinition Height="*">
<RowDefinition Height="*">
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Row="0" Grid.Column="0" Grid.RowSpan="4" Source="{Binding PreviewImage}" .... />
<Label Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding Title}" ... />
<Label Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding Address}" ... />
<Label Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding FoodTypes}" ... />
<!-- Add implementations for Rating, Like-Button and other labels in according rows and columns -->
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
You would also need a Model class for your restaurant item which will contain all Data as I have sketched out within the {Binding XXX} tags. In your codebehind you have to create a List (or better an ObservableCollection ) and set that as the ListView's Itemssource.
Also you will probably need to add some effects or custom renderers for the visual touch-ups such as drop shadows, etc.
I assume that you will have several restaurants as some kind of search result and presumably the view will have to be scrollable if there are many results?
I would implement that with a ListView:
<ListView ItemsSource="{Binding Restaurants} HasUnevenRows="True">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell Height="100">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*">
<RowDefinition Height="*">
<RowDefinition Height="*">
<RowDefinition Height="*">
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Row="0" Grid.Column="0" Grid.RowSpan="4" Source="{Binding PreviewImage}" .... />
<Label Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding Title}" ... />
<Label Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding Address}" ... />
<Label Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding FoodTypes}" ... />
<!-- Add implementations for Rating, Like-Button and other labels in according rows and columns -->
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
You would also need a Model class for your restaurant item which will contain all Data as I have sketched out within the {Binding XXX} tags. In your codebehind you have to create a List (or better an ObservableCollection ) and set that as the ListView's Itemssource.
Also you will probably need to add some effects or custom renderers for the visual touch-ups such as drop shadows, etc.
answered Nov 22 '18 at 7:58
Markus MichelMarkus Michel
1,517315
1,517315
add a comment |
add a comment |
You can create a "CardView" using the “Frame” layout available in Xamarin.Forms.
The code is as follows:
CardViewTemplate.xml:
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="App68.CardViewTemplate">
<ContentView.Content>
<Frame IsClippedToBounds="True"
HasShadow="True"
Margin="30"
BorderColor="White"
BackgroundColor="White" >
<Frame.OutlineColor>
<OnPlatform x:TypeArguments="Color"
Android="Gray"
iOS="Gray"/>
</Frame.OutlineColor>
<Frame.Margin>
<OnPlatform x:TypeArguments="Thickness"
Android="10"
iOS="10"/>
</Frame.Margin>
<StackLayout Orientation="Horizontal">
<Grid VerticalOptions="CenterAndExpand"
Padding="0"
HorizontalOptions="FillAndExpand"
BackgroundColor="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Row="0" Grid.Column="0" Grid.RowSpan="4" Source="{Binding PreviewImage}" />
<Label Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" Text="{Binding RestaurantName}" />
<Label Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding Address}" />
<Label Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding FoodTypes}" />
<Label Grid.Row="3" Grid.Column="1" Text="{Binding Rating}" />
<Label Grid.Row="3" Grid.Column="2" Text="{Binding Time}" />
<Label Grid.Row="3" Grid.Column="3" Text="{Binding Distance}" />
</Grid>
</StackLayout>
</Frame>
</ContentView.Content>
</ContentView>
MainPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:App68"
x:Class="App68.MainPage">
<StackLayout Orientation="Vertical">
<Label Text="CardView Demo in Xamarin Forms"
FontAttributes="Bold"
FontSize="Medium"
VerticalOptions="Start"
HorizontalTextAlignment="Center"
VerticalTextAlignment="Center"
BackgroundColor="Transparent"
HorizontalOptions="CenterAndExpand" />
<ListView x:Name="listView"
SelectedItem="{Binding SelcetedItem,Mode=TwoWay}"
HasUnevenRows="True"
ItemsSource="{Binding lstRestaurants}" >
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<local:CardViewTemplate/>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage>
Restaurant.cs
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms;
namespace App68
{
class Restaurant
{
public String PreviewImage { get; set; }
public string RestaurantName { get; set; }
public bool IsFavorite { get; set; }
public string Address { get; set; }
public string FoodTypes { get; set; }
public Image RatingIcon { get; set; }
public double Rating { get; set; }
public Image TimeIcon { get; set; }
public double Time { get; set; }
public Image DistanceIcon { get; set; }
public double Distance { get; set; }
}
}
RestaurantViewModel.cs
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms;
namespace App68
{
class RestaurantViewModel
{
public IList<Restaurant> lstRestaurants { get; set; }
public object SelectedItem { get; set; }
public RestaurantViewModel()
{
lstRestaurants = new List<Restaurant>();
GenerateCardModel();
}
private void GenerateCardModel()
{
var restaurant1 = new Restaurant()
{
PreviewImage = "Restaurant_1.jpg",
RestaurantName = "Premera restaurant",
IsFavorite = true,
Address = "Avenue Road 256",
FoodTypes = "India Italy Chinese kitchen",
Rating = 4.3,
Time = 150,
Distance = 3
};
lstRestaurants.Add(restaurant1);
var restaurant2 = new Restaurant()
{
PreviewImage = "Restaurant_2.jpg",
RestaurantName = "Premera restaurant",
IsFavorite = true,
Address = "Avenue Road 256",
FoodTypes = "India Italy Chinese kitchen",
Rating = 4.3,
Time = 150,
Distance = 3
};
lstRestaurants.Add(restaurant2);
}
}
}
The effect is as the follows:
This is perfect. Great job AbbyWang.
– user3452
Nov 27 '18 at 5:47
add a comment |
You can create a "CardView" using the “Frame” layout available in Xamarin.Forms.
The code is as follows:
CardViewTemplate.xml:
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="App68.CardViewTemplate">
<ContentView.Content>
<Frame IsClippedToBounds="True"
HasShadow="True"
Margin="30"
BorderColor="White"
BackgroundColor="White" >
<Frame.OutlineColor>
<OnPlatform x:TypeArguments="Color"
Android="Gray"
iOS="Gray"/>
</Frame.OutlineColor>
<Frame.Margin>
<OnPlatform x:TypeArguments="Thickness"
Android="10"
iOS="10"/>
</Frame.Margin>
<StackLayout Orientation="Horizontal">
<Grid VerticalOptions="CenterAndExpand"
Padding="0"
HorizontalOptions="FillAndExpand"
BackgroundColor="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Row="0" Grid.Column="0" Grid.RowSpan="4" Source="{Binding PreviewImage}" />
<Label Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" Text="{Binding RestaurantName}" />
<Label Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding Address}" />
<Label Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding FoodTypes}" />
<Label Grid.Row="3" Grid.Column="1" Text="{Binding Rating}" />
<Label Grid.Row="3" Grid.Column="2" Text="{Binding Time}" />
<Label Grid.Row="3" Grid.Column="3" Text="{Binding Distance}" />
</Grid>
</StackLayout>
</Frame>
</ContentView.Content>
</ContentView>
MainPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:App68"
x:Class="App68.MainPage">
<StackLayout Orientation="Vertical">
<Label Text="CardView Demo in Xamarin Forms"
FontAttributes="Bold"
FontSize="Medium"
VerticalOptions="Start"
HorizontalTextAlignment="Center"
VerticalTextAlignment="Center"
BackgroundColor="Transparent"
HorizontalOptions="CenterAndExpand" />
<ListView x:Name="listView"
SelectedItem="{Binding SelcetedItem,Mode=TwoWay}"
HasUnevenRows="True"
ItemsSource="{Binding lstRestaurants}" >
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<local:CardViewTemplate/>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage>
Restaurant.cs
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms;
namespace App68
{
class Restaurant
{
public String PreviewImage { get; set; }
public string RestaurantName { get; set; }
public bool IsFavorite { get; set; }
public string Address { get; set; }
public string FoodTypes { get; set; }
public Image RatingIcon { get; set; }
public double Rating { get; set; }
public Image TimeIcon { get; set; }
public double Time { get; set; }
public Image DistanceIcon { get; set; }
public double Distance { get; set; }
}
}
RestaurantViewModel.cs
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms;
namespace App68
{
class RestaurantViewModel
{
public IList<Restaurant> lstRestaurants { get; set; }
public object SelectedItem { get; set; }
public RestaurantViewModel()
{
lstRestaurants = new List<Restaurant>();
GenerateCardModel();
}
private void GenerateCardModel()
{
var restaurant1 = new Restaurant()
{
PreviewImage = "Restaurant_1.jpg",
RestaurantName = "Premera restaurant",
IsFavorite = true,
Address = "Avenue Road 256",
FoodTypes = "India Italy Chinese kitchen",
Rating = 4.3,
Time = 150,
Distance = 3
};
lstRestaurants.Add(restaurant1);
var restaurant2 = new Restaurant()
{
PreviewImage = "Restaurant_2.jpg",
RestaurantName = "Premera restaurant",
IsFavorite = true,
Address = "Avenue Road 256",
FoodTypes = "India Italy Chinese kitchen",
Rating = 4.3,
Time = 150,
Distance = 3
};
lstRestaurants.Add(restaurant2);
}
}
}
The effect is as the follows:
This is perfect. Great job AbbyWang.
– user3452
Nov 27 '18 at 5:47
add a comment |
You can create a "CardView" using the “Frame” layout available in Xamarin.Forms.
The code is as follows:
CardViewTemplate.xml:
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="App68.CardViewTemplate">
<ContentView.Content>
<Frame IsClippedToBounds="True"
HasShadow="True"
Margin="30"
BorderColor="White"
BackgroundColor="White" >
<Frame.OutlineColor>
<OnPlatform x:TypeArguments="Color"
Android="Gray"
iOS="Gray"/>
</Frame.OutlineColor>
<Frame.Margin>
<OnPlatform x:TypeArguments="Thickness"
Android="10"
iOS="10"/>
</Frame.Margin>
<StackLayout Orientation="Horizontal">
<Grid VerticalOptions="CenterAndExpand"
Padding="0"
HorizontalOptions="FillAndExpand"
BackgroundColor="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Row="0" Grid.Column="0" Grid.RowSpan="4" Source="{Binding PreviewImage}" />
<Label Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" Text="{Binding RestaurantName}" />
<Label Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding Address}" />
<Label Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding FoodTypes}" />
<Label Grid.Row="3" Grid.Column="1" Text="{Binding Rating}" />
<Label Grid.Row="3" Grid.Column="2" Text="{Binding Time}" />
<Label Grid.Row="3" Grid.Column="3" Text="{Binding Distance}" />
</Grid>
</StackLayout>
</Frame>
</ContentView.Content>
</ContentView>
MainPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:App68"
x:Class="App68.MainPage">
<StackLayout Orientation="Vertical">
<Label Text="CardView Demo in Xamarin Forms"
FontAttributes="Bold"
FontSize="Medium"
VerticalOptions="Start"
HorizontalTextAlignment="Center"
VerticalTextAlignment="Center"
BackgroundColor="Transparent"
HorizontalOptions="CenterAndExpand" />
<ListView x:Name="listView"
SelectedItem="{Binding SelcetedItem,Mode=TwoWay}"
HasUnevenRows="True"
ItemsSource="{Binding lstRestaurants}" >
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<local:CardViewTemplate/>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage>
Restaurant.cs
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms;
namespace App68
{
class Restaurant
{
public String PreviewImage { get; set; }
public string RestaurantName { get; set; }
public bool IsFavorite { get; set; }
public string Address { get; set; }
public string FoodTypes { get; set; }
public Image RatingIcon { get; set; }
public double Rating { get; set; }
public Image TimeIcon { get; set; }
public double Time { get; set; }
public Image DistanceIcon { get; set; }
public double Distance { get; set; }
}
}
RestaurantViewModel.cs
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms;
namespace App68
{
class RestaurantViewModel
{
public IList<Restaurant> lstRestaurants { get; set; }
public object SelectedItem { get; set; }
public RestaurantViewModel()
{
lstRestaurants = new List<Restaurant>();
GenerateCardModel();
}
private void GenerateCardModel()
{
var restaurant1 = new Restaurant()
{
PreviewImage = "Restaurant_1.jpg",
RestaurantName = "Premera restaurant",
IsFavorite = true,
Address = "Avenue Road 256",
FoodTypes = "India Italy Chinese kitchen",
Rating = 4.3,
Time = 150,
Distance = 3
};
lstRestaurants.Add(restaurant1);
var restaurant2 = new Restaurant()
{
PreviewImage = "Restaurant_2.jpg",
RestaurantName = "Premera restaurant",
IsFavorite = true,
Address = "Avenue Road 256",
FoodTypes = "India Italy Chinese kitchen",
Rating = 4.3,
Time = 150,
Distance = 3
};
lstRestaurants.Add(restaurant2);
}
}
}
The effect is as the follows:
You can create a "CardView" using the “Frame” layout available in Xamarin.Forms.
The code is as follows:
CardViewTemplate.xml:
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="App68.CardViewTemplate">
<ContentView.Content>
<Frame IsClippedToBounds="True"
HasShadow="True"
Margin="30"
BorderColor="White"
BackgroundColor="White" >
<Frame.OutlineColor>
<OnPlatform x:TypeArguments="Color"
Android="Gray"
iOS="Gray"/>
</Frame.OutlineColor>
<Frame.Margin>
<OnPlatform x:TypeArguments="Thickness"
Android="10"
iOS="10"/>
</Frame.Margin>
<StackLayout Orientation="Horizontal">
<Grid VerticalOptions="CenterAndExpand"
Padding="0"
HorizontalOptions="FillAndExpand"
BackgroundColor="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Row="0" Grid.Column="0" Grid.RowSpan="4" Source="{Binding PreviewImage}" />
<Label Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" Text="{Binding RestaurantName}" />
<Label Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding Address}" />
<Label Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding FoodTypes}" />
<Label Grid.Row="3" Grid.Column="1" Text="{Binding Rating}" />
<Label Grid.Row="3" Grid.Column="2" Text="{Binding Time}" />
<Label Grid.Row="3" Grid.Column="3" Text="{Binding Distance}" />
</Grid>
</StackLayout>
</Frame>
</ContentView.Content>
</ContentView>
MainPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:App68"
x:Class="App68.MainPage">
<StackLayout Orientation="Vertical">
<Label Text="CardView Demo in Xamarin Forms"
FontAttributes="Bold"
FontSize="Medium"
VerticalOptions="Start"
HorizontalTextAlignment="Center"
VerticalTextAlignment="Center"
BackgroundColor="Transparent"
HorizontalOptions="CenterAndExpand" />
<ListView x:Name="listView"
SelectedItem="{Binding SelcetedItem,Mode=TwoWay}"
HasUnevenRows="True"
ItemsSource="{Binding lstRestaurants}" >
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<local:CardViewTemplate/>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage>
Restaurant.cs
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms;
namespace App68
{
class Restaurant
{
public String PreviewImage { get; set; }
public string RestaurantName { get; set; }
public bool IsFavorite { get; set; }
public string Address { get; set; }
public string FoodTypes { get; set; }
public Image RatingIcon { get; set; }
public double Rating { get; set; }
public Image TimeIcon { get; set; }
public double Time { get; set; }
public Image DistanceIcon { get; set; }
public double Distance { get; set; }
}
}
RestaurantViewModel.cs
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms;
namespace App68
{
class RestaurantViewModel
{
public IList<Restaurant> lstRestaurants { get; set; }
public object SelectedItem { get; set; }
public RestaurantViewModel()
{
lstRestaurants = new List<Restaurant>();
GenerateCardModel();
}
private void GenerateCardModel()
{
var restaurant1 = new Restaurant()
{
PreviewImage = "Restaurant_1.jpg",
RestaurantName = "Premera restaurant",
IsFavorite = true,
Address = "Avenue Road 256",
FoodTypes = "India Italy Chinese kitchen",
Rating = 4.3,
Time = 150,
Distance = 3
};
lstRestaurants.Add(restaurant1);
var restaurant2 = new Restaurant()
{
PreviewImage = "Restaurant_2.jpg",
RestaurantName = "Premera restaurant",
IsFavorite = true,
Address = "Avenue Road 256",
FoodTypes = "India Italy Chinese kitchen",
Rating = 4.3,
Time = 150,
Distance = 3
};
lstRestaurants.Add(restaurant2);
}
}
}
The effect is as the follows:
answered Nov 23 '18 at 7:29
AbbyWang - MSFTAbbyWang - MSFT
53916
53916
This is perfect. Great job AbbyWang.
– user3452
Nov 27 '18 at 5:47
add a comment |
This is perfect. Great job AbbyWang.
– user3452
Nov 27 '18 at 5:47
This is perfect. Great job AbbyWang.
– user3452
Nov 27 '18 at 5:47
This is perfect. Great job AbbyWang.
– user3452
Nov 27 '18 at 5:47
add a comment |
I used XFXCardview for this UI. And it seems to work pretty well. This is the GitHub link. So these are the changes I did in my code -
<xfx:XfxCardView
BackgroundColor="White"
CornerRadius="30"
Elevation="20"
HeightRequest="150" IsClippedToBounds="True">
<Grid RowSpacing="0" >
<Grid ColumnSpacing="0">
<Grid.RowDefinitions >
<RowDefinition Height="2*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Frame Margin="10,10,10,-20" Padding="-30" CornerRadius="10" Grid.RowSpan="3" BackgroundColor="LightBlue" IsClippedToBounds="True">
<Image Margin="-70,0,0,0" Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" BackgroundColor="AliceBlue" Source="restaurantimage1.jpg" />
</Frame>
<Label Grid.Row="0" Grid.Column="1" Margin="0,30,30,0" HorizontalOptions="Start" Text="Premera restaurant" TextColor="Black" FontFamily="Bold,20"/>
<Image Grid.Row="0" Grid.Column="1" Margin="0,30,10,0" HorizontalOptions="End" Source="whitehearticon3.jpg"/>
<Label Grid.Row="1" Grid.Column="1" Margin="0,-20,40,0" HorizontalTextAlignment="Start" Text="Avenue Road,256" TextColor="Blue"/>
<Label Grid.Row="2" Grid.Column="1" Margin="0,-40,40,0" VerticalTextAlignment="Start" Text="Indian,Italy,Chinese Kitchen" TextColor="LightGray"/>
<Image Grid.Row="3" Grid.Column="1" Margin="0,-20,30,0" Source="whitestaricon1.png" WidthRequest="10" HeightRequest="10" BackgroundColor="Blue"/>
<Label Grid.Row="3" Grid.Column="1" Margin="0,-20,40,0" HorizontalTextAlignment="Center" Text="4,3"/>
</Grid>
</Grid>
</xfx:XfxCardView>
add a comment |
I used XFXCardview for this UI. And it seems to work pretty well. This is the GitHub link. So these are the changes I did in my code -
<xfx:XfxCardView
BackgroundColor="White"
CornerRadius="30"
Elevation="20"
HeightRequest="150" IsClippedToBounds="True">
<Grid RowSpacing="0" >
<Grid ColumnSpacing="0">
<Grid.RowDefinitions >
<RowDefinition Height="2*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Frame Margin="10,10,10,-20" Padding="-30" CornerRadius="10" Grid.RowSpan="3" BackgroundColor="LightBlue" IsClippedToBounds="True">
<Image Margin="-70,0,0,0" Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" BackgroundColor="AliceBlue" Source="restaurantimage1.jpg" />
</Frame>
<Label Grid.Row="0" Grid.Column="1" Margin="0,30,30,0" HorizontalOptions="Start" Text="Premera restaurant" TextColor="Black" FontFamily="Bold,20"/>
<Image Grid.Row="0" Grid.Column="1" Margin="0,30,10,0" HorizontalOptions="End" Source="whitehearticon3.jpg"/>
<Label Grid.Row="1" Grid.Column="1" Margin="0,-20,40,0" HorizontalTextAlignment="Start" Text="Avenue Road,256" TextColor="Blue"/>
<Label Grid.Row="2" Grid.Column="1" Margin="0,-40,40,0" VerticalTextAlignment="Start" Text="Indian,Italy,Chinese Kitchen" TextColor="LightGray"/>
<Image Grid.Row="3" Grid.Column="1" Margin="0,-20,30,0" Source="whitestaricon1.png" WidthRequest="10" HeightRequest="10" BackgroundColor="Blue"/>
<Label Grid.Row="3" Grid.Column="1" Margin="0,-20,40,0" HorizontalTextAlignment="Center" Text="4,3"/>
</Grid>
</Grid>
</xfx:XfxCardView>
add a comment |
I used XFXCardview for this UI. And it seems to work pretty well. This is the GitHub link. So these are the changes I did in my code -
<xfx:XfxCardView
BackgroundColor="White"
CornerRadius="30"
Elevation="20"
HeightRequest="150" IsClippedToBounds="True">
<Grid RowSpacing="0" >
<Grid ColumnSpacing="0">
<Grid.RowDefinitions >
<RowDefinition Height="2*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Frame Margin="10,10,10,-20" Padding="-30" CornerRadius="10" Grid.RowSpan="3" BackgroundColor="LightBlue" IsClippedToBounds="True">
<Image Margin="-70,0,0,0" Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" BackgroundColor="AliceBlue" Source="restaurantimage1.jpg" />
</Frame>
<Label Grid.Row="0" Grid.Column="1" Margin="0,30,30,0" HorizontalOptions="Start" Text="Premera restaurant" TextColor="Black" FontFamily="Bold,20"/>
<Image Grid.Row="0" Grid.Column="1" Margin="0,30,10,0" HorizontalOptions="End" Source="whitehearticon3.jpg"/>
<Label Grid.Row="1" Grid.Column="1" Margin="0,-20,40,0" HorizontalTextAlignment="Start" Text="Avenue Road,256" TextColor="Blue"/>
<Label Grid.Row="2" Grid.Column="1" Margin="0,-40,40,0" VerticalTextAlignment="Start" Text="Indian,Italy,Chinese Kitchen" TextColor="LightGray"/>
<Image Grid.Row="3" Grid.Column="1" Margin="0,-20,30,0" Source="whitestaricon1.png" WidthRequest="10" HeightRequest="10" BackgroundColor="Blue"/>
<Label Grid.Row="3" Grid.Column="1" Margin="0,-20,40,0" HorizontalTextAlignment="Center" Text="4,3"/>
</Grid>
</Grid>
</xfx:XfxCardView>
I used XFXCardview for this UI. And it seems to work pretty well. This is the GitHub link. So these are the changes I did in my code -
<xfx:XfxCardView
BackgroundColor="White"
CornerRadius="30"
Elevation="20"
HeightRequest="150" IsClippedToBounds="True">
<Grid RowSpacing="0" >
<Grid ColumnSpacing="0">
<Grid.RowDefinitions >
<RowDefinition Height="2*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Frame Margin="10,10,10,-20" Padding="-30" CornerRadius="10" Grid.RowSpan="3" BackgroundColor="LightBlue" IsClippedToBounds="True">
<Image Margin="-70,0,0,0" Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" BackgroundColor="AliceBlue" Source="restaurantimage1.jpg" />
</Frame>
<Label Grid.Row="0" Grid.Column="1" Margin="0,30,30,0" HorizontalOptions="Start" Text="Premera restaurant" TextColor="Black" FontFamily="Bold,20"/>
<Image Grid.Row="0" Grid.Column="1" Margin="0,30,10,0" HorizontalOptions="End" Source="whitehearticon3.jpg"/>
<Label Grid.Row="1" Grid.Column="1" Margin="0,-20,40,0" HorizontalTextAlignment="Start" Text="Avenue Road,256" TextColor="Blue"/>
<Label Grid.Row="2" Grid.Column="1" Margin="0,-40,40,0" VerticalTextAlignment="Start" Text="Indian,Italy,Chinese Kitchen" TextColor="LightGray"/>
<Image Grid.Row="3" Grid.Column="1" Margin="0,-20,30,0" Source="whitestaricon1.png" WidthRequest="10" HeightRequest="10" BackgroundColor="Blue"/>
<Label Grid.Row="3" Grid.Column="1" Margin="0,-20,40,0" HorizontalTextAlignment="Center" Text="4,3"/>
</Grid>
</Grid>
</xfx:XfxCardView>
answered Nov 27 '18 at 5:53
user3452user3452
549
549
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53425207%2fhow-to-fullfill-this-ui-in-xamarin-forms%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
this and this is what you need
– G.hakim
Nov 22 '18 at 7:45
@User3452 Are you able to add that " HEART SHAPE " as well. if so kindly tell me how ?
– Hashir Malik
Feb 14 at 17:56
@HashirMalik its simple u just have to add two images in asset. One white heart and one orange heart. And write an event in which when u click on white heart image the image should be replaced by orange heart.
– user3452
Feb 15 at 7:48