Version: Q2 2008 SP1- Released:9/10/2008 - WPF/VS2008-SP1
We're able to edit an existing record, but couldn't successfully include a record into the GridView. Our data is stored in a List<T> which is used to commit each record to the backend.
Pressing the INSERT key on the GridView will call the 'AddingNewDataItem' method. When the cursor leaves the edited row, the 'EditEnded' method is called. When this method executes to the end, an error occurs:
ERROR: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
STACK TRACE: at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) at System.ThrowHelper.ThrowArgumentOutOfRangeException() at System.Collections.Generic.List`1.get_Item(Int32 index) at Telerik.Windows.Data.Grouping.DataRecordStore`1.GetDataRecord(Int32 index) at Telerik.Windows.Data.Grouping.ListOfRecordsExtensions.InsertIndex[TElement](IList`1 recordList, Int32 insertionIndex, Int32 dataSourceIndex, DataRecordStore`1 recordStore) at Telerik.Windows.Data.RecordTreeBuilder`1.InsertRecordInGroup(IList`1 dataRecordList, TElement dataItem, Int32 index) at Telerik.Windows.Data.RecordTreeBuilder`1.AddExistingDataRecord(IList`1 targetCollection, TElement dataItem, Int32 index) at Telerik.Windows.Data.RecordTreeBuilder`1.AddNewDataRecord(IList`1 targetCollection, TElement dataItem, Int32 index) at Telerik.Windows.Data.RecordTreeBuilder`1.AddNewRecord(IList`1 targetCollection, Object recordItem, Int32 index) at Telerik.Windows.Data.RecordManager.AddNewRecord(Object recordItem, Int32 index, String fieldName) at Telerik.Windows.Controls.GridView.GridViewRow.UpdateDataRecords(DataRecord changedRecord, String changedFieldName, RecordsChangeListener changeListener) at Telerik.Windows.Controls.GridView.GridViewRow.HandleValueChangedWithoutNotifications(DataRecord changedRecord, String changedFieldName, RecordsChangeListener changeListener) at Telerik.Windows.Controls.GridView.GridViewRow.HandleValueChangedAfterEdit(FieldRoutedEventArgs editEventArgs, RecordsChangeListener changeListener) at Telerik.Windows.Controls.GridView.GridViewRow.Cell_EditCommitted(Object sender, FieldRoutedEventArgs e) at Telerik.Windows.Controls.GridView.GridViewRow.CommitEdit() at Telerik.Windows.Controls.GridView.GridViewCell.CommitEditedRow() at Telerik.Windows.Controls.GridView.GridViewCell.TryCommitPreviousEdit() at Telerik.Windows.Controls.GridView.GridViewCell.HandleLostFocus() at Telerik.Windows.Controls.GridView.GridViewCell.OnGotFocus(RoutedEventArgs e) at System.Windows.UIElement.IsFocused_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args) at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType) at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, OperationType operationType, Boolean isInternal) at System.Windows.DependencyObject.SetValue(DependencyPropertyKey key, Object value) at System.Windows.Input.FocusManager.OnFocusedElementChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args) at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType) at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, OperationType operationType, Boolean isInternal) at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value) at System.Windows.Input.FocusManager.SetFocusedElement(DependencyObject element, IInputElement value) at System.Windows.Input.KeyboardNavigation.UpdateFocusedElement(DependencyObject focusTarget) at System.Windows.FrameworkElement.OnGotKeyboardFocus(Object sender, KeyboardFocusChangedEventArgs e) at System.Windows.Input.KeyboardFocusChangedEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input) at System.Windows.Input.KeyboardDevice.ChangeFocus(DependencyObject focus, Int32 timestamp) at System.Windows.Input.KeyboardDevice.TryChangeFocus(DependencyObject newFocus, IKeyboardInputProvider keyboardInputProvider, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed) at System.Windows.Input.KeyboardDevice.Focus(DependencyObject focus, Boolean askOld, Boolean askNew) at System.Windows.Input.KeyboardDevice.Focus(IInputElement element) at System.Windows.Input.Keyboard.Focus(IInputElement element) at Telerik.Windows.Controls.GridView.GridViewCell.OnMouseLeftButtonDown(MouseButtonEventArgs e) at System.Windows.UIElement.OnMouseLeftButtonDownThunk(Object sender, MouseButtonEventArgs e) at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent) at System.Windows.UIElement.CrackMouseButtonEventAndReRaiseEvent(DependencyObject sender, MouseButtonEventArgs e) at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e) at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input) at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter) at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.Run() at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run(Window window) at System.Windows.Application.Run()
Record editing is working, but crashes when committing a new record. Secondly, is it possible to call the 'AddingNewDataItem' method rather than wait for the user to press the INSERT key?
-Trav.
this
.RadChart1.Background = new SolidColorBrush(Colors.Blue);
this
.RadChart1.DefaultView.ChartArea.Background = new SolidColorBrush(Colors.Black);
The only way I have done it so far is to override the whole control template, and set the Background on the WrapPanel....which is very much over-kill. I must be missing something obvious. If you want to change the background color of a control, you usually just set the Background property...
Michael
Code for populating the chart:
DataSeries splineAreaSeriesCPU1 = null; |
DataSeries splineAreaSeriesCPU2 = null; |
public void fillProcessorChart() |
{ |
splineAreaSeriesCPU1 = new DataSeries(); |
splineAreaSeriesCPU2 = new DataSeries(); |
splineAreaSeriesCPU1.Definition = new SplineAreaSeriesDefinition(); |
splineAreaSeriesCPU2.Definition = new SplineAreaSeriesDefinition(); |
ChartArea1.DataSeries.Add(splineAreaSeriesCPU1); |
ChartArea2.DataSeries.Add(splineAreaSeriesCPU2); |
} |
public static void FillWithSampleData(DataSeries series, double PcValue) |
{ |
series.Add(new DataPoint { XValue = series.Count() , YValue = PcValue }); |
if (series.Count()>10) |
series.RemoveAt(0); |
} |
<telerik:RadChart x:Name="RadChart1" Margin="8,8,8,8" Grid.Row="3" Grid.Column="2" UseDefaultLayout="False" VirtualizingStackPanel.VirtualizationMode="Recycling"> |
<Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> |
<Grid.RowDefinitions> |
<RowDefinition Height="0.5*" /> |
<RowDefinition Height="0.5*" /> |
</Grid.RowDefinitions> |
<Grid.ColumnDefinitions> |
<ColumnDefinition Width="*" /> |
</Grid.ColumnDefinitions> |
<telerik:ChartArea Grid.Row="0" x:Name="ChartArea1" > |
<telerik:ChartArea.AxisY> |
<telerik:AxisY MajorGridLinesVisibility="Collapsed" |
MinorTicksVisibility="Visible" |
Title="CPU 1" /> |
</telerik:ChartArea.AxisY> |
</telerik:ChartArea> |
<telerik:ChartArea Grid.Row="1" x:Name="ChartArea2" > |
<telerik:ChartArea.AxisY> |
<telerik:AxisY MajorGridLinesVisibility="Collapsed" |
MinorTicksVisibility="Visible" |
Title="CPU 2" /> |
</telerik:ChartArea.AxisY> |
</telerik:ChartArea> |
</Grid> |
</telerik:RadChart> |