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

Preventing resizing and re-ordering of specific columns

6 Answers 394 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Gary
Top achievements
Rank 1
Gary asked on 09 Jun 2009, 11:53 PM
The grid supports turning off resing and re-ordering globally, but I would like to disable those abilities on specific columns in a grid (while still allowing other columns to be resized etc).  Is this acheivable?


6 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 10 Jun 2009, 01:40 PM
Hi Gary,

We have recently introduces a property called IsResizable which allows you enable or disable resizing for a specific column. It is available with our latest build which you can find in our download section.

Currently there is no property to disallow reordering of a specific column but we might be able do do something about it since it sounds very easy to implement. I have several questions though - if there is a property called IsReorderable on GridViewColumn and the property is set to false does that mean that another column cannot be placed before it and that the column in question should always stay at the same position? ... Or it just means that the user cannot drag and drop the specified column?

Greetings,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Gary
Top achievements
Rank 1
answered on 10 Jun 2009, 03:05 PM
Looking at the WPFToolkit grid, setting "CanUserReorder" to false means the user cannot drag and drop the column.  But after doing some testing, you're right in that a user can still just drop other columns in front to change it's posistion.

The reason I ask for this is that I need to memic the row indicator column in the rad grid, but allow it show images if a user edits a cell.  I don't see any way to provide a custom template for the row indicator column.  So what I'm going to do is hide the row indicator, and the first column will be fixed.  I'm thinking that just setting the frozen column count to 1 will do the trick, rather then needing the ability to disallow them to reorder (I assume if the column is frozen it can't be re-ordered).

Is there any way of providing a row header template in the rad grid (wpftoolkit grid supports this)?
0
Milan
Telerik team
answered on 11 Jun 2009, 07:59 AM
Hello Gary,

Well, if the RadGridView is in a panel that provides an infinite width to the grid, there is no way to determine the right column sizes that will fill the grid. Still, there might be a workaround that you can use.

<Grid x:Name="LayoutRoot" Background="White">  
    <Grid.RowDefinitions> 
        <RowDefinition Height="Auto"/>  
    </Grid.RowDefinitions> 
    <Grid.ColumnDefinitions> 
        <ColumnDefinition Width="Auto"/>  
    </Grid.ColumnDefinitions> 
    <StackPanel Grid.Row="0" Grid.Column="0" SizeChanged="StackPanel_SizeChanged" > 
        <telerikGrid:RadGridView x:Name="RadGridView1" ColumnsWidthMode="Fill">  
        </telerikGrid:RadGridView> 
    </StackPanel> 
</Grid> 

In this situation the fill mode will not work correctly. If you subscribe to the SizeChanged event of the parent StackPanel you will be able to determine the concrete size of the parent. You can use this size to limit the size of the grid:

private void StackPanel_SizeChanged(object sender, SizeChangedEventArgs e)  
{  
    FrameworkElement element = (FrameworkElement)VisualTreeHelper.GetChild((DependencyObject)sender, 0);  
 
    element.Width = e.NewSize.Width;  
    element.Height = e.NewSize.Height;  

Hope this works for your scenario.

Kind regards,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Milan
Telerik team
answered on 11 Jun 2009, 08:05 AM
Hi Gary,

Please ignore my previous post.

Best wishes,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Accepted
Milan
Telerik team
answered on 12 Jun 2009, 03:12 PM
Hello Gary,

You could use the frozen functionality to make the first column static but beware that if you have a horizontal scrollbar the first column will not move when you scroll.

We have just created a new property for our GridViewColumn class called IsReorderable that allows you to disable reordering for a specific column. This functionality will be available in our latest internal builds.

The IndicatorPresenter and/or GridViewIndicatorCell is our equivalent to the RowHeaderStyle that is available in the WPFToolkit. Unfortunately customizing either the IndicatorPresenter or the GridViewIndicatorCell is not as straightforward as it should be.

Your valuable feedback will help us improve the RadGridView control. Your telerik points have been updated.
Do not hesitate to write if you have any more questions.

Regards,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Gary
Top achievements
Rank 1
answered on 12 Jun 2009, 03:48 PM
Thanks for your help!
Tags
GridView
Asked by
Gary
Top achievements
Rank 1
Answers by
Milan
Telerik team
Gary
Top achievements
Rank 1
Share this question
or