Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bindings Avalonia v11.0.0 #422

Merged
merged 59 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
3c8684e
add Type Alias: SubscriptionFactory<'arg>
SilkyFowl May 3, 2024
8d89f93
Merge branch 'fsprojects:master' into master
SilkyFowl May 3, 2024
cdfba37
add SelectingItemsControl bindings.
SilkyFowl May 4, 2024
20d2612
add ComboBox bindings.
SilkyFowl May 4, 2024
fdc90e0
add HeaderedSelectingItemsControl bindings.
SilkyFowl May 4, 2024
a650d8c
add MenuItem bindings.
SilkyFowl May 4, 2024
e7aae22
add NumericUpDown bindings.
SilkyFowl May 4, 2024
b0abf8f
add TreeView bindings.
SilkyFowl May 4, 2024
57c803d
add HeaderedItemsControl bindings.
SilkyFowl May 4, 2024
9752107
add CalendarItem bindings.
SilkyFowl May 4, 2024
420d662
move CalendarItem.fs to DSL\Primitives
SilkyFowl May 4, 2024
0cc9265
add PickerPresenterBase bindings.
SilkyFowl May 4, 2024
3157b8e
add DatePickerPresenter bindings.
SilkyFowl May 4, 2024
95b7692
add TimePickerPresenter bindings.
SilkyFowl May 4, 2024
0c8168d
add ProgressBar bindings.
SilkyFowl May 5, 2024
6424137
add Slider bindings.
SilkyFowl May 5, 2024
a513505
add ScrollBar bindings.
SilkyFowl May 5, 2024
53c754a
add RemoteWidget bindings.
SilkyFowl May 6, 2024
82fba25
fix Shape bindings
SilkyFowl May 6, 2024
d5a8a76
add Arc bindings.
SilkyFowl May 6, 2024
6a3d641
add Rectangle bindings.
SilkyFowl May 6, 2024
1691053
add Sector bindings.
SilkyFowl May 6, 2024
baf755c
update Sector bindings.
SilkyFowl May 6, 2024
7668504
add BindingEvaluator bindings.
SilkyFowl May 7, 2024
c268b22
add LightDismissOverlayLayer bindings.
SilkyFowl May 7, 2024
8b72866
add ExperimentalAcrylicBorder bindings.
SilkyFowl May 7, 2024
3446b3c
add ThemeVariantScope bindings.
SilkyFowl May 7, 2024
6bbc3b3
add VisualLayerManager bindings.
SilkyFowl May 7, 2024
e9f5740
add NativeControlHost bindings.
SilkyFowl May 7, 2024
7e17cfe
add AdornerLayer bindings.
SilkyFowl May 7, 2024
0b65342
add OverlayLayer bindings.
SilkyFowl May 7, 2024
57bc973
add DataGridFrozenGrid bindings.
SilkyFowl May 8, 2024
18902b5
add StackPanel bindings.
SilkyFowl May 8, 2024
fd1b900
add ReversibleStackPanel bindings.
SilkyFowl May 8, 2024
b4e16fd
add VirtualizingCarouselPanel bindings.
SilkyFowl May 8, 2024
ddf8842
add VirtualizingStackPanel bindings.
SilkyFowl May 8, 2024
b894240
add ChromeOverlayLayer bindings.
SilkyFowl May 8, 2024
5b290ac
add SelectableTextBlock bindings.
SilkyFowl May 8, 2024
223b8ed
fix TickBar.ticks(value: seq<float>) binding implementation.
SilkyFowl May 8, 2024
b3773bc
add ContentPresenter bindings.
SilkyFowl May 8, 2024
f810b3e
add ScrollContentPresenter bindings.
SilkyFowl May 8, 2024
4270ba2
add ItemsPresenter bindings.
SilkyFowl May 8, 2024
ff60da9
add TextPresenter bindings.
SilkyFowl May 8, 2024
2bd1aad
add Popup bindings.
SilkyFowl May 8, 2024
b577366
add AutoCompleteBox bindings.
SilkyFowl May 8, 2024
d479114
add Calendar bindings.
SilkyFowl May 9, 2024
a6368b8
add CalendarDatePicker bindings.
SilkyFowl May 11, 2024
cc132b8
add Button bindings.
SilkyFowl May 11, 2024
b761ed1
add DropDownButton bindings.
SilkyFowl May 11, 2024
927160c
add CalendarButton bindings.
SilkyFowl May 11, 2024
5fd7145
add CalendarDayButton bindings.
SilkyFowl May 11, 2024
1e19748
add ToggleSwitch bindings.
SilkyFowl May 11, 2024
7c13a04
add DataValidationErrors bindings.
SilkyFowl May 11, 2024
4ba2f62
add RefreshContainer bindings.
SilkyFowl May 13, 2024
beb13e7
add RefreshVisualizer bindings.
SilkyFowl May 14, 2024
1160f26
update ScrollViewer bindings.
SilkyFowl May 14, 2024
9b4a6fa
add ToggleSplitButton bindings.
SilkyFowl May 14, 2024
cd4d413
add SplitView bindings.
SilkyFowl May 14, 2024
c68392e
add Expander bindings.
SilkyFowl May 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module CanvasDemo =
Line.startPoint (120.0, 185.0)
Line.endPoint (30.0, 115.0)
Line.strokeLineCap PenLineCap.Round
Line.strokeJoinCap PenLineJoin.Bevel
Line.strokeJoin PenLineJoin.Bevel
Line.stroke "red"
Line.strokeThickness 2.0
]
Expand Down
30 changes: 29 additions & 1 deletion src/Avalonia.FuncUI/Avalonia.FuncUI.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,16 @@
<Compile Include="DSL\Base\StyledElement.fs" />
<Compile Include="DSL\Base\Panel.fs" />
<Compile Include="DSL\Base\ContentPresenter.fs" />
<Compile Include="DSL\Base\ScrollContentPresenter.fs" />
<Compile Include="DSL\Base\ItemsPresenter.fs" />
<Compile Include="DSL\Base\TextPresenter.fs" />
<Compile Include="DSL\Base\Animatable.fs" />
<Compile Include="DSL\Base\RenderOptions.fs" />
<Compile Include="DSL\Primitives\LightDismissOverlayLayer.fs" />
<Compile Include="DSL\Primitives\VisualLayerManager.fs" />
<Compile Include="DSL\Primitives\AdornerLayer.fs" />
<Compile Include="DSL\Primitives\OverlayLayer.fs" />
<Compile Include="DSL\Primitives\ChromeOverlayLayer.fs" />
<Compile Include="DSL\Primitives\TemplatedControl.fs" />
<Compile Include="DSL\Primitives\HeaderedContentControl.fs" />
<Compile Include="DSL\Primitives\HeaderedSelectingItemsControl.fs" />
Expand All @@ -83,19 +91,28 @@
<Compile Include="DSL\Primitives\Thumb.fs" />
<Compile Include="DSL\Primitives\AccessText.fs" />
<Compile Include="DSL\Primitives\ScrollBar.fs" />
<Compile Include="DSL\Primitives\CalendarItem.fs" />
<Compile Include="DSL\Primitives\PickerPresenterBase.fs" />
<Compile Include="DSL\Primitives\TextElement.fs" />
<Compile Include="DSL\Panels\Canvas.fs" />
<Compile Include="DSL\Panels\DockPanel.fs" />
<Compile Include="DSL\Panels\Grid.fs" />
<Compile Include="DSL\Panels\StackPanel.fs" />
<Compile Include="DSL\Panels\ReversibleStackPanel.fs" />
<Compile Include="DSL\Panels\VirtualizingCarouselPanel.fs" />
<Compile Include="DSL\Panels\VirtualizingStackPanel.fs" />
<Compile Include="DSL\Panels\WrapPanel.fs" />
<Compile Include="DSL\Shapes\Shape.fs" />
<Compile Include="DSL\Shapes\Arc.fs" />
<Compile Include="DSL\Shapes\Rectangle.fs" />
<Compile Include="DSL\Shapes\Ellipse.fs" />
<Compile Include="DSL\Shapes\Line.fs" />
<Compile Include="DSL\Shapes\Polyline.fs" />
<Compile Include="DSL\Shapes\Polygon.fs" />
<Compile Include="DSL\Shapes\Path.fs" />
<Compile Include="DSL\Shapes\Sector.fs" />
<Compile Include="DSL\Calendar\CalendarButton.fs" />
<Compile Include="DSL\Calendar\CalendarDayButton.fs" />
<Compile Include="DSL\Calendar\Calendar.fs" />
<Compile Include="DSL\Calendar\CalendarDatePicker.fs" />
<Compile Include="DSL\Documents\TextDecoration.fs" />
Expand All @@ -108,27 +125,36 @@
<Compile Include="DSL\Documents\Underline.fs" />
<Compile Include="DSL\Documents\InlineUIContainer.fs" />
<Compile Include="DSL\Buttons\Button.fs" />
<Compile Include="DSL\Buttons\DropDownButton.fs" />
<Compile Include="DSL\Buttons\ButtonSpinner.fs" />
<Compile Include="DSL\Buttons\SplitButton.fs" />
<Compile Include="DSL\Buttons\RadioButton.fs" />
<Compile Include="DSL\Buttons\ToggleButton.fs" />
<Compile Include="DSL\Buttons\ToggleSplitButton.fs" />
<Compile Include="DSL\Buttons\ToggleSwitch.fs" />
<Compile Include="DSL\Buttons\CheckBox.fs" />
<Compile Include="DSL\Remote\RemoteWidget.fs" />
<Compile Include="DSL\RepeatButton.fs" />
<Compile Include="DSL\DatePicker.fs" />
<Compile Include="DSL\TimePicker.fs" />
<Compile Include="DSL\Flyout.fs" />
<Compile Include="DSL\ItemsControl.fs" />
<Compile Include="DSL\ContentControl.fs" />
<Compile Include="DSL\TransitioningContentControl.fs" />
<Compile Include="DSL\BindingEvaluator.fs" />
<Compile Include="DSL\AutoCompleteBox.fs" />
<Compile Include="DSL\NumericUpDown.fs" />
<Compile Include="DSL\Border.fs" />
<Compile Include="DSL\Decorator.fs" />
<Compile Include="DSL\Border.fs" />
<Compile Include="DSL\ExperimentalAcrylicBorder.fs" />
<Compile Include="DSL\ThemeVariantScope.fs" />
<Compile Include="DSL\DataValidationErrors.fs" />
<Compile Include="DSL\ComboBoxItem.fs" />
<Compile Include="DSL\ComboBox.fs" />
<Compile Include="DSL\RefreshContainer.fs" />
<Compile Include="DSL\RefreshVisualizer.fs" />
<Compile Include="DSL\Carousel.fs" />
<Compile Include="DSL\NativeControlHost.fs" />
<Compile Include="DSL\Image.fs" />
<Compile Include="DSL\ListBox.fs" />
<Compile Include="DSL\RangeBase.fs" />
Expand All @@ -138,6 +164,8 @@
<Compile Include="DSL\ContextMenu.fs" />
<Compile Include="DSL\MenuItem.fs" />
<Compile Include="DSL\GridSplitter.fs" />
<Compile Include="DSL\DatePickerPresenter.fs" />
<Compile Include="DSL\TimePickerPresenter.fs" />
<Compile Include="DSL\ProgressBar.fs" />
<Compile Include="DSL\ScrollViewer.fs" />
<Compile Include="DSL\Separator.fs" />
Expand Down
90 changes: 90 additions & 0 deletions src/Avalonia.FuncUI/DSL/AutoCompleteBox.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ module AutoCompleteBox =
open Avalonia.Controls.Templates
open Avalonia.FuncUI.Types
open Avalonia.FuncUI.Builder
open System.ComponentModel
open Avalonia.Data

let create (attrs: IAttr<AutoCompleteBox> list): IView<AutoCompleteBox> =
ViewBuilder.Create<AutoCompleteBox>(attrs)
Expand Down Expand Up @@ -44,6 +46,13 @@ module AutoCompleteBox =
static member isDropDownOpen<'t when 't :> AutoCompleteBox>(value: bool) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<bool>(AutoCompleteBox.IsDropDownOpenProperty, value, ValueNone)

static member valueMemberBinding<'t when 't :> AutoCompleteBox>(binding: IBinding) : IAttr<'t> =
let name = nameof Unchecked.defaultof<'t>.ValueMemberBinding
let getter: 't -> IBinding = (fun control -> control.ValueMemberBinding)
let setter: 't * IBinding -> unit = (fun (control, value) -> control.ValueMemberBinding <- value)

AttrBuilder<'t>.CreateProperty<IBinding>(name, binding, ValueSome getter, ValueSome setter, ValueNone)

static member selectedItem<'t when 't :> AutoCompleteBox>(value: obj) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<obj>(AutoCompleteBox.SelectedItemProperty, value, ValueNone)

Expand All @@ -56,9 +65,87 @@ module AutoCompleteBox =
static member onTextChanged<'t when 't :> AutoCompleteBox>(func: string -> unit, ?subPatchOptions) =
AttrBuilder<'t>.CreateSubscription<string>(AutoCompleteBox.TextProperty, func, ?subPatchOptions = subPatchOptions)

