/// <summary>
/// Gets or sets the item's grid alignment along x-axis within a given gengrid widget.
- /// The range is less than or equal to 1,and greater than or equal to 0.
- /// By default, value is 0.5, meaning that the gengrid has its items grid placed exactly in the middle along x-axis.
+ /// Accepted values are in the 0.0 to 1.0 range, with the special value -1.0 used to specify "justify" or "fill" by some users.
+ /// By default, value is 0.0, meaning that the gengrid has its items grid placed exactly in the left along x-axis.
/// </summary>
public double ItemAlignmentX
{
/// <summary>
/// Gets or sets the item's grid alignment on y-axis within a given gengrid widget.
- /// The range is less than or equal to 1, and greater than or equal to 0.
- /// By default, value is 0.5, meaning that the gengrid has its items grid placed exactly in the middle along y-axis.
+ /// Accepted values are in the 0.0 to 1.0 range, with the special value -1.0 used to specify "justify" or "fill" by some users.
+ /// By default, value is 0.0, meaning that the gengrid has its items grid placed exactly in the top along y-axis.
/// </summary>
public double ItemAlignmentY
{
/// <param name="data">The item data.</param>
/// <param name="func">User defined comparison function that defines the sort order based on gengrid item and its data.</param>
/// <returns>Return a gengrid item that contains data and itemClass.</returns>
- public GenGridItem InsertSorted(GenItemClass itemClass, object data, Comparison<GenGridItem> comparison)
+ public GenGridItem InsertSorted(GenItemClass itemClass, object data, Comparison<object> comparison)
{
+ GenGridItem item = new GenGridItem(data, itemClass);
+
Interop.Elementary.Eina_Compare_Cb compareCallback = (handle1, handle2) =>
{
- GenGridItem item1 = ItemObject.GetItemByHandle(handle1) as GenGridItem;
- GenGridItem item2 = ItemObject.GetItemByHandle(handle2) as GenGridItem;
- return comparison(item1, item2);
+ GenGridItem first = (ItemObject.GetItemByHandle(handle1) as GenGridItem) ?? item;
+ GenGridItem second = (ItemObject.GetItemByHandle(handle2) as GenGridItem) ?? item;
+ return comparison(first.Data, second.Data);
};
- GenGridItem item = new GenGridItem(data, itemClass);
-
IntPtr handle = Interop.Elementary.elm_gengrid_item_sorted_insert(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, compareCallback, null, (IntPtr)item.Id);
item.Handle = handle;
AddInternal(item);