Skip to content

Commit

Permalink
generate comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward Miller committed Dec 27, 2023
1 parent 2381fab commit e8a53a6
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 0 deletions.
66 changes: 66 additions & 0 deletions Maui.DataGrid/DataGrid.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,9 @@ private void SortAndPaginate(SortData? sortData = null)
}
});

/// <summary>
/// Gets or sets the page size for the DataGrid.
/// </summary>
public static readonly BindableProperty PageSizeProperty =
BindablePropertyExtensions.Create<DataGrid, int>(100,
propertyChanged: (b, o, n) =>
Expand All @@ -457,27 +460,51 @@ private void SortAndPaginate(SortData? sortData = null)
}
});

/// <summary>
/// Gets or sets a value indicating whether the page size is visible in the DataGrid.
/// </summary>
public static readonly BindableProperty PageSizeVisibleProperty =
BindablePropertyExtensions.Create<DataGrid, bool>(true);

/// <summary>
/// Gets or sets the row height for the DataGrid.
/// </summary>
public static readonly BindableProperty RowHeightProperty =
BindablePropertyExtensions.Create<DataGrid, int>(40);

/// <summary>
/// Gets or sets the height of the footer in the DataGrid.
/// </summary>
public static readonly BindableProperty FooterHeightProperty =
BindablePropertyExtensions.Create<DataGrid, int>(DeviceInfo.Platform == DevicePlatform.Android ? 50 : 40);

/// <summary>
/// Gets or sets the height of the header in the DataGrid.
/// </summary>
public static readonly BindableProperty HeaderHeightProperty =
BindablePropertyExtensions.Create<DataGrid, int>(40);

/// <summary>
/// Gets or sets a value indicating whether the DataGrid is sortable.
/// </summary>
public static readonly BindableProperty IsSortableProperty =
BindablePropertyExtensions.Create<DataGrid, bool>(true);

/// <summary>
/// Gets or sets the font size for the DataGrid.
/// </summary>
public static readonly BindableProperty FontSizeProperty =
BindablePropertyExtensions.Create<DataGrid, double>(13.0);

/// <summary>
/// Gets or sets the font family for the DataGrid.
/// </summary>
public static readonly BindableProperty FontFamilyProperty =
BindablePropertyExtensions.Create<DataGrid, string>(Font.Default.Family);

/// <summary>
/// Gets or sets the selected item in the DataGrid.
/// </summary>
public static readonly BindableProperty SelectedItemProperty =
BindablePropertyExtensions.Create<DataGrid, object>(null, BindingMode.TwoWay,
propertyChanged: (b, _, n) =>
Expand Down Expand Up @@ -509,6 +536,9 @@ private void SortAndPaginate(SortData? sortData = null)
}
);

/// <summary>
/// Gets or sets a value indicating whether pagination is enabled in the DataGrid.
/// </summary>
public static readonly BindableProperty PaginationEnabledProperty =
BindablePropertyExtensions.Create<DataGrid, bool>(false,
propertyChanged: (b, o, n) =>
Expand All @@ -520,6 +550,9 @@ private void SortAndPaginate(SortData? sortData = null)
}
});

/// <summary>
/// Gets or sets a value indicating whether selection is enabled in the DataGrid.
/// </summary>
public static readonly BindableProperty SelectionEnabledProperty =
BindablePropertyExtensions.Create<DataGrid, bool>(true,
propertyChanged: (b, o, n) =>
Expand All @@ -531,6 +564,9 @@ private void SortAndPaginate(SortData? sortData = null)
}
});

/// <summary>
/// Gets or sets a value indicating whether refreshing is enabled in the DataGrid.
/// </summary>
public static readonly BindableProperty RefreshingEnabledProperty =
BindablePropertyExtensions.Create<DataGrid, bool>(true,
propertyChanged: (b, o, n) =>
Expand All @@ -542,6 +578,9 @@ private void SortAndPaginate(SortData? sortData = null)
}
});

/// <summary>
/// Gets or sets the command to execute when the data grid is pulled to refresh.
/// </summary>
public static readonly BindableProperty PullToRefreshCommandProperty =
BindablePropertyExtensions.Create<DataGrid, ICommand>(
propertyChanged: (b, o, n) =>
Expand All @@ -562,9 +601,15 @@ private void SortAndPaginate(SortData? sortData = null)
}
});

/// <summary>
/// Gets or sets a value indicating whether the DataGrid is refreshing.
/// </summary>
public static readonly BindableProperty IsRefreshingProperty =
BindablePropertyExtensions.Create<DataGrid, bool>(false, BindingMode.TwoWay);

/// <summary>
/// Gets or sets the thickness of the border around the DataGrid.
/// </summary>
public static readonly BindableProperty BorderThicknessProperty =
BindablePropertyExtensions.Create<DataGrid, Thickness>(new Thickness(1),
propertyChanged: (b, o, n) =>
Expand All @@ -575,11 +620,17 @@ private void SortAndPaginate(SortData? sortData = null)
}
});

/// <summary>
/// Gets or sets a value indicating whether the header borders are visible in the DataGrid.
/// </summary>
public static readonly BindableProperty HeaderBordersVisibleProperty =
BindablePropertyExtensions.Create<DataGrid, bool>(true,
propertyChanged: (b, _, n) => ((DataGrid)b)._headerView.BackgroundColor =
n ? ((DataGrid)b).BorderColor : ((DataGrid)b).HeaderBackground);

/// <summary>
/// Gets or sets the index of the sorted column in the DataGrid.
/// </summary>
public static readonly BindableProperty SortedColumnIndexProperty =
BindablePropertyExtensions.Create<DataGrid, SortData>(null, BindingMode.TwoWay,
(b, v) =>
Expand All @@ -606,6 +657,9 @@ private void SortAndPaginate(SortData? sortData = null)
}
});

