TextBox cannot show its label!

Ribbon for WPF Forum

Posted 14 years ago by JerryLia
Avatar
hi,I have met another problem which the textbox cannot show its label except that is located in a stackpanel,but when I locate textbox in a stackpanel,it can not be stretched! please see the sceenshot as followed!

Click here to see the sceen shot

<ribbon:StackPanel  Grid.Column="3" Grid.Row="1" Width="Auto" HorizontalAlignment="Stretch" 
                                                   ItemVariantBehavior="MediumThenSmallWhenSmall">
     <ribbon:TextBox Name="txYear" Label="统计年份:" MinWidth="30" VerticalAlignment="Stretch" 
               Height="Auto"  Margin="0" HorizontalAlignment="Stretch" VariantSize="Medium" 
               VerticalContentAlignment="Center" HorizontalContentAlignment="Left" MinHeight="18" />
</ribbon:StackPanel>

Comments (1)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Jerry,

Ribbon TextBoxes by design only render labels in a StackPanel (I believe the StackPanel actually is what draws it) and are not meant to be stretchable. They are designed to work through variant sizes as a containing Ribbon is sized larger or smaller.

You have a lot of properties in your code sample that the ribbon controls will not work well with. Note that if you are trying to add a label to a TextBox and have the ribbonish style, just use a normal Label or TextBlock control for the label portion and use a regular WPF TextBox. We provide ribbon-like styles you can apply to native controls such as TextBox. See our "Styles for Core WPF Controls" QuickStart for a sample.


Actipro Software Support

The latest build of this product (v24.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.