This is a migrated thread and some comments may be shown as answers.

Content Alignment TextBox & RadComboBox

1 Answer 462 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 07 Dec 2017, 06:14 PM

Is there a simple way to get the text in a RadComboBox and a TextBox to be aligned?  Both controls are aligned but the text within the controls are slightly misaligned.

Thanks,

Bob

 

Sample XAML:

<Window x:Class="AlignmentIssue.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                Title="MainWindow" Height="350" Width="525">
        <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="45" />
            <RowDefinition Height="45" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <telerik:RadComboBox Grid.Column="0"
                             Grid.Row="0"
                             SelectedIndex="0">
            <telerik:RadComboBoxItem Content="Begin Item 1" />
            <telerik:RadComboBoxItem Content="Begin Item 2" />
        </telerik:RadComboBox>

        <TextBox Grid.Column="0"
                 Grid.Row="1"
                 Text="Begin Alignment Test" />

    </Grid>
</Window>

1 Answer, 1 is accepted

Sort by
0
Sia
Telerik team
answered on 08 Dec 2017, 02:02 PM
Hello,

The easiest way to align the content would be to use the Padding of these two controls. For example you can set Padding="6 0" to the RadComboBox and Padding="5 2" in implicit style targetting all RadComboBoxItems. Or set custom Padding="1 2" to the TextBox. These values work for our default Office Black theme.

Regards,
Sia
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
ComboBox
Asked by
Bob
Top achievements
Rank 1
Answers by
Sia
Telerik team
Share this question
or