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

Select whole column

4 Answers 161 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Andi
Top achievements
Rank 2
Andi asked on 28 Oct 2010, 01:45 PM
Hi there,

is there any way to select a whole column by clicking the column-header?
I can not find any option to do that.

Greetings

4 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 28 Oct 2010, 02:53 PM
Hi Andi,

 Currently there is not such built-in feature however you can implement it very quickly if you declare for example a CheckBox in the column Header property and treat this column as "selected" if the CheckBox is checked. You can also assign different background for the "selected" columns - more info on this demo

Best wishes,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Andi
Top achievements
Rank 2
answered on 27 Jan 2011, 11:36 AM
Still one question.

How will I place a Checkbox into my Header? My Columns where defined by Runtime from Code:

private void AddGridViewDataColumn(string uniqueName, bool insert = false)
{
  Binding bind = null;
  if (uniqueName != " ")
  {
    bind = new Binding(uniqueName);
  }
  else
  {
    bind = new Binding("col1");
  }
  bind.Mode = BindingMode.TwoWay;
  bind.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
  GridViewDataColumn column = new GridViewDataColumn();
  if (uniqueName != " ")
  {
    column.UniqueName = uniqueName;
  }
  else
  {
    column.UniqueName = "col1";
  }
  column.Header = uniqueName;     // LocalizationManager.GetString(uniqueName);
  column.DataMemberBinding = bind;
  column.CellEditTemplate = (DataTemplate)FindResource("SyncToBoxTemplate");     
 
  if (insert)
  {
    int index = rgvEntscheidungstabelle.Columns.Count - 1;
    this.rgvEntscheidungstabelle.Columns.Insert(index, column);
  }
  else
  {
    rgvEntscheidungstabelle.Columns.Add(column);
  }
}
0
Milan
Telerik team
answered on 27 Jan 2011, 12:54 PM
Hi Andi,

This help topic demonstrates how you can customize column headers. 

Hope it helps.

Kind regards,
Milan
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Andi
Top achievements
Rank 2
answered on 27 Jan 2011, 01:42 PM
Thank you Milan.

For all who want's to add a Column with Checkbox in the Header by Runtime, this is the Code you can use (and make better):

StackPanel p = new StackPanel();
p.Orientation = Orientation.Horizontal;
CheckBox cb = new CheckBox();
cb.VerticalAlignment = System.Windows.VerticalAlignment.Center;
Label l = new Label();
l.Content = uniqueName;
p.Children.Add(cb);
p.Children.Add(l);
column.Header = p;
Tags
GridView
Asked by
Andi
Top achievements
Rank 2
Answers by
Vlad
Telerik team
Andi
Top achievements
Rank 2
Milan
Telerik team
Share this question
or