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 719717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:40:32+00:00 2026-05-14T05:40:32+00:00

It seems to me that the Ribbon control has a problem with textboxes. I

  • 0

It seems to me that the Ribbon control has a problem with textboxes. I was expecting a common TextBox control behaviour: a fixed width and a visible caret when the text exceeds the width. But the RibbonTextBox control changes its width and when the text exceeds the right limit, the overflow is not visible.

I found a hack on a blog that does something like this:

var img = SearchButton.Template.FindName("image", SearchButton);
if (img != null && img is Image)
   (img as Image).Visibility = Visibility.Collapsed;
var lbl = FindTemplateControl<Label>(SearchText);

var border = SearchText.Template.FindName("Bd", SearchText);

if (border != null && border is Border && img != null && lbl != null)
{
    (border as Border).Width = SearchText.ActualWidth - (((Image)img).ActualWidth + lbl.ActualWidth);
}

but I reallly don’t want to do such a workaround. Is there any other simpler way to achieve simple TextBox behaviour?

  • 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-05-14T05:40:33+00:00Added an answer on May 14, 2026 at 5:40 am

    Apparently, the RibbonTextBox isn’t a simple TextBox; it’s actually a stackpanel with:
    image + label + border. Actually, its template has this content:

    <RibbonTextBox>
        <StackPanel>
            <Image/>
            <Label>
                <Border>
                    <ContentPresenter>
                        <TextBlock/>
                    </ContentPresenter>
                </Border>
            </Label>
            <Border>
                <ScrollViewer>
                    <Grid>
                        <Rectangle>
                        </Rectangle>
                        <ScrollContentPresenter>
                            <TextBoxView>
                                <DrawingVisual/>
                            </TextBoxView>
                            <AdornerLayer/>
                        </ScrollContentPresenter>
                        <ScrollBar/>
                        <ScrollBar/>
                    </Grid>
                </ScrollViewer>
            </Border>
        </StackPanel>
    </RibbonTextBox>
    

    So, when you set the width of a RibbonTextBox, you don’t actually set the width of the textbox, but the entire control’s width.

    My suggestion would be to create a class that derives from RibbonTextBox and implement in this class the Loaded event handler just like the example you gave in your post. But keep in mind that the image, label and border have additional margin and padding which will give you extra space on the left of the textbox.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The ribbon control seems to be the rage now that Windows 7 is here.
Seems that my VS2008 help index has finally become FUBAR. It's already a known
It seems that a similar question has been asked an solutions exist for other
Adding ribbon controls seems strightforward enough, but how do I make it so that
Seems that iPad rules overwrite iPhone4 related rules. How can I solve this problem?
It seems that starting with .NET 3.0, Microsoft moved some common assemblies to C:\Program
Seems that requirements on safety do not seem to like systems that use AI
Seems that even after unchecking the option in the PyDev/Debug preferenecs pane to launch
It seems that a List object cannot be stored in a List variable in
It seems that it is impossible to capture the keyboard event normally used for

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.