Telerik Forums
UI for WPF Forum
6 answers
597 views
After adding or removing rows from a DataTable, clicking on a row throws a RowNotInTableException.

I can perform other actions such as selecting the row using the row selector checkbox, but if I click on the row anywhere outside the checkbox, I get the error (looks like its on the cell mouse down event).

The error sometimes doesn't get thrown but usually does (threading issue?).

System.Data.RowNotInTableException was unhandled by user code
  Message=This row has been removed from a table and does not have any data.  BeginEdit() will allow creation of new data in this row.
  Source=System.Data
  StackTrace:
       at System.Data.DataRow.GetDefaultRecord()
       at System.Data.DataRow.get_Item(String columnName)
       at System.Data.DataRowExtensions.Field[T](DataRow row, String columnName)
       at lambda_method(Closure , DataRow )
       at Telerik.Windows.Data.FuncExtensions.<>c__DisplayClass1`2.<ToUntypedFunc>b__0(Object item) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Extensions\FuncExtensions.cs:line 24
       at Telerik.Windows.Data.QueryableCollectionViewGroup.FindLastLevelGroupByItem(Object item) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Data\Grouping\QueryableCollectionViewGroup.cs:line 536
       at Telerik.Windows.Controls.GridView.GridViewDataControl.GetRowForItem(Object item, Boolean forceGroupExpand) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:line 3226
       at Telerik.Windows.Controls.GridView.GridViewDataControl.get_CurrentCell() in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:line 764
       at Telerik.Windows.Controls.GridView.GridViewCell.OnMouseLeftButtonDown(MouseButtonEventArgs e) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Cells\GridViewCell.cs:line 404
       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.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.RaiseTrustedEvent(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, WindowMessage 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, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
  InnerException:
Andrew
Top achievements
Rank 1
 answered on 03 Jan 2012
2 answers
72 views
I have a pretty simple use case: I have a grid populated from a database, with a column for each field.

I want the user to be able to add new records, and to edit existing records.

My problem is the fields that are part of the primary key.  I need these to be editable, when the user is adding a new record, but to not be editable, when the user is editing an existing record.

Seems like a pretty common problem, but I've not been able to figure out how to do it.

If it matters, I'm using MVVM and my records are in an ObservableCollection.  My ViewModel picks up on changes to the collection with a NotifyCollectionChangedEventHandler on the collection, and changes to individual records with a PropertyChangedEventHandler on each record.  I don't actually have any GUI events being handled in the codebehind.
Jeff
Top achievements
Rank 1
 answered on 03 Jan 2012
3 answers
152 views
Hi,

I'm using the new RadRadialGauge (Q3 2011 SP1) to build a user control to visualize a valve. This valve should show a perfectly horizontal line if the valve is completely closed with a value of 0 and a perfectly vertical line if the valve is completely open with a value of 100. If the valve has a value of 50, the line will be a perfect diagonal line pointing north-west to south-east.

I'm created the following user control that works:
<UserControl
    x:Class="ucValve"
    d:DesignHeight="48"
    d:DesignWidth="48"
    mc:Ignorable="d">
    <Grid>
        <telerik:RadRadialGauge>
            <telerik:RadRadialGauge.InnerBackground>
                <SolidColorBrush />
            </telerik:RadRadialGauge.InnerBackground>
            <telerik:RadRadialGauge.InnerBorderBrush>
                <SolidColorBrush />
            </telerik:RadRadialGauge.InnerBorderBrush>
            <telerik:RadRadialGauge.OuterBackground>
                <SolidColorBrush />
            </telerik:RadRadialGauge.OuterBackground>
            <telerik:RadRadialGauge.OuterBorderBrush>
                <SolidColorBrush />
            </telerik:RadRadialGauge.OuterBorderBrush>
            <telerik:RadialScale
                x:Name="Scale"
                MajorTickRelativeHeight="0"
                MajorTicks="0"
                Max="100"
                Min="0"
                Radius="1.25"
                StartAngle="180"
                SweepAngle="90">
                <telerik:RadialScale.Indicators>
                    <telerik:Needle
                        x:Name="Needle"
                        BorderBrush="Black">
                        <telerik:Needle.Style>
                            <Style TargetType="{x:Type telerik:Needle}" >
                                <Setter Property="telerik:ScaleObject.Location" Value="Inside" />
                                <Setter Property="telerik:ScaleObject.RelativeWidth" Value="0.05" />
                            </Style>                           
                        </telerik:Needle.Style>
                    </telerik:Needle>
                    <telerik:Pinpoint
                        Background="Black"
                        BorderThickness="1">
                        <telerik:Pinpoint.Style>
                            <Style
                                TargetType="{x:Type telerik:Pinpoint}">
                                <Setter Property="telerik:ScaleObject.Location" Value="Inside" />
                                <Setter Property="telerik:ScaleObject.RelativeHeight" Value="0.2" />
                                <Setter Property="telerik:ScaleObject.RelativeWidth" Value="0.2" />
                            </Style>
                        </telerik:Pinpoint.Style>
                    </telerik:Pinpoint>
                </telerik:RadialScale.Indicators>
                <telerik:RadialScale.LabelTemplate>
                    <DataTemplate />
                </telerik:RadialScale.LabelTemplate>
            </telerik:RadialScale>
        </telerik:RadRadialGauge>
    </Grid>
</UserControl>
with the following code behind:
Imports System.ComponentModel
 
Public Class ucValve
 
    Public Sub New()
        InitializeComponent()
        Value = valueDefaultValue
    End Sub
 
#Region "Properties"
    Private Const valueDefaultValue As Double = 0
 
    <Category("Common"), DefaultValue(valueDefaultValue)>
    Public Property Value As Double
        Get
            Return Needle.Value
        End Get
        Set(ByVal value As Double)
            Needle.Value = value
        End Set
    End Property
 
    Public ReadOnly Property Maximum As Double
        Get
            Return Scale.Max
        End Get
    End Property
 
    Public ReadOnly Property Minimum As Double
        Get
            Return Scale.Min
        End Get
    End Property
#End Region
End Class

This successfully renders the top left half of the valve. To render the bottom right half of the value, I change the XAML:
<telerik:Needle
    x:Name="Needle"
    BorderBrush="Black">
to:
<telerik:Needle
    x:Name="Needle"
    BorderBrush="Black"
    TailHeight="1">

While the user control successfully displays the bottom right half of the valve, when I embed this new user control into a window, I get the following error message:

An Unhandled Exception has occurred
'-INF' is not a valid value for property 'Height'.
   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   at Telerik.Windows.Controls.Gauge.Needle.Resize() in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\DataVisualization\Gauge\Indicators\Needle.cs:line 96
   at Telerik.Windows.Controls.Gauge.ScaleObject.OnValueChanged(DependencyObject source) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\DataVisualization\Gauge\ScaleObject.cs:line 399
   at Telerik.Windows.Controls.Gauge.InteractiveIndicator.RefreshIndicator() in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\DataVisualization\Gauge\Indicators\InteractiveIndicator.cs:line 237
   at Telerik.Windows.Controls.Gauge.InteractiveIndicator.OnValueChanged(Double oldValue, Double newValue) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\DataVisualization\Gauge\Indicators\InteractiveIndicator.cs:line 190
   at Telerik.Windows.Controls.Gauge.GraphicIndicator.InternalValuePropertyChangedHandler(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs eventArgs) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\DataVisualization\Gauge\Indicators\GraphicIndicator.cs:line 644
   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, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   at Telerik.Windows.Controls.Gauge.IndicatorHelper.RefreshInternalValue(GraphicIndicator indicator, Double value) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\DataVisualization\Gauge\Indicators\IndicatorHelper.cs:line 223
   at Telerik.Windows.Controls.Gauge.IndicatorHelper.CoerceValueProperty(DependencyObject source, Object value) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\DataVisualization\Gauge\Indicators\IndicatorHelper.cs:line 72
   at System.Windows.DependencyObject.ProcessCoerceValue(DependencyProperty dp, PropertyMetadata metadata, EntryIndex& entryIndex, Int32& targetIndex, EffectiveValueEntry& newEntry, EffectiveValueEntry& oldEntry, Object& oldValue, Object baseValue, Object controlValue, CoerceValueCallback coerceValueCallback, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, Boolean skipBaseValueChecks)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   at Telerik.Windows.Controls.Gauge.GraphicIndicator.set_Value(Double value) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\DataVisualization\Gauge\Indicators\GraphicIndicator.cs:line 385
   at AlentControls.ucValve.set_Value(Double value) in C:\Utveckling\Alent\AlentControls\ucValve.xaml.vb:line 19
   at AlentControls.ucValve..ctor() in C:\Utveckling\Alent\AlentControls\ucValve.xaml.vb:line 7

If I remove setting the TailHeight property to 1, it works. If I set the TailHeight property to any value, the above unhandled exception occurs.

Am I doing something wrong or is this an issue with the new RadRadialGauge (specifically, the Needle object).

Kind regards,
Dave.
Sia
Telerik team
 answered on 03 Jan 2012
1 answer
35 views
Hi, when using the grouping feature can I select the grouping row..
In other words can I have the Grouping Row have cells that I can interact with ?

Thanks
kristján.
Vlad
Telerik team
 answered on 03 Jan 2012
3 answers
101 views
I want to change all the grid cells' background. Using SpecialSlotStyleSelector is the only way. Is that true?
I have setted  StretchAppointments="True" in TimelineViewDefinition. There are still some blanks at the top and bottom (see the attach) for the appoinement item. How can I grid rid of them.
Thanks.
Merry Christmas!

Dani
Telerik team
 answered on 03 Jan 2012
1 answer
48 views
If I just want to have the right page, would that be possible?
Petar Mladenov
Telerik team
 answered on 03 Jan 2012
1 answer
97 views
Hi,

I've reviewing the new ChartView control (from a background of using the previous Chart control) and I'm wondering what is future plan for displaying chart legends? The existing Chart control had built-in support for legends, however I'm noticed that the ChartView examples manually build legends. Are there future plans for a related control to display a legend or provide some support for legends in the ChartView control (I personally like the idea of keeping legends out of the ChartView control to keep the control as light as possible) or should we as developers expect to build our own legends? I just want to understand Telerik's future plans so I know whether to invest time in building my own legend control or simply build something quick because Telerik will provide support for legends in some form in a future release.

Kind regards,
Dave.
Giuseppe
Telerik team
 answered on 03 Jan 2012
1 answer
1.3K+ views
My customer requires grid cells to be joined vertically. This information must be updated whenever the grid changes, e.g. sorting/filtering updates of the underlying data. I now have the problem, that my grid contains the correct information but it is not redrawn with the updated information. the cell joining information is not on the objects contained in the list, but in a dictionary in the background. I am calling the method to update my dictionary when the grid is sorted. The grid is redrawn sorted correctly, but my information in the background is not up to date, so the cell-joining does not work correctly. I've tried various ways to have the grid update (also within the sorted event) but no success.

I've tried:
grid.InvalidateVisual();
grid.Measure(new Size());
grid.Visibility = Hidden -> Visible;

I've also tried the same on the parent element (a normal grid).

The thing is, when i hide the area where the problem is, then resize to show it, it's how it should be. so the data is up to date, but i can't seem to force a redraw at the right time.

I somehow need to force a redraw after the data has been updated and the sorting is done. any help much appreciated.

--- update

I have managed to get an update working, not so nice though. i am using DispatcherTimer to redraw after 10milliseconds. there is a visual jump though. but it does show that the underlying data is correct. I've also just noticed that my grid joining does not work, when items are removed/added to the list. what event on the radgridview can i use to find changes to the list (or even better the changes to the items in the list). I noticed LayoutUpdated does the trick, but it's mighty slow/called way too often.
marc
Top achievements
Rank 1
 answered on 03 Jan 2012
8 answers
1.0K+ views
I have a RadGrid where the user is supposed to select more than one item (multiple). In the ViewModel I have a property called _SelectedItem with NotifyPropertyChanged. First time i click a row in the grid, I get into the _SelectedItem property setter, but if I also want to select another row, the setter of _SelectedItem property is not fired. Am I missing something? CodeBehind is not allowed in the project where this is to be used.

This is my Grid:
<telerik:RadGridView Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="4"
                      ItemsSource="{Binding ModelCollection}"
                      ActionOnLostFocus="None"
                      AutoGenerateColumns="False"
                      CanUserSortColumns="True"
                      IsFilteringAllowed="True"
                      SelectionMode="Multiple"
                      ShowGroupPanel="True"
                      RowIndicatorVisibility="Collapsed"
                      Height="470"
                      CanUserSelect="True"
                      SelectedItem="{Binding SelectedModel, Mode=TwoWay}"
                      IsSynchronizedWithCurrentItem="False"
                      IsReadOnly="True">
     <telerik:RadGridView.Columns>
         <telerik:GridViewDataColumn Header="Kode" Width="100" DataMemberBinding="{Binding Code}" />
         <telerik:GridViewDataColumn Header="Tekst" Width="360" DataMemberBinding="{Binding Text}" />
     </telerik:RadGridView.Columns>
 </telerik:RadGridView>
Vlad
Telerik team
 answered on 03 Jan 2012
1 answer
55 views
Hi!

I was testing out the following tip: http://www.telerik.com/help/wpf/radchart-howto-display-pointmarks-and-labels-for-specific-points-only.html

It was working perfectly with my small dataset for testing but then once I tested it with a larger dataset it didn'n work anymore. After a bit of testing it seems this feature only works if the dataset has less than 200 datapoints. As soon as you reach 201 the DataItem is no longer attached to the pointmark. Why is this and is there a way around it?
Evgenia
Telerik team
 answered on 03 Jan 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?