Skip to content

Commit 30c4ad7

Browse files
committed
Update to latest Avalonia nightly
1 parent 13dfe41 commit 30c4ad7

File tree

13 files changed

+34
-68
lines changed

13 files changed

+34
-68
lines changed

src/Avalonia.FuncUI.ControlCatalog/Avalonia.FuncUI.ControlCatalog/Views/Tabs/DragDropDemo.fs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ module DragDropDemo =
2828

2929
let doDrag (e, dragCount) =
3030
async {
31-
let dragData = DataObject()
32-
dragData.Set(DataFormats.Text, $"You have dragged text %d{dragCount} times")
31+
use dragData = new DataTransfer()
32+
dragData.Add(DataTransferItem.Create(DataFormat.Text, $"You have dragged text %d{dragCount} times"))
3333

3434
let! result = Dispatcher.UIThread.InvokeAsync<DragDropEffects>
35-
(fun _ -> DragDrop.DoDragDrop(e, dragData, DragDropEffects.Copy)) |> Async.AwaitTask
35+
(fun _ -> DragDrop.DoDragDropAsync(e, dragData, DragDropEffects.Copy)) |> Async.AwaitTask
3636
return match result with
3737
| DragDropEffects.Copy -> "The text was copied"
3838
| DragDropEffects.Link -> "The text was linked"
@@ -83,19 +83,19 @@ module DragDropDemo =
8383
(TextBlock.create
8484
[ TextBlock.text state.dropText
8585
Control.onDrop (fun e ->
86-
if e.Data.Contains(DataFormats.Text) then
87-
Dropped(e.Data.GetText()) |> dispatch
88-
elif e.Data.Contains(DataFormats.Files) then
86+
if e.DataTransfer.Contains(DataFormat.Text) then
87+
Dropped(e.DataTransfer.TryGetText()) |> dispatch
88+
elif e.DataTransfer.Contains(DataFormat.File) then
8989
Dropped
90-
(e.Data.GetFiles()
90+
(e.DataTransfer.TryGetFiles()
9191
|> Seq.map (fun item -> item.Name)
9292
|> String.concat Environment.NewLine)
9393
|> dispatch
9494
)
9595
Control.onDragOver (fun e ->
9696
e.DragEffects <-
97-
if e.Data.Contains(DataFormats.Text)
98-
|| e.Data.Contains(DataFormats.Files) then
97+
if e.DataTransfer.Contains(DataFormat.Text)
98+
|| e.DataTransfer.Contains(DataFormat.File) then
9999
e.DragEffects
100100
&&& (DragDropEffects.Copy ||| DragDropEffects.Link)
101101
else

src/Avalonia.FuncUI.Diagnostics/Views/Views.StateHookViews.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ open Avalonia
66
open Avalonia.Controls
77
open Avalonia.FuncUI.DSL
88
open Avalonia.FuncUI.Types
9+
open Avalonia.Input.Platform
910
open Avalonia.Layout
1011
open Avalonia.Media
1112

src/Avalonia.FuncUI/Avalonia.FuncUI.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
<Compile Include="DSL\ItemsControl.fs" />
135135
<Compile Include="DSL\ContentControl.fs" />
136136
<Compile Include="DSL\TransitioningContentControl.fs" />
137-
<Compile Include="DSL\BindingEvaluator.fs" />
137+
138138
<Compile Include="DSL\AutoCompleteBox.fs" />
139139
<Compile Include="DSL\NumericUpDown.fs" />
140140
<Compile Include="DSL\Decorator.fs" />

src/Avalonia.FuncUI/DSL/AutoCompleteBox.fs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,8 @@ module AutoCompleteBox =
4646
static member isDropDownOpen<'t when 't :> AutoCompleteBox>(value: bool) : IAttr<'t> =
4747
AttrBuilder<'t>.CreateProperty<bool>(AutoCompleteBox.IsDropDownOpenProperty, value, ValueNone)
4848

49-
static member valueMemberBinding<'t when 't :> AutoCompleteBox>(binding: IBinding) : IAttr<'t> =
50-
let name = nameof Unchecked.defaultof<'t>.ValueMemberBinding
51-
let getter: 't -> IBinding = (fun control -> control.ValueMemberBinding)
52-
let setter: 't * IBinding -> unit = (fun (control, value) -> control.ValueMemberBinding <- value)
53-
54-
AttrBuilder<'t>.CreateProperty<IBinding>(name, binding, ValueSome getter, ValueSome setter, ValueNone)
49+
static member valueMemberBinding<'t when 't :> AutoCompleteBox>(binding: BindingBase) : IAttr<'t> =
50+
AttrBuilder<'t>.CreateProperty<_>(AutoCompleteBox.ValueMemberBindingProperty, binding, ValueNone)
5551

5652
static member selectedItem<'t when 't :> AutoCompleteBox>(value: obj) : IAttr<'t> =
5753
AttrBuilder<'t>.CreateProperty<obj>(AutoCompleteBox.SelectedItemProperty, value, ValueNone)
@@ -166,4 +162,5 @@ module AutoCompleteBox =
166162
AttrBuilder<'t>.CreateProperty<IEnumerable>(AutoCompleteBox.ItemsSourceProperty, items, ValueNone)
167163

168164
static member asyncPopulator<'t when 't :> AutoCompleteBox>(populator: Func<string, CancellationToken, Task<seq<obj>>>) : IAttr<'t> =
169-
AttrBuilder<'t>.CreateProperty<_>(AutoCompleteBox.AsyncPopulatorProperty, populator, ValueNone)
165+
AttrBuilder<'t>.CreateProperty<_>(AutoCompleteBox.AsyncPopulatorProperty, populator, ValueNone)
166+

src/Avalonia.FuncUI/DSL/BindingEvaluator.fs

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/Avalonia.FuncUI/DSL/DataGrid.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,17 @@ module DataGridBoundColumn =
105105

106106
type DataGridBoundColumn with
107107

108-
static member binding<'t when 't :> DataGridBoundColumn>(binding: IBinding) : IAttr<'t> =
109-
AttrBuilder<'t>.CreateProperty<IBinding>(
108+
static member binding<'t when 't :> DataGridBoundColumn>(binding: BindingBase) : IAttr<'t> =
109+
AttrBuilder<'t>.CreateProperty<BindingBase>(
110110
name = "Binding",
111111
value = binding,
112112
getter = ValueSome (fun column -> column.Binding),
113113
setter = ValueSome (fun (column, value) -> column.Binding <- value),
114114
comparer = ValueNone
115115
)
116116

117-
static member clipboardContentBinding<'t when 't :> DataGridBoundColumn>(binding: IBinding) : IAttr<'t> =
118-
AttrBuilder<'t>.CreateProperty<IBinding>(
117+
static member clipboardContentBinding<'t when 't :> DataGridBoundColumn>(binding: BindingBase) : IAttr<'t> =
118+
AttrBuilder<'t>.CreateProperty<BindingBase>(
119119
name = "ClipboardContentBinding",
120120
value = binding,
121121
getter = ValueSome (fun column -> column.ClipboardContentBinding),

src/Avalonia.FuncUI/DSL/ItemsControl.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ module ItemsControl =
2020

2121
type ItemsControl with
2222

23-
static member displayMemberBinding<'t when 't :> ItemsControl>(value: IBinding) : IAttr<'t> =
24-
AttrBuilder<'t>.CreateProperty<IBinding>(ItemsControl.DisplayMemberBindingProperty, value, ValueNone)
23+
static member displayMemberBinding<'t when 't :> ItemsControl>(value: BindingBase) : IAttr<'t> =
24+
AttrBuilder<'t>.CreateProperty<BindingBase>(ItemsControl.DisplayMemberBindingProperty, value, ValueNone)
2525

2626
static member viewItems<'t when 't :> ItemsControl>(views: IView list) : IAttr<'t> =
2727
let getter : ('t -> obj) = (fun control -> control.Items :> obj)

src/Avalonia.FuncUI/DSL/Primitives/SelectingItemsControl.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ module SelectingItemsControl =
3030
static member selectedItem<'t when 't :> SelectingItemsControl>(item: obj) : IAttr<'t> =
3131
AttrBuilder<'t>.CreateProperty<obj>(SelectingItemsControl.SelectedItemProperty, item, ValueNone)
3232

33-
static member selectedValueBinding<'t when 't :> SelectingItemsControl>(binding: IBinding) : IAttr<'t> =
34-
AttrBuilder<'t>.CreateProperty<IBinding>(SelectingItemsControl.SelectedValueBindingProperty, binding, ValueNone)
33+
static member selectedValueBinding<'t when 't :> SelectingItemsControl>(binding: BindingBase) : IAttr<'t> =
34+
AttrBuilder<'t>.CreateProperty<BindingBase>(SelectingItemsControl.SelectedValueBindingProperty, binding, ValueNone)
3535

3636
static member selectedValue<'t when 't :> SelectingItemsControl>(value: obj) : IAttr<'t> =
3737
AttrBuilder<'t>.CreateProperty<obj>(SelectingItemsControl.SelectedValueProperty, value, ValueNone)

src/Avalonia.FuncUI/DataTemplateView.fs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@ type DataTemplateView<'data, 'childData, 'view when 'view :> IView>
3232
(this.ViewFunc.GetType(), this.SupportsRecycling).GetHashCode()
3333

3434
interface ITreeDataTemplate with
35-
member this.ItemsSelector (item: obj) : InstancedBinding =
35+
// member this.ItemsSelector (item: obj) : InstancedBinding =
36+
member this.BindChildren(target: AvaloniaObject, targetProperty: AvaloniaProperty, item) : IDisposable =
3637
match this.ItemsSource with
3738
| ValueNone -> null
3839
| ValueSome expression ->
3940
match item with
4041
| :? 'data as data ->
41-
InstancedBinding.OneTime(expression.Invoke(data))
42+
target.SetCurrentValue(targetProperty, expression.Invoke(data))
43+
{ new IDisposable with member this.Dispose() = () }
4244
| _ -> null
4345

4446
member this.Match (data: obj) : bool =

src/Directory.Build.props

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<Project>
22
<PropertyGroup>
3-
<AvaloniaVersion>12.0.999-cibuild0059182-alpha</AvaloniaVersion>
4-
<AvaloniaDataGridVersion>11.3.7</AvaloniaDataGridVersion>
3+
<AvaloniaVersion>12.0.999-cibuild0061987-alpha</AvaloniaVersion>
4+
<AvaloniaDataGridVersion>12.0.999-cibuild0061786-alpha</AvaloniaDataGridVersion>
5+
<AvaloniaDiagnosticsVersion>12.0.999-cibuild0061243-alpha</AvaloniaDiagnosticsVersion>
56
<FuncUIVersion>1.5.2</FuncUIVersion>
67
</PropertyGroup>
78

0 commit comments

Comments
 (0)