C
C#2mo ago
Pludam

[Avalonia] Problems setting ItemSource of ListBox from Codebehind

So the Problem im having is that when trying to set the The ItemSource of the SelectableServers ListBox (see the BlazeBin) its not reflecting in the UI. Ive verified that the callback that i made runs and that the Server gets added to the Servers list. the weird thing is that when i set the Background Color for the Parent Panel it works. Just the Updating of the ItemSource doesn't
6 Replies
Pludam
PludamOP2mo ago
BlazeBin - bsvsncunnhzh
A tool for sharing your source code with the world!
Pludam
PludamOP2mo ago
if you need the whole Solution ping me
Petris
Petris2mo ago
i'm like 99% sure avalonia is not thread safe
Pludam
PludamOP2mo ago
they have a tutorial on how to access the UI Thread. im doing that but it still doenst work the thing is that im setting the bg Color of the Parent Panel as a test in the same function that sets the ItemSoure and that works. just not the setting of the ItemSource to add some more context im using codebehind for this app since i couldnt figure out how mvvm works everything up to the setting of the ItemSource works the App is a basic Chat app im making for some practice the flow of the app is that on startup The Window content is set to the ServerListView using an ContentControl. Each view has A function thats called when the content control switches to that view. in this case it setsup the network and starts Server Discovery as part of starting Server Discovery i pass in an callback thats called when an server is discovered when the callback gets called the discovered server passed into the function should be added to a list of servers and the ItemSource of the ServerList ListBox sould be updated everything up to setting the ItemSource works
Pludam
PludamOP2mo ago
No description
Pludam
PludamOP2mo ago
@Petris hope this explains it a bit better to recap what my problem is.

Did you find this page helpful?