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

Deserialized GroupDescriptor pixelWidth Error

1 Answer 15 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Guru
Top achievements
Rank 2
Guru asked on 24 Aug 2012, 11:05 PM

Using the example class for serializing gridview (RadGridViewSettings) I am running into a problem, everything is great but when we attemt to LoadLayout for a gridview with groupdescriptors we get pixelWidth err every time. What could be the problem?

I know your going to say use the persist fw classes but we have special needs including that our grid filters are in a raddatafilter and there can be many settings files per gridview per each datafilter configuration and it is only partial saved in this way and some in our database too so our existing class works perfect and took a long time to develop... except if there is a groupdescriptor... we get this error.


Error:

Message: The parameter value must be greater than zero.
Parameter name: pixelWidth
 
Source: PresentationCore
 
Trace:    at System.Windows.Media.Imaging.RenderTargetBitmap..ctor(Int32 pixelWidth, Int32 pixelHeight, Double dpiX, Double dpiY, PixelFormat pixelFormat)
   at Telerik.Windows.Controls.FrameworkElementToImageConverter.ToImage(FrameworkElement element) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\Common\FrameworkElementToImageConverter.cs:line 26
   at Telerik.Windows.Controls.GridView.GridViewGroupPanel.ConvertFrameworkElementToImage(FrameworkElement frameworkElement) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Grouping\GridViewGroupPanel.cs:line 185
   at Telerik.Windows.Controls.GridView.GridViewGroupPanel.GetEffectiveContentForDescriptor(IGroupDescriptor descriptor) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Grouping\GridViewGroupPanel.cs:line 177
   at Telerik.Windows.Controls.GridView.GridViewGroupPanel.PrepareContainerForItemOverride(DependencyObject element, Object item) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Grouping\GridViewGroupPanel.cs:line 144
   at System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.PrepareItemContainer(DependencyObject container, Object item)
   at System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainer(DependencyObject container)
   at System.Windows.Controls.Panel.AddChildren(GeneratorPosition pos, Int32 itemCount)
   at System.Windows.Controls.Panel.OnItemsChangedInternal(Object sender, ItemsChangedEventArgs args)
   at System.Windows.Controls.Panel.OnItemsChanged(Object sender, ItemsChangedEventArgs args)
   at System.Windows.Controls.ItemContainerGenerator.OnItemAdded(Object item, Int32 index)
   at System.Windows.Controls.ItemContainerGenerator.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
   at System.Windows.Controls.ItemContainerGenerator.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)
   at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)
   at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
   at System.Collections.Specialized.CollectionChangedEventManager.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
   at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
   at System.Windows.Controls.ItemCollection.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)
   at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)
   at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
   at System.Collections.Specialized.CollectionChangedEventManager.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
   at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
   at System.Windows.Data.ListCollectionView.ProcessCollectionChangedWithAdjustedIndex(NotifyCollectionChangedEventArgs args, Int32 adjustedOldIndex, Int32 adjustedNewIndex)
   at System.Windows.Data.ListCollectionView.ProcessCollectionChanged(NotifyCollectionChangedEventArgs args)
   at System.Windows.Data.CollectionView.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
   at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Telerik.Windows.Data.RadObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\RadObservableCollection.cs:line 235
   at Telerik.Windows.Data.ObservableItemCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\ObservableItemCollection.cs:line 91
   at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
   at Telerik.Windows.Data.RadObservableCollection`1.InsertItem(Int32 index, T item) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\RadObservableCollection.cs:line 281
   at System.Collections.ObjectModel.Collection`1.Add(T item)
   at NciDataTools.RadGridViewSettings.LoadState() in C:\..........\classes\ClassRadGridSettings.cs:line 275
   at NciDataTools.WindowMain.gridScheduleUserSettingsLoad() in C:\..........\WindowMain.xaml.cs:line 1369
   at NciDataTools.WindowMain.gridScheduleRefreshDataChanges() in C:\..........\WindowMain.xaml.cs:line 1345
   at NciDataTools.WindowMain.gridScheduleDataWorker_RunWorkerCompleted(Object sender, RunWorkerCompletedEventArgs e) in C:\..........\WindowMain.xaml.cs:line 1640
   at System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(RunWorkerCompletedEventArgs e)
   at System.ComponentModel.BackgroundWorker.AsyncOperationCompleted(Object arg)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)


Happens at this point (GroupDescriptors.Add(d)) when loading from the xml file.



if
(Settings.GroupSettings.Count > 0)
{
grid.GroupDescriptors.Clear();
foreach (GroupSetting setting in Settings.GroupSettings)
{
ColumnGroupDescriptor d = new ColumnGroupDescriptor();
d.Column = (from c in grid.Columns.OfType<GridViewBoundColumnBase>()
where c.GetDataMemberName() == setting.PropertyName
select c).FirstOrDefault();
d.SortDirection = setting.SortDirection;
grid.GroupDescriptors.Add(d);
}
}

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 27 Aug 2012, 05:40 AM
Hi,

 This class (RadGridViewSettings) was replaced more than 2 years ago with RadPersistenceFramework and I strongly suggest you to check your local copy of our latest WPF demos for more info, code, etc.

Greetings,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Guru
Top achievements
Rank 2
Answers by
Vlad
Telerik team
Share this question
or