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
305
Ribbon Color Picker
posted

Is there a way to make the color picker in the XamRibbon work like the one in MS Word?

By this I mean, having the color in the icon change based on the last selection and having the one click color change (once the icon has a color set). The video below will illustrate my point a little better than I did:

http://www.screencast.com/users/CarloToribio/folders/Jing/media/294d586d-5f1d-4b65-b701-b7edc33f8eed

Thanks in advance.

Parents
No Data
Reply
  • 54937
    Offline posted

    What you would probably do is use a DrawingImage as the SmallImage for the menu and bind the Color of the drawing's brush to that of the selected color. e.g.

      <igRibbon:MenuTool
        igRibbon:RibbonGroup.MaximumSize="ImageOnly"
        ShouldDisplayGalleryPreview="False">
        <igRibbon:MenuTool.SmallImage>
            <DrawingImage>
                <DrawingImage.Drawing>
                    <GeometryDrawing>
                        <GeometryDrawing.Pen>
                            <Pen Brush="Black" Thickness="1" />
                        </GeometryDrawing.Pen>
                        <GeometryDrawing.Brush>
                            <SolidColorBrush Color="{Binding Path=SelectedItem.Tag, ElementName=colorGallery}" />
                        </GeometryDrawing.Brush>
                        <GeometryDrawing.Geometry>
                            <RectangleGeometry Rect="0,0,16,16" />
                        </GeometryDrawing.Geometry>
                    </GeometryDrawing>
                </DrawingImage.Drawing>
            </DrawingImage>
        </igRibbon:MenuTool.SmallImage>
            <loc:ColorPickerGalleryTool x:Name="colorGallery"
                Id="globalColorPicker"
                AllowResizeDropDown="False"
                ItemBehavior="StateButton"
                ItemClicked="OnColorPicked" />
    </igRibbon:MenuTool>

     

Children