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
435
Templating the ColorPicker button
posted

I would like to re-template the color picker button which launches the popup.

In the screenshot below, I'm using the WPF Ribbon control, and I want my Font Colour button to launch the ColorPicker popup directly, rather than the current 2-step process.  I figure the two ways to achieve this would be either embed the ColorPicker popup in my WPF RibbonMenuButton directly; or I could retemplate the ColorPicker button to match my current Font Colour button styling.  I'd say the first option would be preferable, but the second option would at least achieve what I need.

Any suggestions as to how to do this?

Thanks.

 

Parents
No Data
Reply
  • 9836
    posted

    One option is to override the default template of the XamColorPicker and remove the ToggleButton and the CololPickerDialog controls from the main grid (Root) and then place the RootPopupElement border directly as a child of the grid. You could also remove the Popup because is not needed.

    In order to host the XamColorPicker in the MenuItem you can use one of the two approaches described in this forum thread.

    Attached is a sample project that illustrates this implementation. Let me know if this is what you need.

    WpfApplication1.zip
Children