Skip to content

Commit

Permalink
Merge branch 'fsprojects:master' into fix-example-titles
Browse files Browse the repository at this point in the history
  • Loading branch information
beyon authored Oct 30, 2023
2 parents 1bb480e + a4b6ca6 commit 3b660e0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Avalonia.FuncUI/DSL/DataGrid.fs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ module DataGridColumn =
static member cellTheme<'t when 't :> DataGridColumn>(value: ControlTheme) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<ControlTheme>(DataGridColumn.CellThemeProperty, value, ValueNone)

static member width<'t when 't :> DataGridColumn>(value: DataGridLength) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<DataGridLength>(
name = "width",
value = value,
getter = ValueSome (fun column -> column.Width),
setter = ValueSome (fun (column, value) -> column.Width <- value),
comparer = ValueNone
)

[<AutoOpen>]
module DataGridBoundColumn =

Expand Down
2 changes: 2 additions & 0 deletions src/Examples/Examples.DataGridPlayground/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ type Views =
DataGrid.dock Dock.Top
DataGrid.isReadOnly false
DataGrid.items data.Current

DataGrid.columns [
DataGridTextColumn.create [
DataGridTextColumn.header "Name"
DataGridTextColumn.binding (Binding ("Name", BindingMode.TwoWay))
DataGridTextColumn.width (DataGridLength(2, DataGridLengthUnitType.Star))
]
DataGridTemplateColumn.create [
DataGridTemplateColumn.header "Name"
Expand Down

0 comments on commit 3b660e0

Please sign in to comment.