CustomControl UsesAlternateStyle when not a popup

Ribbon for WPF Forum

Posted 12 years ago by Bryan Livingston
Avatar
I am building a drawing program using the ribbon and wish to have the current brush color shown on the ribbon and have it updated in realtime.

UseAlternateStyle doesn't seem to work when the CustomControl is embedded in the ribbon style. It still leaves a big space in the ribbon for the label. Is this deliberate or is it a bug or am I doing something wrong?

                    <ribbon:Group Label="Fill">
                        <ribbon:CustomControl ribbon:Ribbon.UsesAlternateStyle="True" >
                            <Button Command="{x:Static ld:ShowFillBrushEditorCommand.Command}" >
                                <Rectangle x:Name="FillBrushPreview" Width="50" Height="50" Margin="1" Fill="Black" />
                            </Button>
                        </ribbon:CustomControl>
                    </ribbon:Group>
I would almost rather use the ribbon Button or SplitButton classes if I could just be able to set their image area's to some arbitrary xaml. Which I think would be nice for the GalleryItems as well.

BTW: UseAlternateStyle is referenced once as UseAlternativeStyle in the help docs page on CustomControl.

Bryan

[Modified at 06/04/2007 06:44 PM]

[Modified at 06/04/2007 06:45 PM]

[Modified at 06/04/2007 06:46 PM]

Comments (5)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Bryan,

Can you provide any other implementation details you have for seeing improvements with the Images? I was browsing the framework and would DrawingImage be of any use to you? DrawingImage is an ImageSource and allows you to pass a drawing, which is essentially XAML.

Thanks for the bug report on the large in-ribbon CustomControl style. The Label and Image were being hidden but not collapsed when no label or image was passed. This is corrected for the next maintenance release.

I wasn't able to find the "UseAlternativeStyle" in the docs. Can you say which page and paragraph this is in the latest docs? Thanks much!


Actipro Software Support

Posted 12 years ago by Bryan Livingston
Avatar
Excellent. Thanks for the bug fix and the fast service. It's very comforting to be committed to such a quality company.

I had assumed that ImageSourceLarge was a string type since that is what it is on the RibbonCommand constructors (which should probably take an object type so that they can be set to ImageSource objects.)

I got the following code to work. Would be cool if something like it was included in the sample code. Maybe for the theme button images.
                        <ribbon:Button>
                            <ribbon:Button.ImageSourceLarge>
                                <DrawingImage>
                                    <DrawingImage.Drawing>
                                        <GeometryDrawing Brush="Orange">
                                            <GeometryDrawing.Geometry>
                                                <EllipseGeometry RadiusX="20" RadiusY="20" />
                                            </GeometryDrawing.Geometry>
                                        </GeometryDrawing>
                                    </DrawingImage.Drawing>
                                </DrawingImage>
                            </ribbon:Button.ImageSourceLarge>
                        </ribbon:Button>
The typo is in Documentation.chm on page called
Ribbon Controls
Custom Controls in Popups

"Next add a CustomControl child item to the anchor control. By default the CustomControl will show an image in the left of the menu and a label if specified. However there are cases, as in the sample below, where you want the custom control to fill the width of the popup. In these cases, set the Ribbon.UsesAlternativeStyle attached property to true on the CustomControl. "
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
In the template, an Image is used to render the ImageSource. And that only takes an ImageSource object so that's why those properties are of that type.

Once we get a little further with Galleries perhaps we'll use similar sample code to show the current foreground color in the editor.


Actipro Software Support

Posted 12 years ago by Bryan Livingston
Avatar
I meant that the RibbonCommand constructor should take an object type and accept either strings (as it does now) or an ImageSource. Currently it only accepts strings.
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Good suggestion, overloads for ImageSources have been added for the next maintenance release.


Actipro Software Support

The latest build of this product (v2018.1 build 0675) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.