Length of Ribbon PopupButton in statusbar is not correct

Ribbon for WPF Forum

Posted 7 years ago by Kasper
Version: 11.2.0553
Platform: Silverlight Controls
Environment: Windows 7 (64-bit)
Avatar

Hi guys,

I have a really strange problem. In my statusbar, I have a Ribbon PopupButton. Its label is bound to the Count property of a static ObservableCollection I have on a class. In between, I have a converter, which simply converts the count to something that makes sense for the user, e.g. 0 to "No active items", 1 to "1 item" and so on. Now the strange thing is that at first, there is 0 items, so the text is set to something like "No active items". Once the app loads and items are added to the list, the text changes to something like "2 items" but the length of the button remains as if it was still the long text! This means that the button is now many pixels too long, leaving a lot of space between the text and the arrow. If I do it the other way around, and start off with a short text and then make it longer (all through the converter of course), it also fails - the button will then be too short to display the new text.

Now, if I add items to the list AFTER the application is done loading, the change is reflected in the width of the button, but that doesn't really help me in this situation :)

I have tried re-creating this in a quick sample app, but so far without any luck. Do you have ANY ideas what could be causing this and perhaps help me figure out what's going on? Even a workaround would do :). I have even tried calling all the Invalidate*() methods on the button, but it makes no difference.

Comments (4)

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

I'm not really sure, maybe its due to the containing panel or something.  When I did a simple test like below, the PopupButton resized correctly so I don't think the issue is with PopupButton itself.

<StackPanel>
	<TextBox x:Name="textBox">Label</TextBox>
	<ribbon:PopupButton Label="{Binding ElementName=textBox, Path=Text}" HorizontalAlignment="Left" />
</StackPanel>


Actipro Software Support

Posted 7 years ago by Kasper
Avatar

The layout is like this:

 

RibbonWindow.StatusBar > StatusBar > StatusBarItem > StackPanel > PopupButton

The StackPanel is occupied by 3 PopupButtons, where the troubling one is the last. The others are behaving pretty much as they should, but then again, their bindings are different because they serve another purpose. 

Any suggestions on how to test this further or work around it?

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Kasper,

I'm really not sure, I tried something similar to what you're describing and it worked fine.  You should probably just make a new project and start with a bare bones StatusBar and add in items and panels until you start seeing the problem, so that you can narrow down what's causing it.


Actipro Software Support

Posted 7 years ago by Kasper
Avatar

I already tried that, but it the items I use on my StatusBar uses a lot of stuff from my real project, so it would require a load of work to make it look and act like my application. That's why I asked if you could think of a workaround, because it's a pretty small problem that I would rather "fix by cheating" than figure out what causes it :). Anyway, if there's no possible workaound, I might look into the sample app again.

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.