Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding short-cuts or additional information to Application Menu Item (How to improve) #120

Closed
vdrasutis opened this issue May 25, 2015 · 2 comments
Assignees
Milestone

Comments

@vdrasutis
Copy link
Contributor

To be ab
In the able add additional information to application menu Item control:

<ControlTemplate x:Key="ApplicationMenuItemTemplate"
                 TargetType="{x:Type fluent:MenuItem}">

I changed the "textBlock" named element like this (to bind description to the right side):

<TextBlock x:Name="textBlock"
                   Width="Auto"
                   Height="Auto"
                   Margin="9,3,3,3"
                   VerticalAlignment="Center"
                   Grid.Column="1"
                   TextTrimming="CharacterEllipsis">
            <InlineUIContainer>
                <Grid Width="{Binding RelativeSource={RelativeSource AncestorType=TextBlock},Path=ActualWidth}">
                    <TextBlock Text="{TemplateBinding Header}" />
                    <TextBlock Text="{TemplateBinding Description}" TextAlignment="Right" />                        
                </Grid>
            </InlineUIContainer>
        </TextBlock>

And added additional rectangle after this block:

<Rectangle Grid.Column="2"
                       HorizontalAlignment="Right"
                       Margin="0,4,23,4"                           
                       Width="0" />

To add space equal to the split drop down button at the end.

By this simple change you can do like that:

<fluent:MenuItem x:Name="NewDocumentButton"
                             Command="ApplicationCommands.New"
                             Icon="Images\NewDocument_32x32.png"
                             Header="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}"
                             Description="Ctrl+N"    />

customizedapplicationmenuitem

@vdrasutis
Copy link
Contributor Author

In commit 00dfd62 > The example looks like this:
applicationmenuitem_improvement

@vdrasutis
Copy link
Contributor Author

One problem in this improvement that for one of the MenuItem`s Width has to be set. If Width are not set then the Header and Description text will be merged (Did not find how to do that menu were expanded that it mathces Header and Description text lenght).

@batzen batzen added this to the 4.0.0 milestone Dec 17, 2015
@batzen batzen self-assigned this Dec 17, 2015
@batzen batzen closed this as completed in 3a52563 Dec 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants