Skip to content

Commit

Permalink
Merge pull request #59 from w-ahmad/RowHeightFix
Browse files Browse the repository at this point in the history
bind row height property to the TableView.RowHeight
  • Loading branch information
w-ahmad authored Nov 17, 2024
2 parents bc051c6 + 8d76a2f commit a71f7bd
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/WinUI.TableView/TableView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ protected override void PrepareContainerForItemOverride(DependencyObject element
protected override DependencyObject GetContainerForItemOverride()
{
var row = new TableViewRow { TableView = this };
row.SetBinding(HeightProperty, new Binding
{
Path = new PropertyPath($"{nameof(TableViewRow.TableView)}.{nameof(RowHeight)}"),
RelativeSource = new RelativeSource { Mode = RelativeSourceMode.Self }
});
_rows.Add(row);

return row;
Expand Down Expand Up @@ -430,19 +435,19 @@ private static TableViewBoundColumn GetTableViewColumnFromType(Type type)
{
return Type.GetTypeCode(type) switch
{
TypeCode.Byte
or TypeCode.SByte
or TypeCode.UInt16
or TypeCode.UInt32
or TypeCode.UInt64
or TypeCode.Int16
or TypeCode.Int32
or TypeCode.Int64
or TypeCode.Single
or TypeCode.Double
or TypeCode.Decimal
TypeCode.Byte
or TypeCode.SByte
or TypeCode.UInt16
or TypeCode.UInt32
or TypeCode.UInt64
or TypeCode.Int16
or TypeCode.Int32
or TypeCode.Int64
or TypeCode.Single
or TypeCode.Double
or TypeCode.Decimal
=> new TableViewNumberColumn(),
TypeCode.Boolean
TypeCode.Boolean
=> new TableViewCheckBoxColumn(),
_ => new TableViewTextColumn(),
};
Expand Down

0 comments on commit a71f7bd

Please sign in to comment.