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

Input Area Does Not Span Entire Width of Combo Box

1 Answer 83 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Vince Ockerman
Top achievements
Rank 1
Vince Ockerman asked on 21 Jun 2012, 06:36 PM
I have a website built using Telerik Silverlight Controls version: 2011.1.419.1040 for Silverlight 4.

I needed to upgrade the controls version because my client needs the Is NUll/Is Not Null selections in DataFilter. So, I upgraded all of the dlls to the downloadable SIlverlight 4 version: 2012.2.607.1040. 

Everything seems to be doing great in the project during regression testing except for a RadComboBox that holds movie titles. Due to the fact that it's full of movie titles, it's rather wide.
So when the combo box renders, it's about 578 pixels wide. Attempting to type a value into the input area puts your cursor at about the 200px mark, rather then left justified, and the input area itself seems to be about 200px wide.

The old version of the combo box in another branch uses the same xaml, but the old dlls and functions correctly. I have attached a screenshot demonstrating the differences in the input area.

I have tried removing all the resources and binding, as well as the items panel template. Nothing changed it. I need to know if I can do anything to make this work properly.

Here is the xaml for the ComboBox: 
<telerik:RadComboBox
    Style="{StaticResource _MouseEnabled}"
    x:Name="ddlTitleList"
    IsEditable="True"
    IsEnabled="{Binding EnableTitleSelection}"
    EmptyText="Search or Select"
    Grid.Row="1" Grid.Column="0"
    Margin="0,5,0,0"
    ItemsSource="{Binding TitleDescriptionList, Mode=TwoWay}"
    SelectedItem="{Binding SelectedTitle, Mode=TwoWay}"
    DisplayMemberPath="ProductName"
    >
        <telerik:RadComboBox.ItemsPanel>
            <ItemsPanelTemplate>
                <VirtualizingStackPanel/>
            </ItemsPanelTemplate>
        </telerik:RadComboBox.ItemsPanel>
    </telerik:RadComboBox>


Thanks in advance!

1 Answer, 1 is accepted

Sort by
0
Accepted
Vince Ockerman
Top achievements
Rank 1
answered on 21 Jun 2012, 10:42 PM
While waiting and still searching, I have found a workaround.

I subscribed to the Loaded event of my combobox, and using a snippet from http://www.telerik.com/help/silverlight/radcombobox-howto-set-max-length-input-area.html 

I modified and came up with:
private void ddlTitleList_Loaded(object sender, RoutedEventArgs e)
{
    var comboBox = sender as RadComboBox;
    if (comboBox == null)
        return;
 
    comboBox.Dispatcher.BeginInvoke(
        delegate
            {
                var rootElement = VisualTreeHelper.GetChild(comboBox, 0) as FrameworkElement;
                TextBox textBox = (TextBox) rootElement.FindName("PART_EditableTextBox");
                if (textBox != null)
                    textBox.Width = comboBox.ActualWidth - 5;
            });
}


The -5 is to keep it from pushing the layout (which it did at ActualWidth).

I still think this is bugged, thank goodness I found that How-To.
Tags
ComboBox
Asked by
Vince Ockerman
Top achievements
Rank 1
Answers by
Vince Ockerman
Top achievements
Rank 1
Share this question
or