Avalonia: Binding DynamicData observables enhancement

Created on 10 Dec 2019  路  6Comments  路  Source: AvaloniaUI/Avalonia

At the moment we can bind a control property to IObservable<T> using the ^ operator.

It would be nice enhancement to be able to bind ItemsControl.Items (etc) to DynamicData observables such asIObservableList<T> and IObservable<IChangeSet<T>> using the same operator.

class MyViewModel
{
   public  IObservableList<MyItem> MyItems { get ;}
}

<ItemsControl Items="{Binding MyItems^}"/>

One benefit would be that the ViewModel doesn't need to create and maintain a ReadOnlyObservableCollection<T> when the view binds directly to IObservableList<T>; the collection will never be created if the View never instantiates the control.

Most helpful comment

All 6 comments

IObservableList requires a dependency on DynamicData. Unless we use DynamicData in the core of Avalonia support for this is unlikely to happen.

I think you already have an indirect dependency on it as ReactiveUI v10.3.6 depends on DynamicData v6.13.9

Avalonia works perfectly fine without ReactiveUI and has no direct dependency as you stated. The binding system is part of the core of Avalonia. This feature should be optional.

My mistake, it's only used in the Avalonia.ReactiveUI.
Perhaps someday a DynamicData Binding markup extension could be added to that assembly.

I think we need a prototype that uses DynamicData in a sortable, groupable "ItemsControl". The control itself would need direct access to IObservableList etc

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RUSshy picture RUSshy  路  4Comments

khoshroomahdi picture khoshroomahdi  路  4Comments

MarchingCube picture MarchingCube  路  4Comments

Suriman picture Suriman  路  3Comments

danwalmsley picture danwalmsley  路  4Comments