❔ replace oldblockscollection with new blockscollection
hey since my sorting is finished i want to make it work in my ui
12 Replies
but how could i make that i could replace my old blocks with my new blockscollection without clearing my ui field
with blockstime.children.x
my ui fielddefine this
i defined it
okay.... but you hadn't posted it here
so, how does the above code translate to anything in that wrap panel?
Nothing
I firstly fixed that everything what sorted correctly in the observeral collection
And after that i wanted to fix that it shows in ui but i’m not sure how to make that i replace the old observeral collection with the new one without clearing the wrappanel and just replacing it with correct positions
what observable collection?
i just need to know how to render the updated observable collection
nooooooooot that way
A)
B)
C)
that's it
the entire POINT of an
ObservableCollection
is that it's... observable
you don't need to trigger render updates when you change it
the collection does that itself
and the UI layer listens to that
that's what the Binding system accomplishes
you add an item to the collection, it appears on the screen
you remove an item from the collection, it vanishes from the screen
you sort the collection, the UI updates to matchis it a big problem if i make the string to a textblock since i need to use that to get background etc?
philosophically, yes, it's a code smell that you're mixing rendering concerns with logical concerns
mechanically, you're probably gonna have trouble actually getting those TextBlocks to DISPLAY, since the binding system isn't really built for that
you're effectively trying to bypass the
ItemTemplate
step, and I don't know if there's a mechanism to do that
leaving the ItemTemplate unspecified MIGHT work?alright it works Thank you
yeah i see he is now complaining about this
System.Windows.Data Error: 26 : ItemTemplate and ItemTemplateSelector are ignored for items already of the ItemsControl's container type; Type='TextBlock'
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.