Hello, actually I think I should have named this topic: "How to prevent drag'n'drop on a specific column", because it has little to do with the freeze, and most likely nothing to do with the fact that it's generated dynamically.
What I want is to display a specific column, and keep it in the view at anytime. The user must not be able to move it.
To this end, I set the LeftFrozenColumnCount to 1, and I move this column to index 0 when I'm done generating my columns, to ensure it's the one that is frozen. This is the initial setup when the user comes in.
Now, I want my user to be able to freeze and unfreeze any columns they want; I just need this specific column to NOT be unfreezable, so that it always stays in view.
I tried to set IsReorderable to false on this specific column, but then I can no longer freeze columns to the left of this column, and I want users to be able to do this.
I stumbled upon this thread: https://www.telerik.com/forums/preventing-resizing-and-re-ordering-of-specific-columns#850549
What Gary describes is exactly the behavior I'm looking for:
Looking at the WPFToolkit grid, setting "CanUserReorder" to false means the user cannot drag and drop the column. But after doing some testing, you're right in that a user can still just drop other columns in front to change it's posistion.
For now, I subscribe to the PreviewDrop event of the RadGridView, and I cancel the drop by setting e.Handled to true when the dropped data is the GridViewHeaderCell of this specific column. It works, but I want to prevent the drag in the first place, not just prevent the drop. Applying this technique to PreviewDragEnter, or DragEnter, does not seem to have any effect.
How can I achieve this? Thanks!