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
910
PopupColorPickerTool close dropdown via code
posted

Hi,

when registering to the ToolClick event of a PopupColorPickerTool with following handler:

PopupColorPickerTool popupColorPickerTool = sender as PopupColorPickerTool;
if (popupColorPickerTool != null)
{
if (!popupColorPickerTool.IsOpen)
{
popupColorPickerTool.DropDown();
}
}

there is no equivalent to close a dropdown, except ClosePopup. Anyway the "IsOpen" property is always false even if the dropdown is open. Only on the colorControl (which is private) I could determine if the colorpicker is open or not. Any suggestions?

Thanks Michael

  • 23930
    Verified Answer
    Offline posted

    Hi Michael,

    Thank you for posting in our forums.

    The IsOpen property always returns false in the ToolClick event, because even if it was opened, when you click the tool it automatically closes. So in time of the event the tool is actually closed and because of this the IsOpen property returns false.

    Looking at your code it seems that you are trying to toggle the dropdown state of the tool whenever the tool is clicked. If this is the case you don’t need the ToolClick event. You can simply set the DropDownArrowStyle of the tool to Standard. This will achieve this functionality. You can do that by using the following line:

                ((PopupColorPickerTool)this.ultraToolbarsManager1.Tools[“ColorPickerToolKey”]).DropDownArrowStyle = DropDownArrowStyle.Standard;

    Please let me know if you have any additional questions.