/// <summary>
/// Gets or sets the current page number in the DataGrid.
/// </summary>
public static readonly BindableProperty PageNumberProperty =
BindablePropertyExtensions.Create<DataGrid, int>(1, BindingMode.TwoWay,
(b, v) =>
Expand All @@ -625,12 +679,21 @@ private void SortAndPaginate(SortData? sortData = null)
}
});

/// <summary>
/// Gets or sets the style for the header labels in the DataGrid.
/// </summary>
public static readonly BindableProperty HeaderLabelStyleProperty =
BindablePropertyExtensions.Create<DataGrid, Style>();

/// <summary>
/// Gets or sets the sort icons for the DataGrid.
/// </summary>
public static readonly BindableProperty SortIconProperty =
BindablePropertyExtensions.Create<DataGrid, Polygon>();

/// <summary>
/// Gets or sets the style for the sort icons in the DataGrid.
/// </summary>
public static readonly BindableProperty SortIconStyleProperty =
BindablePropertyExtensions.Create<DataGrid, Style>(
propertyChanged: (b, o, n) =>
Expand All @@ -644,6 +707,9 @@ private void SortAndPaginate(SortData? sortData = null)
}
});

/// <summary>
/// Gets or sets the view to be displayed when the DataGrid has no data.
/// </summary>
public static readonly BindableProperty NoDataViewProperty =
BindablePropertyExtensions.Create<DataGrid, View>(
propertyChanged: (b, o, n) =>
Expand Down
45 changes: 45 additions & 0 deletions Maui.DataGrid/DataGridColumn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public sealed class DataGridColumn : BindableObject, IDefinition

#endregion Fields

/// <summary>
/// Initializes a new instance of the <see cref="DataGridColumn"/> class.
/// </summary>
public DataGridColumn()
{
HeaderLabel = new();
Expand All @@ -35,6 +38,9 @@ public DataGridColumn()

#region Events

/// <summary>
/// Occurs when the size of the column changes.
/// </summary>
public event EventHandler SizeChanged
{
add => _sizeChangedEventManager.AddEventHandler(value);
Expand All @@ -45,6 +51,9 @@ public event EventHandler SizeChanged

#region Bindable Properties

/// <summary>
/// Gets or sets the width of the column.
/// </summary>
public static readonly BindableProperty WidthProperty =
BindablePropertyExtensions.Create<DataGridColumn, GridLength>(GridLength.Star,
propertyChanged: (b, o, n) =>
Expand All @@ -56,17 +65,29 @@ public event EventHandler SizeChanged
}
});

/// <summary>
/// Gets or sets the title of the column.
/// </summary>
public static readonly BindableProperty TitleProperty =
BindablePropertyExtensions.Create<DataGridColumn, string>(string.Empty,
propertyChanged: (b, _, n) => ((DataGridColumn)b).HeaderLabel.Text = n);

/// <summary>
/// Gets or sets the formatted title of the column.
/// </summary>
public static readonly BindableProperty FormattedTitleProperty =
BindablePropertyExtensions.Create<DataGridColumn, FormattedString>(
propertyChanged: (b, _, n) => ((DataGridColumn)b).HeaderLabel.FormattedText = n);

/// <summary>
/// Gets or sets the name of the property associated with the column.
/// </summary>
public static readonly BindableProperty PropertyNameProperty =
BindablePropertyExtensions.Create<DataGridColumn, string>();

/// <summary>
/// Gets or sets a value indicating whether the column is visible.
/// </summary>
public static readonly BindableProperty IsVisibleProperty =
BindablePropertyExtensions.Create<DataGridColumn, bool>(true,
propertyChanged: (b, o, n) =>
Expand All @@ -85,27 +106,51 @@ public event EventHandler SizeChanged
}
});

/// <summary>
/// Gets or sets the string format for the column.
/// </summary>
public static readonly BindableProperty StringFormatProperty =
BindablePropertyExtensions.Create<DataGridColumn, string>();

/// <summary>
/// Gets or sets the cell template for the column.
/// </summary>
public static readonly BindableProperty CellTemplateProperty =
BindablePropertyExtensions.Create<DataGridColumn, DataTemplate>();

/// <summary>
/// Gets or sets the cell template for editing the column.
/// </summary>
public static readonly BindableProperty EditCellTemplateProperty =
BindablePropertyExtensions.Create<DataGridColumn, DataTemplate>();

/// <summary>
/// Gets or sets the line break mode for the column.
/// </summary>
public static readonly BindableProperty LineBreakModeProperty =
BindablePropertyExtensions.Create<DataGridColumn, LineBreakMode>(LineBreakMode.WordWrap);

/// <summary>
/// Gets or sets the horizontal content alignment for the column.
/// </summary>
public static readonly BindableProperty HorizontalContentAlignmentProperty =
BindablePropertyExtensions.Create<DataGridColumn, LayoutOptions>(LayoutOptions.Center);

/// <summary>
/// Gets or sets the vertical content alignment for the column.
/// </summary>
public static readonly BindableProperty VerticalContentAlignmentProperty =
BindablePropertyExtensions.Create<DataGridColumn, LayoutOptions>(LayoutOptions.Center);

/// <summary>
/// Gets or sets a value indicating whether sorting is enabled for the column.
/// </summary>
public static readonly BindableProperty SortingEnabledProperty =
BindablePropertyExtensions.Create<DataGridColumn, bool>(true);

/// <summary>
/// Gets or sets the style for the header label of the column.
/// </summary>
public static readonly BindableProperty HeaderLabelStyleProperty =
BindablePropertyExtensions.Create<DataGridColumn, Style>(
propertyChanged: (b, o, n) =>
Expand Down

0 comments on commit e8a53a6

Please sign in to comment.