Help about event in MultiColumCombobox

4 posts, 1 answers
  1. Exclamation
    Exclamation avatar
    10 posts
    Member since:
    Aug 2012

    Posted 25 Jul 2012 Link to this post

    Hi, Telerik Team .
    My issue is i want to call my method do something when i click one row in EditorControl of MulticolumnComboBox, but i can't use SelectedIndexChange because if Index not change then event does't catch.
    I try override method OnMouseUp of MultiColumnComboGridBehavior but this event also catch if i click the scrollBar in EditorControl. You can help me ! anyway, one event that On click one row in editor and dose not run when i click ScrollBar .
    Thanks for answers
  2. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 30 Jul 2012 Link to this post

    Hi Thanh, 

    Thank you for writing.

    The easiest approach for this case is to subscribe to the MouseDown event of the EditorControl and check if the clicked object is GridCellElement:
    void EditorControl_MouseDown(object sender, MouseEventArgs e)
           {
               GridCellElement cellElement = radMultiColumnComboBox1.EditorControl.ElementTree.GetElementAtPoint(e.Location) as GridCellElement;
               if (cellElement != null)
               {
                   Console.WriteLine("You have clicked a cell");
               }
           }

    I hope that the provided information addresses your question.

    All the best,
    Stefan
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Exclamation
    Exclamation avatar
    10 posts
    Member since:
    Aug 2012

    Posted 02 Aug 2012 Link to this post

    Thanks Stefan. It was help  me for fix problem.

    But when i select a row in RadGridview ,on cell that i selected appear a hight light (you can see my attach picture). You can help me remove it or set for it's border width = 0?

    Thanks
  5. Answer
    Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 06 Aug 2012 Link to this post

    Hi Thanh,

    Thank you for writing back.

    Here is how to remove the formatting of the current and the selected row and cell and set the colors back to the one from the ControlDefault theme:
    void EditorControl_ViewCellFormatting(object sender, CellFormattingEventArgs e)
    {
        if (e.Row.IsSelected || e.Row.IsCurrent)
        {
            e.CellElement.GradientStyle = GradientStyles.Solid;
            e.CellElement.BackColor = Color.White;
            e.CellElement.BorderColor = Color.FromArgb(209, 225, 245);
            e.CellElement.BorderWidth = 1;
            e.CellElement.BorderBottomColor = Color.FromArgb(209, 225, 245);
            e.CellElement.BorderBoxStyle = BorderBoxStyle.SingleBorder;
            e.CellElement.BorderGradientStyle = GradientStyles.Solid;
        }
        else
        {
            e.CellElement.ResetValue(LightVisualElement.GradientStyleProperty, ValueResetFlags.Local);
            e.CellElement.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
            e.CellElement.ResetValue(LightVisualElement.BorderColorProperty, ValueResetFlags.Local);
            e.CellElement.ResetValue(LightVisualElement.BorderWidthProperty, ValueResetFlags.Local);
            e.CellElement.ResetValue(LightVisualElement.BorderBottomColorProperty, ValueResetFlags.Local);
            e.CellElement.ResetValue(LightVisualElement.BorderBoxStyleProperty, ValueResetFlags.Local);
            e.CellElement.ResetValue(LightVisualElement.BorderGradientStyleProperty, ValueResetFlags.Local);
        }
    }
     
    void EditorControl_RowFormatting(object sender, RowFormattingEventArgs e)
    {
        if (e.RowElement.IsSelected || e.RowElement.IsCurrent)
        {
            e.RowElement.GradientStyle = GradientStyles.Solid;
            e.RowElement.BackColor = Color.White;
        }
        else
        {
            e.RowElement.ResetValue(LightVisualElement.GradientStyleProperty, ValueResetFlags.Local);
            e.RowElement.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
        }
    }

    Off topic, please try to separate your questions regarding different subjects in different threads, so it will be easier for our community to find them if needed. See p.4 in this thread: http://www.telerik.com/community/forums/winforms/multicolumncombo/important-information-on-using-the-telerik-forums.aspx.

    I hope this helps.
     
    Kind regards,
    Stefan
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Back to Top