diff --git a/src/TemplatedDataGrid/DataGridCell.cs b/src/TemplatedDataGrid/DataGridCell.cs index 9e1b25c..fdf4538 100644 --- a/src/TemplatedDataGrid/DataGridCell.cs +++ b/src/TemplatedDataGrid/DataGridCell.cs @@ -7,6 +7,9 @@ namespace TemplatedDataGrid { public class DataGridCell : TemplatedControl { + public static readonly StyledProperty ContentProperty = + AvaloniaProperty.Register(nameof(Content)); + public static readonly StyledProperty CellTemplateProperty = AvaloniaProperty.Register(nameof(CellTemplate)); @@ -16,5 +19,13 @@ namespace TemplatedDataGrid get => GetValue(CellTemplateProperty); set => SetValue(CellTemplateProperty, value); } + + [Content] + [DependsOn(nameof(CellTemplate))] + public object? Content + { + get { return GetValue(ContentProperty); } + set { SetValue(ContentProperty, value); } + } } } diff --git a/src/TemplatedDataGrid/DataGridRow.cs b/src/TemplatedDataGrid/DataGridRow.cs index a69b270..e108a5b 100644 --- a/src/TemplatedDataGrid/DataGridRow.cs +++ b/src/TemplatedDataGrid/DataGridRow.cs @@ -74,6 +74,7 @@ namespace TemplatedDataGrid var cell = new DataGridCell() { [Grid.ColumnProperty] = columnDefinitions.Count - 1, + [!DataGridCell.ContentProperty] = this[!DataGridRow.DataContextProperty], [!DataGridCell.CellTemplateProperty] = templateColumn[!DataGridTemplateColumn.CellTemplateProperty] }; _rootChildren.Add(cell); diff --git a/src/TemplatedDataGrid/Themes/Fluent.axaml b/src/TemplatedDataGrid/Themes/Fluent.axaml index a2e09b3..f774c82 100644 --- a/src/TemplatedDataGrid/Themes/Fluent.axaml +++ b/src/TemplatedDataGrid/Themes/Fluent.axaml @@ -71,7 +71,7 @@