Hi,
I am working with ultrawingrid,i have a problem to hide columns in utrawingrid when we click that column.I worked with that but i did not get the right answer.Please help me How can i get the that result
please provide answer with events.
Thanking you,
VinayPinisetti
Hello,
You could try saving the 'DisplayLayout' of the WinGrid, like in the following code sample:
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
ultraGrid1.DisplayLayout.SaveAsXml("..//..//choosedCols.xml");
}
Please feel free to let me know if I misunderstood you or if you have any other questions.
Hi all.
I work with the ColumnChosserButton.Now I want to save the settings (choosed Columns) in a xml file before the form is closed.How can I access these settings?
I want to preface this with a recommendation that you reconsider doing this because user will almost certainly think there is a serious bug at play when they click a column header or cell and that column vanishes. You can set UltraGrid.DisplayLayout.Override.RowSelectorHeaderStyle to ColumnChooserButton to get the grid to show a button in the top left corner which, when clicked, displays a dialog that enables the user to show/hide columns.
The answer to your original question is, you can hit test for a column using UIElement methods like ElementFromPoint and GetContext; the former gives you a way to get a reference to the UIElement at the cursor position, and the latter lets you determine which column the element belongs to. Once you have a reference to the column you can set its Hidden property to true, although once you do there would be no way for the user to make that column visible again.