Skip to content

Commit 79e9c91

Browse files
committed
add FontSize and FontFamily bindings for rows to point to the TableVIew
1 parent 7952c2f commit 79e9c91

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/TableView.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,15 @@ protected override void PrepareContainerForItemOverride(DependencyObject element
107107
protected override DependencyObject GetContainerForItemOverride()
108108
{
109109
var row = new TableViewRow { TableView = this };
110-
_rows.Add(row);
111110

111+
// Set bindings for FontFamily and FontSize to propagate from TableView to TableViewRow
112+
row.SetBinding(FontFamilyProperty, new Binding { Path = new("TableView.FontFamily"), RelativeSource = new() { Mode = RelativeSourceMode.Self } });
113+
row.SetBinding(FontSizeProperty, new Binding { Path = new("TableView.FontSize"), RelativeSource = new() { Mode = RelativeSourceMode.Self } });
114+
115+
_rows.Add(row);
112116
return row;
113117
}
114-
118+
115119
/// <inheritdoc/>
116120
protected override async void OnKeyDown(KeyRoutedEventArgs e)
117121
{

0 commit comments

Comments
 (0)