Work in progress
This commit is contained in:
@ -2,8 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Xamarin.Forms;
|
||||
using System.ComponentModel;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
namespace Aurora.Design.Components.Library
|
||||
{
|
||||
@ -33,51 +31,9 @@ namespace Aurora.Design.Components.Library
|
||||
propertyChanged: (BindableObject bindable, object oldValue, object newValue) =>
|
||||
{
|
||||
Library control = bindable as Library;
|
||||
|
||||
var libraryDataGrid = control.LibraryDataGrid;
|
||||
libraryDataGrid.ItemsSource = newValue as IEnumerable<object>;
|
||||
if (newValue is INotifyPropertyChanged)
|
||||
{
|
||||
var collection = newValue as INotifyCollectionChanged;
|
||||
collection.CollectionChanged += (object sender, NotifyCollectionChangedEventArgs eventArgs) =>
|
||||
OnItemSourceCollectionChanged(sender, eventArgs, bindable);
|
||||
}
|
||||
|
||||
if (oldValue is INotifyPropertyChanged)
|
||||
{
|
||||
var collection = newValue as INotifyCollectionChanged;
|
||||
collection.CollectionChanged -= (object sender, NotifyCollectionChangedEventArgs eventArgs) =>
|
||||
OnItemSourceCollectionChanged(sender, eventArgs, bindable);
|
||||
}
|
||||
control.LibraryDataGrid.ItemsSource = (IEnumerable<object>)newValue;
|
||||
});
|
||||
|
||||
private static void OnItemSourceCollectionChanged(object sender, NotifyCollectionChangedEventArgs e, BindableObject bindable)
|
||||
{
|
||||
if (sender is IEnumerable<object>)
|
||||
{
|
||||
Library control = bindable as Library;
|
||||
var libraryDataGrid = control.LibraryDataGrid;
|
||||
var collection = libraryDataGrid.ItemsSource as IEnumerable<object>;
|
||||
if (e.NewItems != null)
|
||||
{
|
||||
foreach (object obj in e.NewItems)
|
||||
{
|
||||
collection.Concat(new[] { obj });
|
||||
}
|
||||
}
|
||||
|
||||
if (e.OldItems != null)
|
||||
{
|
||||
foreach (object obj in e.OldItems)
|
||||
{
|
||||
var list = collection.ToList();
|
||||
list.Remove(obj);
|
||||
collection = list;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Backing property for the ItemsSource property.
|
||||
@ -164,10 +120,10 @@ namespace Aurora.Design.Components.Library
|
||||
private static void OnDoubleClickPropertyChanged(BindableObject bindable, object newValue, object oldValue)
|
||||
{
|
||||
Library control = bindable as Library;
|
||||
var queueDataGrid = control.LibraryDataGrid;
|
||||
if (queueDataGrid.GestureRecognizers.Count > 0)
|
||||
var dataGrid = control.LibraryDataGrid;
|
||||
if (dataGrid.GestureRecognizers.Count > 0)
|
||||
{
|
||||
var gestureRecognizer = queueDataGrid.GestureRecognizers.First();
|
||||
var gestureRecognizer = dataGrid.GestureRecognizers.First();
|
||||
|
||||
if (gestureRecognizer is TapGestureRecognizer)
|
||||
{
|
||||
|
Reference in New Issue
Block a user