-
Notifications
You must be signed in to change notification settings - Fork 33
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
WPF example is behaving weirdly #7
Comments
SynchronizedView<T, TView> が通知する NotifyCollectionChangedEventArgs<T> が T 型のため WPF に渡される要素も T 型になっているのが原因のように思われます。 NotifyCollectionChangedEventHandler<TView> として TView 型コレクションの変更イベントにしてやるとうまくバインドされました。やっつけ実装 ビューが (T value, TView view) のタプルになっている理由はフィルタメソッドで両方見たいからではと推測しましたが、元コメントにあるように WPF で直接バインドできないのは不便に感じました。 ※試してませんが NotifyCollectionChangedEventHandler<(T, Tvalue)> としたら Item2.~ で取れたりするのでしょうか。 -- It seems that the element passed to WPF is also T type because NotifyCollectionChangedEventArgs<T> notified by SynchronizedView<T, TView> is T type. By modifying the type parameter to NotifyCollectionChangedEventHandler<TView>, it was successfully bound to a TView type collection change event. Rough implementation I guess the reason the view is a tuple of (T value, TView view) is because it's convenient to be able to see both values in the filter method, but as the original comment says, it can't be bound directly in WPF. I felt inconvenient.
|
ありがとうございます、そのとおりですね、このままではあまりに不便というのはもっともです……! You're right, it's too inconvenient as it is. |
こんな感じで書けるような、別の案を考えてみました。実装
|
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
Could we reopen this issue? It was stale but the issue still exists. |
sorry for no longer repond it, I'll check it. |
This looks like it would work very well to provide an ObservableRingBuffer with the ability to load a large slice of data at once for a real time graph (SyncFusion) in WPF. |
Bind to the view. |
This issue needs to be resolved to make the library usable with WPF bindings. Sending either a tuple or the actual object makes it unusable with ListView or DataGrid controls since the column bindings completely break. One way around this is tediously implementing IValueConverters for each column that extract the desired property from either a tuple or the object. |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
sorry for delayed response, |
Thanks @neuecc! ❤️ |
Hi there,
First let me thank you for the massive and impressive work you did with this library! Observable collections are really something that should get more love in the .Net ecosystem :)
I noticed something strange with the WPF example that you provide. When I run it locally and press a few times on the "Insert" button, I get the following :
The first 3 lines (in red) correspond to the initial items inserted via
AddRange
and is the tuple(value, view)
, while the rest (in green) has been added by pressing the "Insert" button and is only the value.I do not understand why there is a difference, do you have any idea what could be the reason?
I'm also questioning yielding tuples
(value, view)
when enumerating, instead of only views. Tuples cannot be used directly for<ListView ItemSource={...} />
. Is there a reason for this choice?The text was updated successfully, but these errors were encountered: