I created a View(BlankScreen) which has Image and in the code behind of the view I created a BindableProperty Icon.
View's Xaml Code:
<ContentView
x:Class="Demo.CustomViews.BlankScreen"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<ContentView.Content>
<StackLayout>
<Label Text="Hello Xamarin.Forms!" />
<Image x:Name="image"/>
</StackLayout>
</ContentView.Content>
</ContentView>
View's Code Behind:
public partial class BlankScreen : ContentView
{
public BlankScreen ()
{
InitializeComponent ();
}
public static readonly BindableProperty IconProperty =
BindableProperty.Create(nameof(Icon), typeof(ImageSource), typeof(BlankScreen), null);
public ImageSource Icon
{
get => (ImageSource)GetValue(IconProperty);
set => SetValue(IconProperty, value);
}
}
Then I used this view to Page so I included this view with BindableProperty Icon.
<customviews:BlankScreen Icon="chat" />
But Problem is chat icon not able to set on my view which was passed from the parent page's view.
So how can i solve this issue, please help?