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
3338
UltraComboEditor CheckedListSettings Cannot manually set check state.
posted

I am using the CheckedListSettings for the UltraComboEditor.  I get it set up and I can select multiple items, however, I also need to be able to manually (programmatically) set some of the items as checked or unchecked.  I set the CheckState property on the ValueList accordingly but it simply does NOT work.  If I set it to the Indeterminate state that shows up, however, I cannot Check a specific item.  Also setting the Value property seems to do nothing.  I am using the latest version of the Infragistics WinForms controls (10.3).

  • 20872
    Suggested Answer
    Offline posted

    Hello,

    I have tried the following and it does work for me:

    ultraComboEditor1.Value = new object[]{"val1", "val2"};

    where the "val1" and "val2" are the values from the column that I am assigning as a "ValueMember" .

            public Form1()
            {
                InitializeComponent();
                DataTable dt = new DataTable();
                dt.Columns.Add("String", typeof(string));
                dt.Columns.Add("String1", typeof(string));

                dt.Rows.Add("a", "val1");
                dt.Rows.Add("b", "rr");
                dt.Rows.Add("c", "pp");
                dt.Rows.Add("d", "gg");
                dt.Rows.Add("e", "val2");

                ultraComboEditor1.DataSource = dt;
                ultraComboEditor1.DisplayMember = "String";
                ultraComboEditor1.ValueMember = "String1";

                ultraComboEditor1.CheckedListSettings.CheckBoxStyle = Infragistics.Win.CheckStyle.CheckBox;
                ultraComboEditor1.CheckedListSettings.CheckBoxAlignment = ContentAlignment.MiddleRight;

                ultraComboEditor1.CheckedListSettings.EditorValueSource = Infragistics.Win.EditorWithComboValueSource.CheckedItems;

                ultraComboEditor1.CheckedListSettings.ListSeparator = ", ";

                ultraComboEditor1.CheckedListSettings.ItemCheckArea = Infragistics.Win.ItemCheckArea.CheckBox;
            }

            private void button1_Click(object sender, EventArgs e)
            {
                ultraComboEditor1.Value = new object[]{"val1", "val2"};
            }

    Please let me know if you have any further questions.

  • 69832
    Offline posted

    darylleger said:
    Also setting the Value property seems to do nothing. 

    The value you assign has to support multiple values, so if you set the Value property to the value of the item you want to check, it won't make that item checked. You can, however, assign a value like 'new object[]{ foo }' where foo is the value of the item you want to check. If you are doing this and the item is not appearing checked, you should report it as a bug.