This repository has been archived on 2020-12-20. You can view files and clone it, but cannot push or open issues or pull requests.
aurora-sharp-desktop/Aurora/Design/Components/MemberList/MemberList.xaml.cs

62 lines
1.9 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using Xamarin.Forms;
2019-07-05 18:17:09 +00:00
using Aurora.Design.Components.HorizontalList;
2019-07-05 18:17:09 +00:00
namespace Aurora.Design.Components.MemberList
{
public partial class MemberList : ContentView
{
public MemberList()
{
InitializeComponent();
}
/// <summary>
/// Bindable property for members list.
/// </summary>
/// <param name=""Members""></param>
/// <param name="typeof(IEnumerable<string>"></param>
/// <returns></returns>
public static readonly BindableProperty MembersProperty =
BindableProperty.Create(propertyName: "Members",
returnType: typeof(IEnumerable<string>),
declaringType: typeof(MemberList),
defaultBindingMode: BindingMode.Default,
propertyChanged: OnMembersChanged);
/// <summary>
/// Backing property for MembersProperty
/// </summary>
/// <value></value>
public IEnumerable<string> Members
{
get
{
return (IEnumerable<string>)GetValue(MembersProperty);
}
set
{
SetValue(MembersProperty, value);
}
}
/// <summary>
/// Memberes changed event handler. Assign member list source.
/// </summary>
/// <param name="bindable"></param>
/// <param name="oldValue"></param>
/// <param name="newValue"></param>
private static void OnMembersChanged(BindableObject bindable, object oldValue, object newValue)
{
var control = (MemberList)bindable;
var membersList = control.FindByName("MembersHorizontalList") as HorizontalList.HorizontalList;
if (membersList != null)
{
membersList.ItemsSource = newValue as IEnumerable<string>;
}
}
}
}