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

Problem with custom column

1 Answer 139 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Cameron Molyneux
Top achievements
Rank 1
Cameron Molyneux asked on 01 Aug 2012, 09:14 PM
I have used a custom column in my grid which contains a radprogressbar (from an example on here! see below)

When I used this column the first time the grid displays the progress bar values do not display correctly (see picture 1), then after I sort one by clicking one of the column headings the progress bar displays the correct values (see picture 2)

Any idea why this would happen?  The XAML is also below

<local:GridViewPercentageColumn DataMemberBinding="{Binding Turnaround, Mode=TwoWay}" DataFormatString="{}{0}%" Header="{Binding Path=CellPathResource.Turnaround, Source={StaticResource ResourcesWrapper}}" />

#region PercentageColumn
 
   public class GridViewPercentageColumn : GridViewDataColumn
   {
       public override FrameworkElement CreateCellElement(GridViewCell cell, object dataItem)
       {
           var bar = cell.Content as RadProgressBar;
 
           if (bar == null)
           {
               bar = new RadProgressBar();
               bar.Height = 20;
               bar.Foreground = new SolidColorBrush(Colors.Green);
               bar.SetBinding(RadProgressBar.ValueProperty, this.DataMemberBinding);
               cell.Content = bar;
           }
 
           return bar;
       }
 
       public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem)
       {
           var slider = new RadSlider();
           slider.Maximum = 0;
           slider.Maximum = 100;
           slider.SmallChange = 1;
           slider.LargeChange = 10;
           slider.SetBinding(RadSlider.ValueProperty, this.DataMemberBinding);
           return slider;
       }
   }
 
   #endregion




1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 02 Aug 2012, 06:59 AM
Hi Cameron,

I tried to reproduce the issue you reported, but still without any success. Could you take a look at the sample attached and let me know whether you can get the same behavior on it ? Am I missing something ?

Kind regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Cameron Molyneux
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or