Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions components/DataTable/src/DataTable/DataColumn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace CommunityToolkit.WinUI.Controls;

/// <summary>
/// Represents a <see cref="DataTable"/> column.
/// </summary>
[TemplatePart(Name = nameof(PART_ColumnSizer), Type = typeof(ContentSizer))]
public partial class DataColumn : ContentControl
{
Expand Down Expand Up @@ -62,11 +65,15 @@ private static void DesiredWidth_PropertyChanged(DependencyObject d, DependencyP
}
}

/// <summary>
/// Initializes a new instance of the <see cref="DataColumn"/> class.
/// </summary>
public DataColumn()
{
this.DefaultStyleKey = typeof(DataColumn);
}

/// <inheritdoc/>
protected override void OnApplyTemplate()
{
if (PART_ColumnSizer != null)
Expand Down
10 changes: 9 additions & 1 deletion components/DataTable/src/DataTable/DataRow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

namespace CommunityToolkit.WinUI.Controls;

/// <summary>
/// Represents a <see cref="DataTable"/> row.
/// </summary>
public partial class DataRow : Panel
{
// TODO: Create our own helper class here for the Header as well vs. straight-Grid.
Expand All @@ -16,6 +19,9 @@ public partial class DataRow : Panel
private bool _isTreeView;
private double _treePadding;

/// <summary>
/// Initializes a new instance of the <see cref="DataRow"/> class.
/// </summary>
public DataRow()
{
Unloaded += this.DataRow_Unloaded;
Expand Down Expand Up @@ -70,6 +76,7 @@ private void DataRow_Unloaded(object sender, RoutedEventArgs e)
return panel;
}

/// <inheritdoc/>
protected override Size MeasureOverride(Size availableSize)
{
// We should probably only have to do this once ever?
Expand Down Expand Up @@ -168,6 +175,7 @@ protected override Size MeasureOverride(Size availableSize)
return new(_parentPanel?.DesiredSize.Width ?? availableSize.Width, maxHeight);
}

/// <inheritdoc/>
protected override Size ArrangeOverride(Size finalSize)
{
int column = 0;
Expand All @@ -186,7 +194,7 @@ protected override Size ArrangeOverride(Size finalSize)
if (_parentPanel is Grid grid &&
column < grid.ColumnDefinitions.Count)
{
width = grid.ColumnDefinitions[column++].ActualWidth;
width = grid.ColumnDefinitions[column++].ActualWidth;
}
// TODO: Need to check Column visibility here as well...
else if (_parentPanel is DataTable table &&
Expand Down
2 changes: 2 additions & 0 deletions components/DataTable/src/DataTable/DataTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public double ColumnSpacing
public static readonly DependencyProperty ColumnSpacingProperty =
DependencyProperty.Register(nameof(ColumnSpacing), typeof(double), typeof(DataTable), new PropertyMetadata(0d));

/// <inheritdoc/>
protected override Size MeasureOverride(Size availableSize)
{
double fixedWidth = 0;
Expand Down Expand Up @@ -107,6 +108,7 @@ protected override Size MeasureOverride(Size availableSize)
return new Size(availableSize.Width, maxHeight);
}

/// <inheritdoc/>
protected override Size ArrangeOverride(Size finalSize)
{
double fixedWidth = 0;
Expand Down