How can I set the width of PopupButtons's Popup?

WPF Studio, Themes, and Shared Library for WPF Forum

Posted 9 years ago by illef - Dotnetxpert, Dotnetxpert
Avatar
Easy question!

How can I set the width of PopupButtons's Popup?

Comments (5)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Illef,

The width/height of the popup is based on whatever content you put into it. So if you put a Border element that is 100x100, then the popup would be 100x100 (it may be a little larger if a drop-shadow is used though).


Actipro Software Support

Posted 9 years ago by illef - Dotnetxpert, Dotnetxpert
Avatar
Yes, I know that. The problem is, I can't set the width of content. Actually, I want to set the width dynamically.

For example,

<shared:PopupButton DisplayMode="Merged" x:Name="popupButtonRoot" >
<shared:PopupButton.PopupContent>
<TreeView x:Name="treeView"
Width="{Binding ElementName=popupButtonRoot,Path=ActualWidth}"/>
</shared:PopupButton.PopupContent>
</shared:PopupButton>

but It doesn't work.


I think you can understand what I want.

Thank you.

[Modified at 06/20/2010 06:41 PM]
Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello,

When I take your example code above and run it, the TreeView (which is shown in the popup) is the same width as the PopupButton. You don't set the PopupButton.Content so the button is rendered very small though.

Can you please put together a small sample project and send it over to our support address? Be sure to remove any executable files from the zip archive. Also, please indicate exactly what the problem is in the project.


Actipro Software Support

Posted 9 years ago by illef - Dotnetxpert, Dotnetxpert
Avatar
I didn't find your support e-mail address :( So I just write simple code.

<shared:PopupButton DisplayMode="Merged" Content="Test" x:Name="popupButton">
<shared:PopupButton.PopupContent>
<ItemsControl Background="White" Width="{Binding ElementName=popupButton, Path=ActualWidth}">
<TextBlock>1</TextBlock>
<TextBlock>2</TextBlock>
<TextBlock>3</TextBlock>
<TextBlock>4</TextBlock>
<TextBlock>5</TextBlock>
<TextBlock>6</TextBlock>
</ItemsControl>
</shared:PopupButton.PopupContent>
</shared:PopupButton>

It is everything. The PopUp in PopupButton have to be displayed as same width of PopupButton.(like ComboBox in WPF) (My English is poor ... but I think you can understand what I want.)


Thank you for your help.
Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello,

You can find our support (Customer Support) email under our "Contact Us" page: http://www.actiprosoftware.com/Company/Contact.aspx

Your second sample isn't much different that your first, but again the popup is sized so that it's width is the same as the width of the PopupButton (just like a ComboBox). If you can please send along a small sample project that exhibits the issue, then we can look at this further. You may want to include a screen capture and mark on that what you are trying to accomplish, then send that image along also.

Thanks!


Actipro Software Support

The latest build of this product (v2019.1 build 0681) 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.