We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Label for RibbonTextBox

Hi,

Is there a way to set a label for the RibbonTextBox so that it appears before the textbox?

Thanks,

Adam

5 Replies

PB Priyanga Balasubramaniam Syncfusion Team February 24, 2017 11:21 AM UTC

Hi Adam,

Thank you for contacting Syncfusion Support.

Currently our RibbonTextBox does not have "Label" property support. We have prepared the workaround sample to meet your requirement.

In this sample, we have added the Attached property "Label" and "LabelHorizontalAlignment" in sample level. Using these properties, we can set Label for RibbonTextBox and align it horizontally.

Please download the sample from the below location.

Sample: RibbonTextBox

Regards,
Priyanga B



AJ Adam Jones February 24, 2017 04:09 PM UTC

Hi Priyanga,

Thanks for the workaround, its ugly but it works and I'm happy :) 

fyi just incase you ever decide to add this as a feature - I ended up having the label on the left of the text box rather than above it.

Adam



PB Priyanga Balasubramaniam Syncfusion Team February 27, 2017 09:51 AM UTC

Hi Adam,

Thank you for the update.

In UWP when we set Header for TextBox control it will be placed above the control. Based on this UI we have provided template to display the label above the RibbonTextBox in last updated sample. You can achieve your requirement by changing StackPanel orientation as “Horizontal” in RibbonTextBox template.

We will consider the above request as feature. If you could confirm some specific details, it would help us to implement the feature in line with your requirement.

Please review the following description of the feature and let us know if it conforms to your requirement.

Need to provide Label Property for the RibbonTextBox control to display the label and property to mention the position of label.

Regards,
Priyanga B



AJ Adam Jones February 27, 2017 10:36 AM UTC

HI,

"Need to provide Label Property for the RibbonTextBox control to display the label and property to mention the position of label" is an adequate description.

Please note that the actual layout for having the label horizontal was a little more complicated than the vertical option and I needed to set both the stackpanel orientation as well as the VerticalAlignment and padding on the textblock in order for it to look consistent.  You might then want to expose LabelVerticalAlignment and LabelPadding as additional properties.

for Horizontal:
<StackPanel Orientation="Horizontal" >
     <TextBlock 
Padding="0, 0, 5, 0"
VerticalAlignment="Center"
HorizontalAlignment="{Binding Path=(local:RibonTextBoxWithLabel.LabelHorizontalAlignment), RelativeSource={RelativeSource Mode=TemplatedParent}}" 
Text
="{Binding Path=(local:RibonTextBoxWithLabel.Label), RelativeSource={RelativeSource Mode=TemplatedParent}}" />      <Border         x:Name="Bd"         Background="{TemplateBinding Background}"         BorderBrush="{TemplateBinding BorderBrush}"         BorderThickness="{TemplateBinding BorderThickness}"         Width="{TemplateBinding Width}"         SnapsToDevicePixels="true">         <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />      </Border>
</StackPanel>

Thanks and Best Regards,

Adam




KJ Keerthana Jegannathan Syncfusion Team February 28, 2017 11:10 AM UTC

Hi Adam,

Thank you for helping us define this feature. We have added it to our feature request list and it will be include in any of our upcoming releases.

Regards,
Keerthana J


Loader.
Up arrow icon