When i move column position, visibleindex remain unchanged
I am handling AfterColumnMove event to find the column visble location. but it remains unchanged
where can i actually get this?
Hi,
I'm afraid I do not understand your question. There is no AfterColumnMove event in the WinGrid. There is an AfterColPosChanged event. Is that what you meant?
If so, then what property are you looking at, and on what object? There is no VisibleIndex property on the column. There's a VisiblePosition on the Column Header. If that's what you meant, then the only reason I can think of why this would not be updated is if you are using RowLayouts in your grid - in which case the VisiblePosition is not used in favor of the RowLayoutColumnInfo on each column.
Hi Mike,
Thanks for the reply
Yes, you are right, i am talking about AfterColumnMove event and VisibilePosition property.
Hmm... i am not using RowLayouts.
my requirement is simple, have to save grid settings ( only column position, and column visibility) to DB. if i use this code
grid.DisplayLayout.SaveAsXml(stream,PropertyCategories.SortedColumns)
, size of generated XML is around 11.1kb, so obviously this is huge impact on performance.
so i decided to build myself . so wire up at AfterColPosChanged
[Sample code]
this.AfterColPosChanged += (sender, e) => { OnLayoutChanged( ); };
string OnLayoutChanged(UltraGrid gridControl )
{
XmlDocument doc = new XmlDocument( );
XmlElement rootElement = doc.CreateElement(gridControl.Name);
doc.AppendChild(rootElement);
foreach (UltraGridColumn item in gridControl.DisplayLayout.Bands[0].Columns)
string nodeName = GetFormattedNodeName(item.Key);
XmlElement e = doc.CreateElement(nodeName);
e.SetAttribute(index, item.Header.VisiblePosition.ToString( ));
e.SetAttribute(visible, item.Hidden.ToString( ));
rootElement.AppendChild(e);
}
but, visibleposition is not changing when i move/swap the column
do you think did i missed something?