Skip to content

Commit

Permalink
Update to Avalonia 11 RC 1 (#308)
Browse files Browse the repository at this point in the history
* Update for Avalonia 11 RC 1

* Remove commented out bindings

---------

Co-authored-by: Richard Webb <richard.webb@helpsystems.com>
  • Loading branch information
Numpsy and Numpsy committed Jun 13, 2023
1 parent a81e8f0 commit fe3cf45
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ open Avalonia.FuncUI.Elmish
open Avalonia.FuncUI.ControlCatalog.Views
open Avalonia.Themes.Fluent
open Avalonia.FuncUI
open Avalonia.Controls

type MainWindow() as this =
inherit HostWindow()
Expand All @@ -17,7 +18,7 @@ type MainWindow() as this =
base.Height <- 600.0
base.Width <- 800.0

this.VisualRoot.Renderer.Diagnostics.DebugOverlays <- Avalonia.Rendering.RendererDebugOverlays.Fps
TopLevel.GetTopLevel(this).RendererDiagnostics.DebugOverlays <- Avalonia.Rendering.RendererDebugOverlays.Fps
//this.VisualRoot.VisualRoot.Renderer.DrawDirtyRects <- true
()

Expand Down
3 changes: 0 additions & 3 deletions src/Avalonia.FuncUI/DSL/Base/Animatable.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,3 @@ module Animatable =
type Animatable with
static member transitions<'t when 't :> Animatable>(transitions: Transitions) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<Transitions>(Animatable.TransitionsProperty, transitions, ValueNone)

static member clock<'t when 't :> Animatable>(clock: IClock) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<IClock>(Animatable.ClockProperty, clock, ValueNone)
4 changes: 2 additions & 2 deletions src/Avalonia.FuncUI/DSL/MenuBase.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module MenuBase =
type MenuBase with

static member onMenuOpened<'t when 't :> MenuBase>(func: RoutedEventArgs -> unit, ?subPatchOptions) : IAttr<'t> =
AttrBuilder<'t>.CreateSubscription(MenuBase.MenuOpenedEvent, func, ?subPatchOptions = subPatchOptions);
AttrBuilder<'t>.CreateSubscription(MenuBase.OpenedEvent, func, ?subPatchOptions = subPatchOptions);

static member onMenuClosed<'t when 't :> MenuBase>(func: RoutedEventArgs -> unit, ?subPatchOptions) : IAttr<'t> =
AttrBuilder<'t>.CreateSubscription(MenuBase.MenuClosedEvent, func, ?subPatchOptions = subPatchOptions);
AttrBuilder<'t>.CreateSubscription(MenuBase.ClosedEvent, func, ?subPatchOptions = subPatchOptions);
7 changes: 4 additions & 3 deletions src/Avalonia.FuncUI/DSL/TabItem.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ module TabItem =
open Avalonia.Controls
open Avalonia.FuncUI.Types
open Avalonia.FuncUI.Builder

open System

let create (attrs: IAttr<TabItem> list): IView<TabItem> =
ViewBuilder.Create<TabItem>(attrs)

type TabItem with

static member tabStripPlacement<'t when 't :> TabItem>(placement: Dock) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<Dock>(TabItem.TabStripPlacementProperty, placement, ValueNone)
static member tabStripPlacement<'t when 't :> TabItem>(placement: Dock Nullable) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<Dock Nullable>(TabItem.TabStripPlacementProperty, placement, ValueNone)

static member isSelected<'t when 't :> TabItem>(value: bool) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<bool>(TabItem.IsSelectedProperty, value, ValueNone)
Expand Down
3 changes: 0 additions & 3 deletions src/Avalonia.FuncUI/DSL/TransitioningContentControl.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,5 @@ module TransitioningContentControl =

type TransitioningContentControl with

static member currentContent<'t when 't :> TransitioningContentControl>(value: obj) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<obj>(TransitioningContentControl.CurrentContentProperty, value, ValueNone)

static member pageTransition<'t when 't :> TransitioningContentControl>(transition: IPageTransition) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<IPageTransition>(TransitioningContentControl.PageTransitionProperty, transition, ValueNone)
2 changes: 1 addition & 1 deletion src/Avalonia.FuncUI/VirtualDom/VirtualDom.fs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module rec VirtualDom =
let delta = Differ.diff(last, next)
Patcher.patch(root, delta)

let updateRoot (host: IContentControl, last: IView option, next: IView option) =
let updateRoot (host: ContentControl, last: IView option, next: IView option) =
let root : Control voption =
if host.Content <> null then
match host.Content with
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<AvaloniaVersion>11.0.0-preview8</AvaloniaVersion>
<AvaloniaVersion>11.0.0-rc1.1</AvaloniaVersion>
<FuncUIVersion>0.6.0-preview9.1</FuncUIVersion>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ module Extensions =
if uri.IsAbsoluteUri && uri.IsFile then
new Bitmap(uri.LocalPath)
else
let assets = AvaloniaLocator.Current.GetService<IAssetLoader>();
new Bitmap(assets.Open(uri));
new Bitmap(AssetLoader.Open(uri))
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ namespace Examples.MusicPlayer
[<AutoOpen>]
module Extensions =
open System
open Avalonia
open Avalonia.Controls
open Avalonia.Media.Imaging
open Avalonia.Platform
Expand All @@ -17,8 +16,7 @@ module Extensions =
if uri.IsAbsoluteUri && uri.IsFile then
new Bitmap(uri.LocalPath)
else
let assets = AvaloniaLocator.Current.GetService<IAssetLoader>()
new Bitmap(assets.Open(uri))
new Bitmap(AssetLoader.Open(uri))

type Image with
static member FromString(s: string): Image =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ module Extensions =
if uri.IsAbsoluteUri && uri.IsFile then
new Bitmap(uri.LocalPath)
else
let assets = AvaloniaLocator.Current.GetService<IAssetLoader>();
new Bitmap(assets.Open(uri));
new Bitmap(AssetLoader.Open(uri))

0 comments on commit fe3cf45

Please sign in to comment.