Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
160
Notification when a column was added
posted

My question is related to the fact, that I missing feature in the UltraGrid which will work similar to "Enabled" property but when it set to false it will not disable the scrollbars. The problem with DisplayLayout.Override.AllowUpdate is that the grid actually doesn't look as disabled and it even allows entering cells to the edit mode which is very user unfriendly. Can you please add the feature request?

So for now I try to implement this functionality by myself but I have a problem that when column is being added to the grid which is "disabled" (I set all columns' CellActivation to Disabled) it is "enabled". I found that there is SubObjectPropChangeEvent being fired from ColumnsCollection, but I don't see how to determine the new column. (In case of add it is possible - it will be the last one, but what to do with insert?)

Regards,
Maxim Golubitsky. 

Parents
No Data
Reply
  • 3707
    posted

    I had trouble interpreting your original post, but if it relates to the subject of getting a column notification when one is created, why not use extension methods? If you're able to switch the project over to the 3.5 .NET framework in the project properties then the snippet below could be useful. It's not a notification, but you can take control of the Add/Insert method.

        public static class UltraGridExtension
        {
            public static UltraGridColumn Add(this ColumnsCollection columns, string key, string caption, string unused)
            {
                UltraGridColumn gridColumn = columns.Add(key, caption);
                //Do processing on the created column
                return gridColumn;
            }
            public static UltraGridColumn Insert(this ColumnsCollection columns, int index, string key, string unused)
            {
                UltraGridColumn gridColumn = columns.Add(index, key);
                //Do processing on the created column
                return gridColumn;
            }
        }

    If I was way off from what you were asking, just ignore this reply. Also, if you use these extension methods, remember to use the correct override of the Add/Insert methods that we created.

    P.S. If you don't want to be as fancy with extension methods, the regular Add/Insert methods return the new UltraGridColumn that you can read/write properties from.

Children