سؤال

I'm writing Silverlight application and I have a datagrid in which first two columns' positions are fixed, but others can be reordered. If I simply set CanUserReorder property to true/false respectively, than I can still take 3rd column and put it into 1st position.

What can I do to implement behaviour I need?

For now I can only think of manually handling ColumnReordered/ColumnReordering events in code-behind. Are there any solutions I am missing?

هل كانت مفيدة؟

المحلول

Check out the FrozenColumnCount of the datagrid.

dgMyGrid.FrozenColumnCount = 2

That will prevent the first two columns from being moved. As a "bonus", they won't scroll while others do (though this may not be what you want...)

From MSDN Blog: http://blogs.msdn.com/b/scmorris/archive/2008/10/15/freezing-columns-in-the-silverlight-datagrid.aspx

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top