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

SelectionBoxTemplate Cut-off

3 Answers 218 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
AJ
Top achievements
Rank 2
AJ asked on 02 Jun 2011, 05:32 PM
Wondering if anyone has a solution to this. I have a SelectionBoxTemplate on my combo box but it keeps getting the right hand side of the template cut-off.. The template is basically the same template that I use for the ItemTemplate without a border.
 
I am hoping to avoid having to hard code a width into the ComboBox to ensure that this doesn't happen:(

Cheers!
AJ

3 Answers, 1 is accepted

Sort by
0
Dani
Telerik team
answered on 03 Jun 2011, 07:54 AM
Hello Arie,

Both the SelectionBoxTemplate and the ItemTemplate would occupy all the space available from the RadComboBox width. So I guess that the cut off is due to some layout issue. Please, share the code you are using to create your instance of RadComboBox.

Best wishes,
Dani
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
AJ
Top achievements
Rank 2
answered on 03 Jun 2011, 11:00 AM
The code is from a very large project but here is the snippet of the XAML that is used to produce the combobox. Nothing fancy going on here.....

Cheers!
AJ
<telerik:RadComboBox Margin="10 5 10 5" EmptyText="Select Patient" ItemsSource="{Binding PatientsList}" SelectedItem="{Binding CurrentPatientSelection}" Width="150">
    <telerik:RadComboBox.SelectionBoxTemplate>
        <DataTemplate>
                <StackPanel Margin="2"
                        HorizontalAlignment="Left"
                        Orientation="Vertical">
                    <StackPanel Orientation="Horizontal">
                        <Grid Margin="10 0 0 0">
                            <Grid.RowDefinitions>
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                            </Grid.RowDefinitions>
                            <TextBlock Grid.Row="0"
                                   FontSize="10"
                                   FontWeight="Bold"
                                   Text="{Binding Path=FullName}" />
                            <StackPanel Grid.Row="1" Orientation="Horizontal">
                                <TextBlock FontSize="10" Text="DOB:" />
                                <TextBlock FontSize="10" Text="{Binding DOB, StringFormat=\{0:d\}}" Margin="2 0 0 0" />
                                <TextBlock FontSize="10" Text="Sex:" Margin="5 0 0 0"  />
                                <TextBlock FontSize="10" Text="{Binding Sex}" Margin="2 0 0 0" />
                            </StackPanel>
                            <StackPanel Grid.Row="2" Orientation="Horizontal">
                                <TextBlock FontSize="10" Text="Provider:" />
                                <TextBlock FontSize="10" Text="{Binding ReferrringDocName}" Margin="2 0 0 0"  />
                            </StackPanel>
                        </Grid>
                        <Line StrokeThickness="1" Stroke="LightGray"  />
                    </StackPanel>
                </StackPanel>
        </DataTemplate>
    </telerik:RadComboBox.SelectionBoxTemplate>
    <telerik:RadComboBox.ItemTemplate>
        <DataTemplate>
            <Border  BorderBrush="LightGray" BorderThickness="1" Margin="2" CornerRadius="2" >
        <StackPanel Margin="2"
                        HorizontalAlignment="Left"
                        Orientation="Vertical">
            <StackPanel Orientation="Horizontal">
                <Grid Margin="10 0 0 0">
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0"
                                   FontSize="10"
                                   FontWeight="Bold"
                                   Text="{Binding Path=FullName}" />
                    <StackPanel Grid.Row="1" Orientation="Horizontal">
                        <TextBlock FontSize="10" Text="DOB:" />
                            <TextBlock FontSize="10" Text="{Binding DOB, StringFormat=\{0:d\}}" Margin="2 0 0 0" />
                        <TextBlock FontSize="10" Text="Sex:" Margin="5 0 0 0"  />
                            <TextBlock FontSize="10" Text="{Binding Sex}" Margin="2 0 0 0" />
                    </StackPanel>
                        <StackPanel Grid.Row="2" Orientation="Horizontal">
                            <TextBlock FontSize="10" Text="Provider:" />
                            <TextBlock FontSize="10" Text="{Binding ReferrringDocName}" Margin="2 0 0 0"  />
                        </StackPanel>
                    </Grid>
                    <Line StrokeThickness="1" Stroke="LightGray"  />
                </StackPanel>
        </StackPanel>
            </Border>
        </DataTemplate>
    </telerik:RadComboBox.ItemTemplate>
</telerik:RadComboBox>
0
Dani
Telerik team
answered on 06 Jun 2011, 08:24 AM
Hello Arie,

Thank you for the code snippet. I tried to reproduce the issue using a sample collection of items and your code, but to no avail. I could not reproduce any cut-off, and your code seems just fine. It would be helpful, if you could provide more details on the problem. Maybe the values coming from your ViewModel are wider than the hard-coded  Width of the RadComboBox? Maybe you could share a reproducable sample ?

All the best,
Dani
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
ComboBox
Asked by
AJ
Top achievements
Rank 2
Answers by
Dani
Telerik team
AJ
Top achievements
Rank 2
Share this question
or