Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7828481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:22:03+00:00 2026-06-02T10:22:03+00:00

I am trying to use the xaml below to define a Button that will:

  • 0

I am trying to use the xaml below to define a Button that will:

  • have an image
  • have concatenated text, partly from an external resx & partly from a vm property
  • have an accelerator key based on the first letter of the text

The markup below gives me the image and text, but doesn’t work as an accelerator key (the “_” doesn’t hide and Alt-A doesn’t work).

How can I fix the markup to get accelerator key functionality?


Current markup and behavior

<Style x:Key="AddNewItemButtonStyle" BasedOn="{StaticResource blueButtonStyle}" TargetType="{x:Type Button}">
    <Setter Property="Content">
        <Setter.Value>
            <StackPanel Orientation="Horizontal" >
                <Image Source="{resx:Resx ResxName=Presentation.Resources.MasterDetail, Key=bullet_add}" Stretch="Uniform" />
                <TextBlock Text="_"/>
                <TextBlock Text="{resx:Resx ResxName=Presentation.Resources.MasterDetail, Key=Subject_AddNew}" />
                <TextBlock Text=" "/>
                <TextBlock Text="{Binding Subject}" />
            </StackPanel>
        </Setter.Value>
    </Setter>
    <Setter Property="Command" Value="{Binding AddNewItemCommand}" />
</Style>

enter image description here

Update w/ HB’s code

Nothing BUT the image:
enter image description here

<Style x:Key="AddNewItemButtonStyle" BasedOn="{StaticResource blueButtonStyle}" TargetType="{x:Type Button}">
    <Setter Property="Content" >
        <Setter.Value>
            <MultiBinding StringFormat="_{0} {1} {2}">
                <Binding Source="{resx:Resx ResxName=Presentation.Resources.MasterDetail, Key=Add}"/>
                <Binding Source="{resx:Resx ResxName=Presentation.Resources.MasterDetail, Key=New}"/>
                <Binding Path="Subject"/>
            </MultiBinding>
        </Setter.Value>
    </Setter>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="Button">
                <StackPanel Orientation="Horizontal">
                    <Image Source="{resx:Resx ResxName=Presentation.Resources.MasterDetail, Key=bullet_add}" Stretch="Uniform" />
                    <ContentPresenter/>
                </StackPanel>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
    <Setter Property="Command" Value="{Binding AddNewItemCommand}" />
</Style>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T10:22:05+00:00Added an answer on June 2, 2026 at 10:22 am

    You can use AccessText with a multi-binding

        <Style x:Key="AddNewItemButtonStyle" TargetType="{x:Type Button}">
            <Setter Property="Content">
                <Setter.Value>
                    <StackPanel Orientation="Horizontal" >
                        <Image Source="{... your image}" Stretch="Uniform" />
    
                        <AccessText>
                            <AccessText.Text>
                                <MultiBinding StringFormat="{}_{0} {1}">
                                    <Binding Source="{... resources}"/>
                                    <Binding Source="{Binding Subject}"/>
                                </MultiBinding>
                            </AccessText.Text>
                        </AccessText>
                    </StackPanel>
                </Setter.Value>
            </Setter>
        </Style>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use SVG (really XAML) to define a path which looks like
I'm trying to use the StringFormat in XAML to populate the Header text on
I am trying use Google Maps for my work; I have downloaded an example
I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
Hi I'm trying use a datepicker on a field I have. I'm trying to
I am trying to understand the use of XAML instead using it as markup
I'm trying to use NServiceBus to send messages from a console process (very similar
I am trying to use Generic Types in Windows.Resources section in XAML code. To
I'm trying to create a key for a class to use in XAML, but
I am trying to use the TiltEffect from the Silverlight toolkit within a LongListSelector

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.