static member onPopulating<'t when 't :> AutoCompleteBox>(func: PopulatingEventArgs -> unit, ?subPatchOptions) =
let name = nameof Unchecked.defaultof<'t>.Populating
let factory: SubscriptionFactory<PopulatingEventArgs> =
fun (control, func, token) ->
let control = control :?> 't
let handler = EventHandler<PopulatingEventArgs>(fun sender args -> func args)
let event = control.Populating

event.AddHandler(handler)
token.Register(fun () -> event.RemoveHandler(handler)) |> ignore

AttrBuilder<'t>.CreateSubscription<PopulatingEventArgs>(name, factory, func, ?subPatchOptions = subPatchOptions)

static member onPopulated<'t when 't :> AutoCompleteBox>(func: PopulatedEventArgs -> unit, ?subPatchOptions) =
let name = nameof Unchecked.defaultof<'t>.Populated
let factory: SubscriptionFactory<PopulatedEventArgs> =
fun (control, func, token) ->
let control = control :?> 't
let handler = EventHandler<PopulatedEventArgs>(fun sender args -> func args)
let event = control.Populated

event.AddHandler(handler)
token.Register(fun () -> event.RemoveHandler(handler)) |> ignore

AttrBuilder<'t>.CreateSubscription<PopulatedEventArgs>(name, factory, func, ?subPatchOptions = subPatchOptions)

static member onSearchTextChanged<'t when 't :> AutoCompleteBox>(func: string -> unit, ?subPatchOptions) =
AttrBuilder<'t>.CreateSubscription<string>(AutoCompleteBox.SearchTextProperty, func, ?subPatchOptions = subPatchOptions)

static member onDropDownOpening<'t when 't :> AutoCompleteBox>(func: 't * CancelEventArgs -> unit, ?subPatchOptions) =
let name = nameof Unchecked.defaultof<'t>.DropDownOpening
let factory: SubscriptionFactory<'t * CancelEventArgs> =
fun (control, func, token) ->
let control = control :?> 't
let handler = EventHandler<CancelEventArgs>(fun sender args -> func (sender :?> 't, args))
let event = control.DropDownOpening

event.AddHandler(handler)
token.Register(fun () -> event.RemoveHandler(handler)) |> ignore

AttrBuilder<'t>.CreateSubscription<'t * CancelEventArgs>(name, factory, func, ?subPatchOptions = subPatchOptions)

static member onDropDownOpened<'t when 't :> AutoCompleteBox>(func: 't -> unit, ?subPatchOptions) =
let name = nameof Unchecked.defaultof<'t>.DropDownOpened
let factory: SubscriptionFactory<'t> =
fun (control, func, token) ->
let control = control :?> 't
let handler = EventHandler(fun sender args -> func (sender :?> 't))
let event = control.DropDownOpened

event.AddHandler(handler)
token.Register(fun () -> event.RemoveHandler(handler)) |> ignore

AttrBuilder<'t>.CreateSubscription<'t>(name, factory, func, ?subPatchOptions = subPatchOptions)

static member onDropDownClosing<'t when 't :> AutoCompleteBox>(func: 't * CancelEventArgs -> unit, ?subPatchOptions) =
let name = nameof Unchecked.defaultof<'t>.DropDownClosing
let factory: SubscriptionFactory<'t * CancelEventArgs> =
fun (control, func, token) ->
let control = control :?> 't
let handler = EventHandler<CancelEventArgs>(fun sender args -> func (sender :?> 't, args))
let event = control.DropDownClosing

event.AddHandler(handler)
token.Register(fun () -> event.RemoveHandler(handler)) |> ignore

AttrBuilder<'t>.CreateSubscription<'t * CancelEventArgs>(name, factory, func, ?subPatchOptions = subPatchOptions)

static member onDropDownClosed<'t when 't :> AutoCompleteBox>(func: 't -> unit, ?subPatchOptions) =
let name = nameof Unchecked.defaultof<'t>.DropDownClosed
let factory: SubscriptionFactory<'t> =
fun (control, func, token) ->
let control = control :?> 't
let handler = EventHandler(fun sender args -> func (sender :?> 't))
let event = control.DropDownClosed

event.AddHandler(handler)
token.Register(fun () -> event.RemoveHandler(handler)) |> ignore

AttrBuilder<'t>.CreateSubscription<'t>(name, factory, func, ?subPatchOptions = subPatchOptions)

static member filterMode<'t when 't :> AutoCompleteBox>(mode: AutoCompleteFilterMode) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<AutoCompleteFilterMode>(AutoCompleteBox.FilterModeProperty, mode, ValueNone)

Expand All @@ -72,6 +159,9 @@ module AutoCompleteBox =
static member textFilter<'t when 't :> AutoCompleteBox>(filterFunc: string -> obj -> bool) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<_>(AutoCompleteBox.TextFilterProperty, filterFunc, ValueNone)

static member textSelector<'t when 't :> AutoCompleteBox>(selector: AutoCompleteSelector<string>) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<_>(AutoCompleteBox.TextSelectorProperty, selector, ValueNone)

static member dataItems<'t when 't :> AutoCompleteBox>(items: IEnumerable) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<IEnumerable>(AutoCompleteBox.ItemsSourceProperty, items, ValueNone)

Expand Down
Loading
Loading