Readability changes to datagrid. Functional changes to come

This commit is contained in:
watsonb8 2019-12-10 21:40:17 -05:00
parent cf05045448
commit 555eb07ec1
5 changed files with 303 additions and 210 deletions

View File

@ -16,7 +16,7 @@
x:Name="_headerView"
RowSpacing="0">
<Grid.Resources>
<ResourceDictionary>
<ResourceDictionary>
<!--Default Header Style-->
<Style
x:Key="HeaderDefaultStyle"

View File

@ -12,94 +12,190 @@ namespace Aurora.Design.Components.DataGrid
{
public partial class DataGrid : Grid
{
#region Private Fields
private IList<object> _internalItems;
private Dictionary<int, SortingOrder> _sortingOrders;
private ListView _listView;
#endregion Fields
#region Constructor
public DataGrid() : this(ListViewCachingStrategy.RecycleElement)
{
}
public DataGrid(ListViewCachingStrategy cachingStrategy)
{
InitializeComponent();
BackgroundColor = Color.Transparent;
_sortingOrders = new Dictionary<int, SortingOrder>();
_listView = new ListView(cachingStrategy)
{
BackgroundColor = Color.FromHex("#222222"),
ItemTemplate = new DataGridRowTemplateSelector(),
SeparatorVisibility = SeparatorVisibility.Default,
};
_listView.ItemSelected += (s, e) =>
{
if (SelectionEnabled)
{
SelectedItem = _listView.SelectedItem;
}
else
{
_listView.SelectedItem = null;
}
ItemSelected?.Invoke(this, e);
};
_listView.Refreshing += (s, e) =>
{
Refreshing?.Invoke(this, e);
};
_listView.SetBinding(ListView.RowHeightProperty, new Binding("RowHeight", source: this));
Grid.SetRow(_listView, 1);
Children.Add(_listView);
}
#endregion Constructor
#region Public Fields
public event EventHandler Refreshing;
public event EventHandler<SelectedItemChangedEventArgs> ItemSelected;
#endregion Public Fields
#region Bindable properties
public static readonly BindableProperty ActiveRowColorProperty =
BindableProperty.Create(nameof(ActiveRowColor), typeof(Color), typeof(DataGrid), Color.FromRgb(128, 144, 160),
coerceValue: (b, v) =>
BindableProperty.Create(
nameof(ActiveRowColor),
typeof(Color),
typeof(DataGrid),
Color.FromRgb(128, 144, 160),
coerceValue: (bindable, value) =>
{
if (!(b as DataGrid).SelectionEnabled)
if (!(bindable as DataGrid).SelectionEnabled)
throw new InvalidOperationException("Datagrid must be SelectionEnabled=true to set ActiveRowColor");
return v;
return value;
});
public static readonly BindableProperty HeaderBackgroundProperty =
BindableProperty.Create(nameof(HeaderBackground), typeof(Color), typeof(DataGrid), Color.White,
propertyChanged: (b, o, n) =>
BindableProperty.Create(
nameof(HeaderBackground),
typeof(Color),
typeof(DataGrid),
Color.White,
propertyChanged: (bindable, oldValue, newValue) =>
{
var self = b as DataGrid;
var self = bindable as DataGrid;
if (self._headerView != null && !self.HeaderBordersVisible)
self._headerView.BackgroundColor = (Color)n;
self._headerView.BackgroundColor = (Color)newValue;
});
public static readonly BindableProperty BorderColorProperty =
BindableProperty.Create(nameof(BorderColor), typeof(Color), typeof(DataGrid), Color.Black,
propertyChanged: (b, o, n) =>
BindableProperty.Create(
nameof(BorderColor),
typeof(Color),
typeof(DataGrid),
Color.Black,
propertyChanged: (bindable, oldValue, newValue) =>
{
var self = b as DataGrid;
var self = bindable as DataGrid;
if (self.HeaderBordersVisible)
self._headerView.BackgroundColor = (Color)n;
self._headerView.BackgroundColor = (Color)newValue;
if (self.Columns != null && self.ItemsSource != null)
self.Reload();
});
public static readonly BindableProperty RowsBackgroundColorPaletteProperty =
BindableProperty.Create(nameof(RowsBackgroundColorPalette), typeof(IColorProvider), typeof(DataGrid), new PaletteCollection { default(Color) },
propertyChanged: (b, o, n) =>
BindableProperty.Create(nameof(RowsBackgroundColorPalette),
typeof(IColorProvider),
typeof(DataGrid),
new PaletteCollection { default(Color) },
propertyChanged: (bindable, oldValue, newValue) =>
{
var self = b as DataGrid;
var self = bindable as DataGrid;
if (self.Columns != null && self.ItemsSource != null)
self.Reload();
});
public static readonly BindableProperty RowsTextColorPaletteProperty =
BindableProperty.Create(nameof(RowsTextColorPalette), typeof(IColorProvider), typeof(DataGrid), new PaletteCollection { Color.Black },
propertyChanged: (b, o, n) =>
BindableProperty.Create(
nameof(RowsTextColorPalette),
typeof(IColorProvider),
typeof(DataGrid),
new PaletteCollection { Color.Black },
propertyChanged: (bindable, oldValue, newValue) =>
{
var self = b as DataGrid;
var self = bindable as DataGrid;
if (self.Columns != null && self.ItemsSource != null)
self.Reload();
});
public static readonly BindableProperty ColumnsProperty =
BindableProperty.Create(nameof(Columns), typeof(ColumnCollection), typeof(DataGrid),
propertyChanged: (b, o, n) => (b as DataGrid).InitHeaderView(),
defaultValueCreator: b => { return new ColumnCollection(); }
BindableProperty.Create(
nameof(Columns),
typeof(ColumnCollection),
typeof(DataGrid),
propertyChanged: (bindable, oldValue, newValue) =>
{
(bindable as DataGrid).InitHeaderView();
},
defaultValueCreator: bindable => { return new ColumnCollection(); }
);
public static readonly BindableProperty ItemsSourceProperty =
BindableProperty.Create(nameof(ItemsSource), typeof(IEnumerable), typeof(DataGrid), null,
propertyChanged: (b, o, n) =>
BindableProperty.Create(
nameof(ItemsSource),
typeof(IEnumerable),
typeof(DataGrid),
null,
propertyChanged: (bindable, oldValue, newValue) =>
{
DataGrid self = b as DataGrid;
DataGrid self = bindable as DataGrid;
//ObservableCollection Tracking
if (o != null && o is INotifyCollectionChanged)
(o as INotifyCollectionChanged).CollectionChanged -= self.HandleItemsSourceCollectionChanged;
if (oldValue != null && oldValue is INotifyCollectionChanged)
(oldValue as INotifyCollectionChanged).CollectionChanged -= self.HandleItemsSourceCollectionChanged;
if (n != null)
if (newValue != null)
{
if (n is INotifyCollectionChanged)
(n as INotifyCollectionChanged).CollectionChanged += self.HandleItemsSourceCollectionChanged;
self.InternalItems = new List<object>(((IEnumerable)n).Cast<object>());
if (newValue is INotifyCollectionChanged)
{
(newValue as INotifyCollectionChanged).CollectionChanged += self.HandleItemsSourceCollectionChanged;
}
self.InternalItems = new List<object>(((IEnumerable)newValue).Cast<object>());
//Assign listview item source
// self._listView.ItemsSource = self.InternalItems;
self._listView.SetBinding(ListView.ItemsSourceProperty, new Binding("ItemsSource", source: self));
}
if (self.SelectedItem != null && !self.InternalItems.Contains(self.SelectedItem))
{
self.SelectedItem = null;
}
if (self.NoDataView != null)
{
if (self.ItemsSource == null || self.InternalItems.Count() == 0)
{
self._noDataView.IsVisible = true;
}
else if (self._noDataView.IsVisible)
{
self._noDataView.IsVisible = false;
}
}
});
void HandleItemsSourceCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
private void HandleItemsSourceCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
// InternalItems = new List<object>(((IEnumerable)sender).Cast<object>());
if (e.NewItems != null)
@ -118,24 +214,26 @@ namespace Aurora.Design.Components.DataGrid
}
}
if (SelectedItem != null && !InternalItems.Contains(SelectedItem))
{
SelectedItem = null;
}
}
public static readonly BindableProperty RowHeightProperty =
BindableProperty.Create(nameof(RowHeight), typeof(int), typeof(DataGrid), 40,
propertyChanged: (b, o, n) =>
propertyChanged: (bindable, oldValue, newValue) =>
{
var self = b as DataGrid;
self._listView.RowHeight = (int)n;
var self = bindable as DataGrid;
self._listView.RowHeight = (int)newValue;
});
public static readonly BindableProperty HeaderHeightProperty =
BindableProperty.Create(nameof(HeaderHeight), typeof(int), typeof(DataGrid), 40,
propertyChanged: (b, o, n) =>
propertyChanged: (bindable, oldValue, newValue) =>
{
var self = b as DataGrid;
self._headerView.HeightRequest = (int)n;
var self = bindable as DataGrid;
self._headerView.HeightRequest = (int)newValue;
});
public static readonly BindableProperty IsSortableProperty =
@ -145,43 +243,62 @@ namespace Aurora.Design.Components.DataGrid
BindableProperty.Create(nameof(FontSize), typeof(double), typeof(DataGrid), 13.0);
public static readonly BindableProperty FontFamilyProperty =
BindableProperty.Create(nameof(FontFamily), typeof(string), typeof(DataGrid), Font.Default.FontFamily);
BindableProperty.Create(
nameof(FontFamily),
typeof(string),
typeof(DataGrid),
Font.Default.FontFamily);
public static readonly BindableProperty SelectedItemProperty =
BindableProperty.Create(nameof(SelectedItem), typeof(object), typeof(DataGrid), null, BindingMode.TwoWay,
coerceValue: (b, v) =>
BindableProperty.Create(
nameof(SelectedItem),
typeof(object),
typeof(DataGrid),
null,
BindingMode.TwoWay,
coerceValue: (bindable, value) =>
{
var self = b as DataGrid;
if (!self.SelectionEnabled && v != null)
var self = bindable as DataGrid;
if (!self.SelectionEnabled && value != null)
{
throw new InvalidOperationException("Datagrid must be SelectionEnabled=true to set SelectedItem");
if (self.InternalItems != null && self.InternalItems.Contains(v))
return v;
}
if (self.InternalItems != null && self.InternalItems.Contains(value))
{
return value;
}
else
{
return null;
}
},
propertyChanged: (b, o, n) =>
propertyChanged: (bindable, oldValue, newValue) =>
{
var self = b as DataGrid;
if (self._listView.SelectedItem != n)
self._listView.SelectedItem = n;
var self = bindable as DataGrid;
if (self._listView.SelectedItem != newValue)
{
self._listView.SelectedItem = newValue;
}
}
);
public static readonly BindableProperty SelectionEnabledProperty =
BindableProperty.Create(nameof(SelectionEnabled), typeof(bool), typeof(DataGrid), true,
propertyChanged: (b, o, n) =>
propertyChanged: (bindable, oldValue, newValue) =>
{
var self = b as DataGrid;
var self = bindable as DataGrid;
if (!self.SelectionEnabled && self.SelectedItem != null)
{
self.SelectedItem = null;
}
});
public static readonly BindableProperty PullToRefreshCommandProperty =
BindableProperty.Create(nameof(PullToRefreshCommand), typeof(ICommand), typeof(DataGrid), null,
propertyChanged: (b, o, n) =>
propertyChanged: (bindable, oldValue, newValue) =>
{
var self = b as DataGrid;
if (n == null)
var self = bindable as DataGrid;
if (newValue == null)
{
self._listView.IsPullToRefreshEnabled = false;
self._listView.RefreshCommand = null;
@ -189,31 +306,52 @@ namespace Aurora.Design.Components.DataGrid
else
{
self._listView.IsPullToRefreshEnabled = true;
self._listView.RefreshCommand = n as ICommand;
self._listView.RefreshCommand = newValue as ICommand;
}
});
public static readonly BindableProperty IsRefreshingProperty =
BindableProperty.Create(nameof(IsRefreshing), typeof(bool), typeof(DataGrid), false, BindingMode.TwoWay,
propertyChanged: (b, o, n) => (b as DataGrid)._listView.IsRefreshing = (bool)n);
BindableProperty.Create(
nameof(IsRefreshing),
typeof(bool),
typeof(DataGrid),
false,
BindingMode.TwoWay,
propertyChanged: (bindable, oldValue, newValue) =>
{
(bindable as DataGrid)._listView.IsRefreshing = (bool)newValue;
});
public static readonly BindableProperty BorderThicknessProperty =
BindableProperty.Create(nameof(BorderThickness), typeof(Thickness), typeof(DataGrid), new Thickness(1),
propertyChanged: (b, o, n) =>
BindableProperty.Create(
nameof(BorderThickness),
typeof(Thickness),
typeof(DataGrid),
new Thickness(1),
propertyChanged: (bindable, oldValue, newValue) =>
{
(b as DataGrid)._headerView.ColumnSpacing = ((Thickness)n).HorizontalThickness / 2;
(b as DataGrid)._headerView.Padding = ((Thickness)n).HorizontalThickness / 2;
(bindable as DataGrid)._headerView.ColumnSpacing = ((Thickness)newValue).HorizontalThickness / 2;
(bindable as DataGrid)._headerView.Padding = ((Thickness)newValue).HorizontalThickness / 2;
});
public static readonly BindableProperty HeaderBordersVisibleProperty =
BindableProperty.Create(nameof(HeaderBordersVisible), typeof(bool), typeof(DataGrid), true,
propertyChanged: (b, o, n) => (b as DataGrid)._headerView.BackgroundColor = (bool)n ? (b as DataGrid).BorderColor : (b as DataGrid).HeaderBackground);
BindableProperty.Create(
nameof(HeaderBordersVisible),
typeof(bool),
typeof(DataGrid),
true,
propertyChanged: (bindable, oldValue, newValue) => (bindable as DataGrid)._headerView.BackgroundColor = (bool)newValue ? (bindable as DataGrid).BorderColor : (bindable as DataGrid).HeaderBackground);
public static readonly BindableProperty SortedColumnIndexProperty =
BindableProperty.Create(nameof(SortedColumnIndex), typeof(SortData), typeof(DataGrid), null, BindingMode.TwoWay,
validateValue: (b, v) =>
BindableProperty.Create(
nameof(SortedColumnIndex),
typeof(SortData),
typeof(DataGrid),
null,
BindingMode.TwoWay,
validateValue: (bindable, v) =>
{
var self = b as DataGrid;
var self = bindable as DataGrid;
var sData = (SortData)v;
return
@ -222,11 +360,11 @@ namespace Aurora.Design.Components.DataGrid
self.Columns.Count == 0 || //columns not setted yet
(sData.Index < self.Columns.Count && self.Columns.ElementAt(sData.Index).SortingEnabled);
},
propertyChanged: (b, o, n) =>
propertyChanged: (bindable, oldValue, newValue) =>
{
var self = b as DataGrid;
if (o != n)
self.SortItems((SortData)n);
var self = bindable as DataGrid;
if (oldValue != newValue)
self.SortItems((SortData)newValue);
});
@ -234,18 +372,28 @@ namespace Aurora.Design.Components.DataGrid
BindableProperty.Create(nameof(HeaderLabelStyle), typeof(Style), typeof(DataGrid));
public static readonly BindableProperty AscendingIconProperty =
BindableProperty.Create(nameof(AscendingIcon), typeof(ImageSource), typeof(DataGrid), ImageSource.FromResource("Xamarin.Forms.DataGrid.up.png", typeof(DataGrid).GetTypeInfo().Assembly));
BindableProperty.Create(
nameof(AscendingIcon),
typeof(ImageSource),
typeof(DataGrid),
ImageSource.FromResource("Xamarin.Forms.DataGrid.up.png",
typeof(DataGrid).GetTypeInfo().Assembly));
public static readonly BindableProperty DescendingIconProperty =
BindableProperty.Create(nameof(DescendingIcon), typeof(ImageSource), typeof(DataGrid), ImageSource.FromResource("Xamarin.Forms.DataGrid.down.png", typeof(DataGrid).GetTypeInfo().Assembly));
BindableProperty.Create(
nameof(DescendingIcon),
typeof(ImageSource),
typeof(DataGrid),
ImageSource.FromResource("Xamarin.Forms.DataGrid.down.png",
typeof(DataGrid).GetTypeInfo().Assembly));
public static readonly BindableProperty DescendingIconStyleProperty =
BindableProperty.Create(nameof(DescendingIconStyle), typeof(Style), typeof(DataGrid), null,
propertyChanged: (b, o, n) =>
propertyChanged: (bindable, oldValue, newValue) =>
{
var self = b as DataGrid;
var style = (n as Style).Setters.FirstOrDefault(x => x.Property == Image.SourceProperty);
var self = bindable as DataGrid;
var style = (newValue as Style).Setters.FirstOrDefault(x => x.Property == Image.SourceProperty);
if (style != null)
{
if (style.Value is string vs)
@ -257,19 +405,19 @@ namespace Aurora.Design.Components.DataGrid
public static readonly BindableProperty AscendingIconStyleProperty =
BindableProperty.Create(nameof(AscendingIconStyle), typeof(Style), typeof(DataGrid), null,
coerceValue: (b, v) =>
coerceValue: (bindable, v) =>
{
var self = b as DataGrid;
var self = bindable as DataGrid;
return v;
},
propertyChanged: (b, o, n) =>
propertyChanged: (bindable, oldValue, newValue) =>
{
var self = b as DataGrid;
if ((n as Style).Setters.Any(x => x.Property == Image.SourceProperty))
var self = bindable as DataGrid;
if ((newValue as Style).Setters.Any(x => x.Property == Image.SourceProperty))
{
var style = (n as Style).Setters.FirstOrDefault(x => x.Property == Image.SourceProperty);
var style = (newValue as Style).Setters.FirstOrDefault(x => x.Property == Image.SourceProperty);
if (style != null)
{
if (style.Value is string vs)
@ -282,10 +430,10 @@ namespace Aurora.Design.Components.DataGrid
public static readonly BindableProperty NoDataViewProperty =
BindableProperty.Create(nameof(NoDataView), typeof(View), typeof(DataGrid),
propertyChanged: (b, o, n) =>
propertyChanged: (bindable, oldValue, newValue) =>
{
if (o != n)
(b as DataGrid)._noDataView.Content = n as View;
if (oldValue != newValue)
(bindable as DataGrid)._noDataView.Content = newValue as View;
});
#endregion
@ -332,19 +480,21 @@ namespace Aurora.Design.Components.DataGrid
set { SetValue(ItemsSourceProperty, value); }
}
IList<object> _internalItems;
internal IList<object> InternalItems
{
get { return _internalItems; }
set
{
_internalItems = value;
if (value != _internalItems)
{
_internalItems = value;
if (IsSortable && SortedColumnIndex != null)
{
SortItems(SortedColumnIndex);
}
}
// _listView.ItemsSource = _internalItems;
if (IsSortable && SortedColumnIndex != null)
SortItems(SortedColumnIndex);
else
_listView.ItemsSource = _internalItems;
}
}
@ -469,52 +619,6 @@ namespace Aurora.Design.Components.DataGrid
}
#endregion
#region Fields
Dictionary<int, SortingOrder> _sortingOrders;
ListView _listView;
#endregion
#region ctor
public DataGrid() : this(ListViewCachingStrategy.RecycleElement)
{
}
public DataGrid(ListViewCachingStrategy cachingStrategy)
{
InitializeComponent();
BackgroundColor = Color.Transparent;
_sortingOrders = new Dictionary<int, SortingOrder>();
_listView = new ListView(cachingStrategy)
{
BackgroundColor = Color.FromHex("#222222"),
ItemTemplate = new DataGridRowTemplateSelector(),
SeparatorVisibility = SeparatorVisibility.Default,
};
_listView.ItemSelected += (s, e) =>
{
if (SelectionEnabled)
SelectedItem = _listView.SelectedItem;
else
_listView.SelectedItem = null;
ItemSelected?.Invoke(this, e);
};
_listView.Refreshing += (s, e) =>
{
Refreshing?.Invoke(this, e);
};
_listView.SetBinding(ListView.RowHeightProperty, new Binding("RowHeight", source: this));
Grid.SetRow(_listView, 1);
Children.Add(_listView);
}
#endregion
#region UI Methods
protected override void OnParentSet()
{
@ -528,13 +632,64 @@ namespace Aurora.Design.Components.DataGrid
SetColumnsBindingContext();
}
#endregion
#region Private Methods
private void Reload()
{
InternalItems = new List<object>(_internalItems);
}
#endregion
private void SortItems(SortData sData)
{
if (InternalItems == null || sData.Index >= Columns.Count || !Columns[sData.Index].SortingEnabled)
return;
#region Header Creation Methods
var items = InternalItems;
var column = Columns[sData.Index];
SortingOrder order = sData.Order;
if (!IsSortable)
throw new InvalidOperationException("This DataGrid is not sortable");
else if (column.PropertyName == null)
throw new InvalidOperationException("Please set the PropertyName property of Column");
//Sort
if (order == SortingOrder.Descendant)
items = items.OrderByDescending(x => ReflectionUtils.GetValueByPath(x, column.PropertyName)).ToList();
else
items = items.OrderBy(x => ReflectionUtils.GetValueByPath(x, column.PropertyName)).ToList();
column.SortingIcon.Style = (order == SortingOrder.Descendant) ?
AscendingIconStyle ?? (Style)_headerView.Resources["DescendingIconStyle"] :
DescendingIconStyle ?? (Style)_headerView.Resources["AscendingIconStyle"];
//Support DescendingIcon property (if setted)
if (!column.SortingIcon.Style.Setters.Any(x => x.Property == Image.SourceProperty))
{
if (order == SortingOrder.Descendant && DescendingIconProperty.DefaultValue != DescendingIcon)
column.SortingIcon.Source = DescendingIcon;
if (order == SortingOrder.Ascendant && AscendingIconProperty.DefaultValue != AscendingIcon)
column.SortingIcon.Source = AscendingIcon;
}
for (int i = 0; i < Columns.Count; i++)
{
if (i != sData.Index)
{
if (Columns[i].SortingIcon.Style != null)
Columns[i].SortingIcon.Style = null;
if (Columns[i].SortingIcon.Source != null)
Columns[i].SortingIcon.Source = null;
_sortingOrders[i] = SortingOrder.None;
}
}
_internalItems = items;
_sortingOrders[sData.Index] = order;
SortedColumnIndex = sData;
}
private View GetHeaderViewForColumn(DataGridColumn column)
{
@ -604,61 +759,7 @@ namespace Aurora.Design.Components.DataGrid
foreach (var c in Columns)
c.BindingContext = BindingContext;
}
#endregion
#region Sorting methods
internal void SortItems(SortData sData)
{
if (InternalItems == null || sData.Index >= Columns.Count || !Columns[sData.Index].SortingEnabled)
return;
var items = InternalItems;
var column = Columns[sData.Index];
SortingOrder order = sData.Order;
if (!IsSortable)
throw new InvalidOperationException("This DataGrid is not sortable");
else if (column.PropertyName == null)
throw new InvalidOperationException("Please set the PropertyName property of Column");
//Sort
if (order == SortingOrder.Descendant)
items = items.OrderByDescending(x => ReflectionUtils.GetValueByPath(x, column.PropertyName)).ToList();
else
items = items.OrderBy(x => ReflectionUtils.GetValueByPath(x, column.PropertyName)).ToList();
column.SortingIcon.Style = (order == SortingOrder.Descendant) ?
AscendingIconStyle ?? (Style)_headerView.Resources["DescendingIconStyle"] :
DescendingIconStyle ?? (Style)_headerView.Resources["AscendingIconStyle"];
//Support DescendingIcon property (if setted)
if (!column.SortingIcon.Style.Setters.Any(x => x.Property == Image.SourceProperty))
{
if (order == SortingOrder.Descendant && DescendingIconProperty.DefaultValue != DescendingIcon)
column.SortingIcon.Source = DescendingIcon;
if (order == SortingOrder.Ascendant && AscendingIconProperty.DefaultValue != AscendingIcon)
column.SortingIcon.Source = AscendingIcon;
}
for (int i = 0; i < Columns.Count; i++)
{
if (i != sData.Index)
{
if (Columns[i].SortingIcon.Style != null)
Columns[i].SortingIcon.Style = null;
if (Columns[i].SortingIcon.Source != null)
Columns[i].SortingIcon.Source = null;
_sortingOrders[i] = SortingOrder.None;
}
}
_internalItems = items;
_sortingOrders[sData.Index] = order;
SortedColumnIndex = sData;
_listView.ItemsSource = _internalItems;
}
#endregion
#endregion Private Methods
}
}

View File

@ -8,7 +8,13 @@ namespace Aurora.Design.Components.DataGrid
#region bindable properties
public static readonly BindableProperty WidthProperty =
BindableProperty.Create(nameof(Width), typeof(GridLength), typeof(DataGridColumn), new GridLength(1, GridUnitType.Star),
propertyChanged: (b, o, n) => { if (o != n) (b as DataGridColumn).OnSizeChanged(); });
propertyChanged: (bindable, oldValue, newValue) =>
{
if (oldValue != newValue)
{
(bindable as DataGridColumn).OnSizeChanged();
};
});
public static readonly BindableProperty TitleProperty =
BindableProperty.Create(nameof(Title), typeof(string), typeof(DataGridColumn), string.Empty,

View File

@ -1,12 +0,0 @@
namespace Aurora.Design.Components.DataGrid
{
public static class DataGridComponent
{
/// <summary>
/// You should call this method for loding the assembly
/// </summary>
public static void Init()
{
}
}
}

View File

@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Xamarin.Forms;
using Aurora.Models.Media;
using System.ComponentModel;
using System.Collections.Specialized;