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

GridViewComboBoxColumn Unselected Style

3 Answers 65 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 27 Jul 2012, 03:39 PM
The default GridViewComboBoxColumn in the RadGridView shows the cells like a TextBlock and it isn't until you set focus to the cell does it actually look like a RadComboBox.  Once the cell loses focus it goes back to looking like a TextBlock. We have a business need for the GridViewComboBoxColumn cells to always look like a RadComboBox for all the visible rows.  Is there an easy way to do this via styling?  We would like to avoid code behind.

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 30 Jul 2012, 07:21 AM
Hello,

 I would suggest you to check this forum thread where a similar topic is discussed.

Kind regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Michael
Top achievements
Rank 1
answered on 31 Jul 2012, 12:11 PM
We did do that already but we were concerned about performance when you had many rows of data (which we have).  I assume Telerik chose to not paint each combobox for this reason?  Is there a lighter weight way to style the cell so it just looks like a combobox until you click in it or perhaps an easy way to paint the cell when a single row is highlighted?
0
Accepted
Dimitrina
Telerik team
answered on 02 Aug 2012, 03:41 PM
Hi,

 This would not be a trivial task.

If you have already exposed a property of the bound item holding the DisplayValue for the item selected in the combo, then you could define a CellTemplate painting the combobox style yourself. For example:

<Border BorderBrush="#FF848484" CornerRadius="2" BorderThickness="1" HorizontalAlignment="Left" Height="25" Margin="160,136,0,0" VerticalAlignment="Top" Width="104">
<Border BorderThickness="1" BorderBrush="White">
<Border.Background>                           <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="White" Offset="0"/>
                                                                        <GradientStop Color="Gainsboro" Offset="0.5"/><GradientStop Color="#FFADADAD" Offset="0.5"/><GradientStop Color="#FFD4D4D4" Offset="1"/>                  </LinearGradientBrush>               </Border.Background>
<Grid>
<Grid.ColumnDefinitions>                  <ColumnDefinition/>                <ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="DisplayMember" Margin="4,0" Text="{Binding DisplayedValue}"  VerticalAlignment="Center"/>
                                                <Path Grid.Column="1" VerticalAlignment="Center"  Data="M0,0L1,0 2,0 3,0 4,0 5,0 5,1 4,1 4,2 3,2 3,3 2,3 2,2 1,2 1,1 0,1 0,0z" Fill="Black" HorizontalAlignment="Center" Height="3" Margin="3"  RenderTransformOrigin="0.5,0.5" Stretch="Fill"  Width="5">                      <Path.RenderTransform>                         <TransformGroup>                                          <ScaleTransform ScaleY="-1" ScaleX="1"/>                    <SkewTransform AngleY="0" AngleX="0"/>       <RotateTransform Angle="180"/>            <TranslateTransform X="0" Y="0"/>          </TransformGroup>                     </Path.RenderTransform>
</Path>
</Grid>
</Border>
</Border>

Otherwise, you could use the approach already suggested. It will not degrade the performance compared to the performance of the GridViewComboBoxColumn itself. 

Greetings,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Michael
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Michael
Top achievements
Rank 1
Share this question
or