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);
}
}