Hi,
i want to change the ControlTemplate of a MenuTool (2011.2), but only the Button-Area. I want to create a Button similar to the Fill-Background-Color and Change-Text-Color Buttons within EXCEL. I also want to use the IG-Style, when hovering over buttons and so on. Is this possible? I'm fairly new to WPF, so my approach looks like this.
I got a style and defined everything within the ControlTemplate to look like the Button i want to be in the Button-Area. When the Style is set on the MenuTool the Control only looks fine, all other things like the DropDown-Area and all behaviour is gone (Click-Events...). I guess i need something like to derive from the MenuTool, but i have no idea how to achieve that what i´m aiming for. Another guess is, that i´m missing something fundamental on understanding these parts of wpf...
Any help is much appreciated. (Is there already a control like this?)
<Style x:Key="MenuToolStyle" TargetType="{x:Type igRibbon:MenuTool}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type igRibbon:MenuTool}"> <Grid Width="22"> <Grid.RowDefinitions> <RowDefinition Height="14"></RowDefinition> <RowDefinition Height="8"></RowDefinition> </Grid.RowDefinitions> <Image Source="..." Grid.RowSpan="2" VerticalAlignment="Center" HorizontalAlignment="Center" Width="16" Height="16" Panel.ZIndex="1"></Image> <Rectangle Fill="Gold" Grid.Row="1" Panel.ZIndex="0" Margin="2"></Rectangle> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>
<igRibbon:MenuTool x:Name="formatBackGround" ButtonType="Segmented" Style="{StaticResource MenuToolStyle}" />
Hello,
Thank you for your post. I have been looking into it and I can say that this behavior is expected since the commands for the Click event and the opening of the DropDown are created internally in code based on the ContentPresenter inside the MenuTool’s default Template. When you apply a new one all the built in functionality is gone. If you want to be able to re-template the MenuTool, you can suggest new product ideas for future versions (or vote for existing ones) at <http://ideas.infragistics.com>.
There are many benefits to submitting an product idea:
- Direct communication with our product management team regarding your product idea.
- Notifications whenever new information regarding your idea becomes available.
- Ability to vote on your favorite product ideas to let us know which ones are the most important to you. You will have ten votes for this and can change which ideas you are voting for at any time.
- Allow you to shape the future of our products by requesting new controls and products altogether.
- You and other developers can discuss existing product ideas with members of our Product Management team.
Steps to create your idea:
The Product Idea site puts you in the driver’s seat and allows you to track the progress of your ideas at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you.