How to fill RadGridView's cell with RadCombobox

5 posts, 0 answers
  1. Maciej
    Maciej avatar
    7 posts
    Member since:
    Oct 2014

    Posted 28 Nov 2014 Link to this post

    Hi Telerik's support.

    I'm trying to build my cell template in RadGridView with RadComboBox. I would like to fill cell with combobox, but regardless setting gridview's cell padding to 0 and combobox's VerticalAligment to Stretch it still have got 24px height with margins on the top and the bottom. What should I do to obtain this effect.

    Here is the code and screenschots:
        <base:ModalWindowBase.Resources>
            <Style x:Name="BookkeepingAccountsCellStyle" TargetType="telerik:GridViewCell">
                <Setter Property="Padding" Value="0"/>
            </Style>
        </base:ModalWindowBase.Resources>
     
    <controls:RadGridView x:Name="BookkeepingSchemaModificationObjectsGridView"
                   ItemsSource="{Binding Path=FilteredBookkeepingSchemaModificationObjects}"
                   IsFilteringAllowed="true"
                   IsReadOnly="False"
                   EditTriggers="CellClick">
     
                            <controls:RadGridView.Columns>
                                <telerik:GridViewDataColumn   DataMemberBinding="{Binding BookkeepingSchemaSalaryComponentDefinitionSummary.ComponentNumber}" Width="Auto" IsReadOnly="True"/>
                                <telerik:GridViewDataColumn   DataMemberBinding="{Binding BookkeepingSchemaSalaryComponentDefinitionSummary.ComponentName}" Width="*" MinWidth="150" TextWrapping="Wrap" IsReadOnly="True"/>
     
                                <!--Here is the column with my combobox -->
                                <telerik:GridViewDataColumn Header="{Binding Source={StaticResource TermsProvider}, Path=Captions.DebitBookkeepingAccount}" 
                                                            Width="Auto"
                                                            MinWidth="200"
                                                            TextAlignment="Center"
                                                            IsReadOnly="False"
                                                            CellStyle="{StaticResource BookkeepingAccountsCellStyle}"
                                                            DataMemberBinding="{Binding DebitBookkeepingAccountId, Mode=TwoWay, NotifyOnValidationError=True}">
     
                                    <telerik:GridViewDataColumn.CellTemplate>
                                        <DataTemplate DataType="models:BookkeepingSchemaModificationObject">
                                             
                                            <Grid>
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="Auto"/>
                                                    <ColumnDefinition Width="15"/>
                                                    <ColumnDefinition Width="Auto"/>
                                                </Grid.ColumnDefinitions>
                                                <TextBlock Grid.Column="0" Text="{Binding Path=DebitBookkeepingAccountNumber}" Margin="4,4,0,4"/>
                                                <TextBlock Grid.Column="1" Text="-" HorizontalAlignment="Center" Margin="0,4"/>
                                                <TextBlock Grid.Column="2" Text="{Binding Path=DebitBookkeepingAccountName}" TextWrapping="Wrap" Margin="0,4,4,4"/>
                                            </Grid>
                                        </DataTemplate>
                                    </telerik:GridViewDataColumn.CellTemplate>
     
                                    <telerik:GridViewDataColumn.CellEditTemplate>
                                        <DataTemplate DataType="models:BookkeepingSchemaModificationObject">
                                            <telerik:RadComboBox EmptyText="{Binding Source={StaticResource TermsProvider},Path=Messages.None}"
                                                                 ItemsSource="{Binding Path=BookkeepingAccounts}"
                                                                 SelectedValuePath="Guid"
                                                                 VerticalAlignment="Stretch"
                                                                 Margin="0"
                                                                 SelectedValue="{Binding Path=DebitBookkeepingAccountId, Mode=TwoWay, NotifyOnValidationError=True}">
     
                                                <telerik:RadComboBox.ItemTemplate>
                                                    <DataTemplate>
                                                            <Grid>
                                                            <Grid.ColumnDefinitions>
                                                                <ColumnDefinition Width="Auto"/>
                                                                <ColumnDefinition Width="15"/>
                                                                <ColumnDefinition Width="Auto"/>
                                                            </Grid.ColumnDefinitions>
                                                            <TextBlock Grid.Column="0" Text="{Binding Path=AccountNumber}" Margin="0,4"/>
                                                            <TextBlock Grid.Column="1" Text="-" HorizontalAlignment="Center" Margin="0,4"/>
                                                            <TextBlock Grid.Column="2" Text="{Binding Path=AccountName}" TextWrapping="Wrap" MaxWidth="360" Margin="0,4"/>
                                                        </Grid>
                                                    </DataTemplate>
                                                </telerik:RadComboBox.ItemTemplate>
                                            </telerik:RadComboBox>
                                        </DataTemplate>
                                    </telerik:GridViewDataColumn.CellEditTemplate>
                                 </telerik:GridViewDataColumn>
                              
                            </controls:RadGridView.Columns>
     
                        </controls:RadGridView>
  2. Maciej
    Maciej avatar
    7 posts
    Member since:
    Oct 2014

    Posted 02 Dec 2014 in reply to Maciej Link to this post

    Do you have any information on this issue?
  3. DevCraft banner
  4. Maciej
    Maciej avatar
    7 posts
    Member since:
    Oct 2014

    Posted 02 Dec 2014 Link to this post

    Do you have any information on this issue?
  5. Boris
    Admin
    Boris avatar
    276 posts

    Posted 02 Dec 2014 Link to this post

    Hello Maciej,

    In general when you put a RadComboBox as a CellEditTemplate of a column it will size with the row height. However, if you set the Height property of the RadComboBox you will observe the behavior from your image. So in order to resolve this, you will need to look in your project for a style or a property targeting the RadComboBox, which can modify or affect the height of the control.

    I hope this helps.

    Regards,
    Boris
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  6. Maciej
    Maciej avatar
    7 posts
    Member since:
    Oct 2014

    Posted 10 Dec 2014 in reply to Boris Link to this post

    You're right but it's not exactly CellEditTemplate fault but GridViewEditorPresenter (Padding property). Thank you very much for prompt.

    Regards,
    Maciej 
Back to Top
DevCraft banner