Best way to bind to a mutable list, while retaining immutability through the rest of the pipe. #976
Replies: 1 comment 3 replies
-
Yup.
I'm not familiar with the inner workings of either
You certainly could, and that's potentially an operator we could add to DynamicData. The question is how much of a performance boost can you gain by doing all those operations at the same time, compared to just using the separate operators we have already.
I have precious little experience with Avalonia, or any UI framework other than WPF, but as I understand it, On a side note, I think this is yet another excellent example of a use-case that using var binding = source
.Filter()
.Sort()
.Transform(inlineUpdateAction: ...)
.Bind(); In my mind, this is the ideal scenario for using DynamicData to feed into a WPF-like UI framework, where data is immutable at the source, and translates into mutable VM objects just before being published to the View layer. |
Beta Was this translation helpful? Give feedback.
-
Hi! First of all, thanks for the great library! It's been SUPER useful and ergonomic to use.
I'm currently developing an Avalonia app and, since it's more efficient on xaml/mvvm platforms to update existing object inline, I use
TransformWithInlineUpdate
in my pipe to do that.My setup is as follows:
ReadonlyObservableCollection
usingSortAndBind
ReadonlyObservableCollection
from the Avalonia component (TreeDataGrid but it could also be a normal DataGrid)I just have a few question about the BEST way to do this.
TransformWithInlineUpdate
for this?Sort
andSortAndBind
greatly benefit from having immutable data in order to sort using a Binary Tree, what would be the best way to be able to use this considering I'm usingTransformWithInlineUpdate
? Could calling the sort IMMEDIATELY after doing the transformation work even though the object is mutable at that point? In my mind, the operators downstream ofTransformWithInlineUpdate
still get aRefresh
for each changed element, so would sorting using the Binary tree still function as expected?SortBindAndTransformWithInlineUpdate
operator? 😅 (I would have no idea where to even get started)ReadonlyObservableCollection
the right collection to use for binding to UI elements? I know you guys also supportBindingList
I'm just not sure which to use in this case.Thanks in advance! Looking forward to a good conversation 🙃
Beta Was this translation helpful? Give feedback.
All reactions