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

Setting GridViewComboBoxColumn drop down width

6 Answers 392 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Akshatha
Top achievements
Rank 1
Akshatha asked on 04 Oct 2011, 11:42 AM
I'm facing the following problem

I am using the RadGridView control and one of the column is of type GridViewComboBoxColumn. When the comboBox column is expanded the drop down list width is not aligned with combobox column width. The drop down width changes according to the size(length) of the items present in the drop down.But i want the drop down width to be aligned with the comboBox column width and it shouldn't resize as per the items present in the drop down. 
  

6 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 04 Oct 2011, 12:10 PM
Hello Akshatha,

 


You may use the approach demonstrated at the following forum thread "How to specify width of GridViewComboBoxColumn drop down". The same is applicable to WPF as well. 



Please take a look at it and if you need any further assistance do not hesitate to contact us! 



Kind regards,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Akshatha
Top achievements
Rank 1
answered on 04 Oct 2011, 12:25 PM
Hello Vanya,

I tried using the solution

<telerik:RadGridView Grid.Row="1" x:Name="radGridView"  x:FieldModifier="public"  RowIndicatorVisibility="Collapsed"  ShowGroupPanel="False" AutoGenerateColumns="False" CanUserDeleteRows="False" CanUserInsertRows="False" CanUserReorderColumns="False" CanUserFreezeColumns="False" CanUserResizeColumns="False" IsFilteringAllowed="False" IsScrolling="False" Margin="4,1,4,2" HorizontalGridLinesBrush="Gray" VerticalGridLinesBrush="Gray" CanUserSelect="True" Background="White"  CellValidating="GridCellValidating"  >
          <telerik:RadGridView.Columns >
                <telerik:GridViewDataColumn  x:FieldModifier="public" x:Name="textBoxColumn" Width="150" IsReadOnly="True" IsEnabled="False" Background="LightGray" />
                <telerik:GridViewComboBoxColumn x:FieldModifier="public" x:Name="comboColumn"  Width="*" >
                    <telerik:GridViewComboBoxColumn.Resources>
                        <Style TargetType="telerik1:RadComboBoxItem">
                            <Setter Property="MaxWidth" Value="10"/>                           
                        </Style>
                    </telerik:GridViewComboBoxColumn.Resources>
                </telerik:GridViewComboBoxColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>



But its still not working.
0
Vanya Pavlova
Telerik team
answered on 04 Oct 2011, 01:03 PM
Hi Akshatha,

 

It would be better if you move this style in other ResourceCollection, not to the ResourceCollection of a column. I have defined the style within Window's ResourceCollection and everything works fine by my side, please refer to the attached picture.  If you need any further modification, you should predefine the template of RadComboBox as proposed in the previously referenced forum thread. 


Please let me know how this works for you! 


Kind regards,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Akshatha
Top achievements
Rank 1
answered on 10 Oct 2011, 09:42 AM
Hi Vanya,

Thanks,it works fine now! :)
0
Akshatha
Top achievements
Rank 1
answered on 10 Oct 2011, 10:49 AM
Hi Vanya,

Now since the width is fixed,the entire text of combobox item is not visible in the drop down of combobox, is there any possible way to have horizontal scrollbar,so that user can scroll horizontally and see the complete name of the item?





0
Valeri Hristov
Telerik team
answered on 12 Oct 2011, 11:22 AM
Hi Akshatha,

To this you need to create a completely new template for RadComboBox, where the HorizontalScrollBarVisibility of the inner ScrollViewer should be set to Auto (it is Disabled by default). A general article about editing control templates can be found here:
http://www.telerik.com/help/silverlight/common-styling-appearance-edit-control-templates-blend.html

Kind regards,
Valeri Hristov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Akshatha
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Akshatha
Top achievements
Rank 1
Valeri Hristov
Telerik team
Share this question
or