2019-05-27 16:23:14 +00:00
|
|
|
|
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 21:37:10 +00:00
|
|
|
|
using Aurora.Models;
|
2019-05-27 16:23:14 +00:00
|
|
|
|
|
2019-07-05 18:17:09 +00:00
|
|
|
|
namespace Aurora.Design.Components.MemberList
|
2019-05-27 16:23:14 +00:00
|
|
|
|
{
|
|
|
|
|
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",
|
2019-07-05 21:37:10 +00:00
|
|
|
|
returnType: typeof(IEnumerable<PartyMember>),
|
2019-05-27 16:23:14 +00:00
|
|
|
|
declaringType: typeof(MemberList),
|
|
|
|
|
defaultBindingMode: BindingMode.Default,
|
|
|
|
|
propertyChanged: OnMembersChanged);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Backing property for MembersProperty
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value></value>
|
2019-07-05 21:37:10 +00:00
|
|
|
|
public IEnumerable<PartyMember> Members
|
2019-05-27 16:23:14 +00:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2019-07-05 21:37:10 +00:00
|
|
|
|
return (IEnumerable<PartyMember>)GetValue(MembersProperty);
|
2019-05-27 16:23:14 +00:00
|
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
|
{
|
2019-07-05 21:37:10 +00:00
|
|
|
|
membersList.ItemsSource = newValue as IEnumerable<PartyMember>;
|
2019-05-27 16:23:14 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|