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
2265
UltraWinGrid UltraCombo as cell editor with CheckedListSettings
posted

Hi,

I am was using the UltraCombo to edit a bound list of objects - lets say Class1 - with a number of bound columns. 

One of these columns was to edit a single instance of an object - lets say Class2 in my grid.  This worked fine - until my client wanted to allow a selection of instances of Class1.  So the single object instance of Class2 in Class1 has changed from Class1.Class2 As Class2 to Class1.Class2 As List(Of Class2).  

I followed the examples of using CheckedListSettings.  This works brilliantly.  But now the client has changed his mind and wants the single instance of Class2 back in place.  Unfortunately, this involved changes to my entity framework model.  I could change it back to single instance which I am reluctant to at present as it could be a selling point for the software.

So my question is, is it possible to restrict this editor to a number of checked items (max of n) or only allow one item to be checked?  I can't find any suitable methods on the combo for when a check may occur.

Any thoughts?

 

Thanks

Andez

  • 20872
    Offline posted

    Hello Andez,

    We are still following this forum thread.

    Please feel free to let us know if you still have any concerns or questions with this matter.

     

  • 71886
    Offline posted

    Hello Andez,

    You could try the following code in order to achieve this:

            private void ultraCombo1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
            {
                if (ultraCombo1.Rows.Where(p => (bool)p.Cells[0].Value == true).Count() > 1)
                    e.Row.Cells[0].Value = !(bool)e.Row.Cells[0].Value;
            }
    

    Please feel free to let me know if a question about our tool set comes up on your mind.