Skip to content

Column already belongs to a DataGrid instance and cannot be reassigned #4747

Discussion options

You must be logged in to vote

@jhertel0 you don't want to create a new empty collection in your DependencyProperty definition. That'll create multiple different collections and all sorts of other bad things. See the docs here specify you need to initialize the collection in your constructor: https://docs.microsoft.com/windows/uwp/xaml-platform/custom-dependency-properties#initializing-the-collection

It sounds like as you navigate you're trying to re-add columns to a different collection or something, so that's why it says that it already belongs elsewhere as the old ones exist. You'd have to remove them from the old collection when navigating away if they're getting criss-crossed or something - or if you're trying to …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jhertel0
Comment options

Answer selected by jhertel0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DataGrid 🔠 Issues on DataGrid control
2 participants