These are chat archives for AvaloniaUI/Avalonia

5th
Jan 2019
Kermalis
@Kermalis
Jan 05 03:39
How do I make a listbox redraw its contents? InvalidateVisual() doesn't do it
Kermalis
@Kermalis
Jan 05 03:44
Like, if one of the items in the binded collection changes, I'd like it to be drawn again (with its template)
ahopper
@ahopper
Jan 05 07:12
@Kermalis this should happen automatically as long as you use a collection and properties that notify change
Kermalis
@Kermalis
Jan 05 07:13
the solution was setting the items collection to a new object[0] then back to the original collection, it didn't work if I just put the original collection in the property setter (which notifies the change)
ahopper
@ahopper
Jan 05 07:14
was it an observableCollection or similar
Kermalis
@Kermalis
Jan 05 07:14
observablecollection
I wasn't changing the collection (by add or indexers), I was changing an item in it by reference and wanted to update manually at a certain point
ahopper
@ahopper
Jan 05 07:16
did the item properties notify? It really does work
Kermalis
@Kermalis
Jan 05 07:17
I thought so, but I'm not worrying about it right now
ksigne
@ksigne
Jan 05 07:28
@Kermalis
try this
`myListBox.Find<PART_ItemsPresenter>().Virtualizer?.TryRecycle(itemIndex, itemIndex, item, null)
itemIndex = myListBox.Find<PART_ItemsPresenter>().Virtualizer?.ContainerFromIndex(item)
.Find<ItemsPresenter>("PART_ItemsPresenter")
well
ahopper
@ahopper
Jan 05 07:34
really should not be needed
ksigne
@ksigne
Jan 05 07:35
@ahopper imagine you binding to objects that doesn't notify changes and are closed to you to change
ahopper
@ahopper
Jan 05 07:36
wrap them in a vm that does
ksigne
@ksigne
Jan 05 07:36
this is another way to that..
ahopper
@ahopper
Jan 05 07:36
DynamicData does some of this for you
yep but not mvvm friendly
Jeffrey Ye
@jeffreye
Jan 05 23:37
What is the best way to resize a window? ClientSize property or PlatformImpl.Resize method?
Looks like resizing is broken on Win, but works fine on macOS