You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.3 KiB

using System.Windows.Input;
namespace ex_CustomContentView;
public partial class MyAvatarView : ContentView
{
public MyAvatarView()
{
InitializeComponent();
}
public static readonly BindableProperty ImageNameProperty =
BindableProperty.Create("ImageName", typeof(string), typeof(MyAvatarView), "");
public string ImageName
{
get => (string)GetValue(ImageNameProperty);
set => SetValue(ImageNameProperty, value);
}
public static readonly BindableProperty TitleProperty =
BindableProperty.Create("Title", typeof(string), typeof(MyAvatarView), "No Title");
public string Title
{
get => (string)GetValue(TitleProperty);
set => SetValue(TitleProperty, value);
}
public static readonly BindableProperty SubTitleProperty =
BindableProperty.Create("SubTitle", typeof(string), typeof(MyAvatarView), "Lorem Ipsum Dolor");
public string SubTitle
{
get => (string)GetValue(SubTitleProperty);
set => SetValue(SubTitleProperty, value);
}
public static readonly BindableProperty ColorProperty =
BindableProperty.Create("Color", typeof(Color), typeof(MyAvatarView), Colors.Gray);
public Color Color
{
get => (Color)GetValue(ColorProperty);
set => SetValue(ColorProperty, value);
}
public event EventHandler NextClicked
{
add => nextButton.Clicked += value;
remove => nextButton.Clicked -= value;
}
public event EventHandler InfoClicked;
void OnInfoClicked(object sender, EventArgs args)
{
InfoClicked?.Invoke(this, args);
}
public event EventHandler<TappedEventArgs> Tapped;
private void OnTapped(object sender, TappedEventArgs e)
{
Tapped?.Invoke(this, e);
}
public static readonly BindableProperty NextCommandProperty =
BindableProperty.Create("NextCommand", typeof(ICommand), typeof(MyAvatarView), null);
public ICommand NextCommand
{
get => (ICommand)GetValue(NextCommandProperty);
set => SetValue(NextCommandProperty, value);
}
public static readonly BindableProperty NextCommandParameterProperty =
BindableProperty.Create("NextCommandParameter", typeof(object), typeof(MyAvatarView), null);
public object NextCommandParameter
{
get => GetValue(NextCommandParameterProperty);
set => SetValue(NextCommandParameterProperty, value);
}
}