How to fill RadGridView cell with RadCombobox

914 views Asked by At

I've got RadGridView with few columns. In one column I've got CellTemplate and CellEditTemplate. I would like to fill cell with my combobox, but regardless setting cell padding to 0 and VerticalAligment to Stretch it still have got one line height with margins on top and bottom. Anyone have any sugestion?

   <Style x:Name="BookCellStyle" TargetType="telerik:GridViewCell">
        <Setter Property="Padding" Value="0"/>
   </Style>  

                  <telerik:GridViewDataColumn  Width="*" 
                                                    MinWidth="200" 
                                                    TextAlignment="Center" 
                                                    IsReadOnly="False"
                                                    CellStyle="{StaticResource BookCellStyle}"
                                                    DataMemberBinding="{Binding BookId, Mode=TwoWay, NotifyOnValidationError=True}">

                            <telerik:GridViewDataColumn.CellTemplate>
                                <DataTemplate DataType="models:BookObject">

                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="15"/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>
                                        <TextBlock Grid.Column="0" Text="{Binding Path=BookNumber}" Margin="4,4,0,4"/>
                                        <TextBlock Grid.Column="1" Text="-" HorizontalAlignment="Center" Margin="0,4"/>
                                        <TextBlock Grid.Column="2" Text="{Binding Path=BookName}" TextWrapping="Wrap" MaxWidth="360" Margin="0,4,4,4"/>
                                    </Grid>
                                </DataTemplate>
                            </telerik:GridViewDataColumn.CellTemplate>

                            <telerik:GridViewDataColumn.CellEditTemplate>
                                <DataTemplate DataType="models:BookObject">
                                    <telerik:RadComboBox
                                                         ItemsSource="{Binding Path=Books}" 
                                                         SelectedValuePath="Guid"
                                                         SelectedValue="{Binding Path=BookId, 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=BookNumber}" Margin="0,4"/>
                                                    <TextBlock Grid.Column="1" Text="-" HorizontalAlignment="Center" Margin="0,4"/>
                                                    <TextBlock Grid.Column="2" Text="{Binding Path=BookName}" TextWrapping="Wrap" MaxWidth="360" Margin="0,4"/>
                                                </Grid>
                                            </DataTemplate>
                                        </telerik:RadComboBox.ItemTemplate>
                                    </telerik:RadComboBox>
                                </DataTemplate>
                            </telerik:GridViewDataColumn.CellEditTemplate>
                         </telerik:GridViewDataColumn>
0

There are 0 answers