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

secondary header alignment for invisible columns

2 Answers 39 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kevin Tran
Top achievements
Rank 1
Kevin Tran asked on 03 Sep 2010, 12:40 PM
Hi support,
I read this blog which is awesome, I implemented the same in my proj,Only problem is that upon user selection i make some of the columns invisible ,because of that Secondary header alignments gone missing.In btw I am able to change the content of secondary header,here are the changes i made. 

in mainpage.xaml.cs
var rows = gvData.ChildrenOfType<CommonHeader>();
              foreach (var row in rows)
              {
                  if (row.Name == "Second1")
                      row.ColumnSpan = 5;
                  if (row.Name == "Third1")
                  {
                      row.StartColumnIndex = 7;
                      row.ColumnSpan = 6;
 
                  }
                  if (row.Name == "Fourth1")
                  {
                      row.StartColumnIndex = 13;
                      row.ColumnSpan = 6;
 
 
                  }
              }
in commonheader.xaml.cs
public static readonly DependencyProperty ColumnIndex =
        DependencyProperty.Register("StartColumnIndex", typeof(int), typeof(CommonHeader), new PropertyMetadata(0));
 
        public static readonly DependencyProperty ColSpan =
     DependencyProperty.Register("ColumnSpan", typeof(int), typeof(CommonHeader), new PropertyMetadata(0));
 
          
        public string Caption
        {
            get
            {
                return (string)this.GetValue(CaptionProperty);
            }
            set
            {
                this.SetValue(CaptionProperty, value);
            }
        }
        public int StartColumnIndex
        {
            get
            {
                return (int)this.GetValue(ColumnIndex);
            }
 
            set
            {
                this.SetValue(ColumnIndex, value);
            }
 
        }
        public int ColumnSpan
        {
            get
            {
                return (int)this.GetValue(ColSpan);
            }
 
            set
            {
                this.SetValue(ColSpan, value);
            }
        }

in ColumnGroupbehaviour.cs
protected override void OnDetaching()
       {
           base.OnDetaching();
           this.AssociatedObject.DataLoaded +=new EventHandler<EventArgs>(AssociatedObject_DataLoaded);
       }
       void AssociatedObject_DataLoaded(object sender, EventArgs e)
       {
     
           PlaceSecondaryHeader();
       }

Suggest some solution 
Thanks
 

2 Answers, 1 is accepted

Sort by
0
Kevin Tran
Top achievements
Rank 1
answered on 07 Sep 2010, 06:59 AM
Hi,
Any help 
0
Pavel Pavlov
Telerik team
answered on 07 Sep 2010, 02:10 PM
Hi Kevin Tran,

Without having your code I may just guess what went wrong . So can you please send me your project in a support ticket (or a simplified version of it ). This way I will be able to step through the code and make the required fixes for you .

Regards,
Pavel Pavlov
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
Tags
GridView
Asked by
Kevin Tran
Top achievements
Rank 1
Answers by
Kevin Tran
Top achievements
Rank 1
Pavel Pavlov
Telerik team
Share this question
or