Hi there,
I am using Infragistics Control v2020.2 (Licensed) and I need to make the header editable if the user double clicks on it, so the user can rename the header text. I have found a event "DoubleClickHeader" and tried a couple of things with it but cant really achieve it. Is there a way of achieving this ?
Regards,
Muhammad Mujtaba
Hello Muhammad,
In order to edit the headers of the UltraGrid, what can I suggest you is using the AllowEdditing property on the column headers and setting it to AllowHeaderEditing.OnDoubleClick. it could be achieved by looping through all the columns and setting the property similar to the code below:
for (int i = 0; i < ultraGrid1.DisplayLayout.Bands[0].Columns.Count; i++)
{
ultraGrid1.DisplayLayout.Bands[0].Columns[i].Header.AllowEditing = AllowHeaderEditing.OnDoubleClick;
}
Please let me know if you have any questions.
Regards, Ivan Kitanov
Hi Ivan,
Thanks for quick reply, I tried your suggestion but this is not working and I am getting a error on double clicking the header
Attached a ScreenShot below
What's not working? The header is not entering edit mode? Entering edit mode almost certainly relies on the UIElements in the header. So if that's not working, the obvious reason is that your CraetionFilter is removing or changing the UIElements in such a way that the grid isn't getting the proper notifications or can't find the right place to put the editor. We'd need to see your CreationFilter in order to see what's going on there. it's not clear what your CraetionFilter is doing from this screen shot alone. There doesn't appear to be anything here that you woulld need a CreationFitler for and that you could not acheive without one.
If you could post a sample project using your CreationFilter, we could take a look.
Thanks Mike, the solution works perfectly fine
but since I am using CreationFilter implementing the AfterCreateChildElements function for customizing the header UI (see on the screenshot below) It is not working and when I use the default header (comment all the code inside the Function) It works well
am I missing something?
Do you know the exact version number you are using? 20.2 should work. I tested it out using 20.2.14 (which is the oldest build of 20.2 I could find) and I don't get any exceptions. I am attaching my sample project here.
I also took a look at the code for the EnterEditMode method where your call stack shows the exception and I can see that this was fixed internally on 1/7/2020. My guess is that you just need to get the latest version of 20.2. You are probably using the release build, and if you just update to the latest stable version (the latest service release), I think that should fix it.
WinFormsApp19.zip
I am using Net5 and infragistics v2020.2, so what do I need to upgrade?
Are you using Net Core? Microsoft removed the ContextMenu class from Net Core 3.1 and up. So it's possible that you may be using an older version of the controls that isn't supported in Net Core 3.1 and you might need to upgrade.