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
25
UserControl containing a grid and design mode
posted

Hi All,

I created a user control incorporating an ultragrid besides some other controls that I want to use to display additional information about and interact with the grid in a certain way. This control I am going to be using everywhere the grid would go. Unfortunately it seems that in spite all my efforts I am not able to make this control to reveal the grid designer at design time. The control has a public property called say, TheGrid returning the UltraGrid in my UserControl but I don't know how I am supposed to let the designer know how to edit this property with the designer.

What I tried was to decorate my usercontrol with the DesignerAttribute

[Designer("Infragistics.Win.UltraWinGrid.Design.UltraGridDesigner, Infragistics2.Win.v10.3.Design, Version=10.3.20103.2145, Culture=neutral")]

as well as using all the other forms of this constructor. This will crash the designer complaining about a null pointer to the grid which I can see why it's happening since my UserControl is not a grid.

Also, I tried using an Editor attribute on the TheGrid property but I didn't get very far either. The code is below:

    //[Designer("Infragistics.Win.UltraWinGrid.Design.UltraGridDesigner, Infragistics2.Win.v10.3.Design, Version=10.3.20103.2145, Culture=neutral")]
    public partial class StableGridX : UserControl
    {
        public StableGridX()
        {
            InitializeComponent();
 
            _saveFilterBtn.Click += (sender, e) => _theGrid.SaveCurrentFilter();
            _resetFilterBtn.Click += (sender, e) => _theGrid.Rows.ColumnFilters.ClearAllFilters();
 
            _namedFiltersCtl.DataSource = _theGrid.NamedFilters;
            _namedFiltersCtl.DisplayMember = "Name";
 
            _namedFiltersCtl.SelectionChangeCommitted += (sender, e) => _theGrid.ApplyFilter((NamedFiltersEntry)_namedFiltersCtl.SelectedItem);
        }
 
        [Browsable(true)]
        [Editor(typeof(StableGrid), typeof(UltraGridDesigner))]
        public StableGrid TheGrid
        {
            get { return _theGrid; }
        }
 
        public static implicit operator StableGrid(StableGridX ctl)
        {
            return ctl._theGrid;
        }
    }

How can this be achieved? I want the grid designer to pop up when I want to edit TheGrid property?

Parents
  • 469350
    Offline posted

    Hi,

    I'm not sure if this is possible. The reason the attribute doesn't work is that the designer is assuming that the control it's designing is an UltraGridBase and your control is not.

    The designer class cannot be display via a property as a UITypeEditor, because it's not a UITypeEditor, it's a designer.

    If the grid designer dialog class is public (it's in the Infragistics.Win.Design assembly) then it might be possible for you to create your own UITypeEditor that displays the designer dialog, but I suspect that the dialog is not public and even if it is, I haven't tried it, so I don't know if it will work.

Reply Children
No Data