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

Press Ctrl+c buttons Throws an exception

0 Answers 68 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Avi
Top achievements
Rank 1
Avi asked on 28 Jun 2012, 10:20 AM
Hello,

I have this Xaml :

<UserControl.Resources>
    <!--  PaymentErrorsCell  -->
    <DataTemplate x:Key="PaymentErrorsCell">
        <ListBox ItemsSource="{Binding PaymentErrors, Mode=OneWay}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Foreground="{Binding Severity, Converter={StaticResource severityErrorToColorValueConverter}}" Text="{Binding Message}" />
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </DataTemplate>     
</UserControl.Resources>
 
<telerik:RadGridView x:Name="FailedPoliciesGrid"
    Grid.Row="1"
    bh:RadGridViewHeaderMenu.IsEnabled="True"
    ItemsSource="{Binding Policies}"
    ShowColumnFooters="True"
    Visibility="{Binding TopPaidPoliciesDisplayed,Converter={StaticResource invertedBooleanToVisibilityConverter}}">
 
    <telerik:RadGridView.Columns>
        <!--  ErrorDescription  -->
        <telerik:GridViewDataColumn CellTemplate="{StaticResource PaymentErrorsCell}" 
            Header="{Binding AppStrings.ErrorsAndWarnings, Source={StaticResource StringsLocator}}"
            IsFilterable="False"
            IsSortable="False"
            TextAlignment="Center"                                          
            UniqueName="ErrorDescription" />
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

At run time when user click on a grid row and then press the Ctrl+c buttons,he will get this error :

Message: An error occurred for the : System.NullReferenceException: Object reference not set to an instance of an object.
at Telerik.Windows.Data.Expressions.ExpressionFactory.MakeMemberAccess(Expression instance, String memberName, Type memberType)
at Telerik.Windows.Data.Expressions.PropertyAccessExpressionBuilder.CreateMemberAccessExpressionOverride()
at Telerik.Windows.Data.Expressions.MemberAccessExpressionBuilderBase.CreateMemberAccessExpression()
at Telerik.Windows.Data.Expressions.MemberAccessExpressionBuilderBase.CreateLambdaExpression()
at Telerik.Windows.Data.BindingToExpressionExtensions.CreateMemberAccessLambdaExpression(Binding binding, Type objectType, Type memberType)
at Telerik.Windows.Data.BindingToExpressionExtensions.CreateUntypedMemberAccessFunc(Binding binding, Type objectType, Type memberType)
at Telerik.Windows.Data.BindingToExpressionExtensions.CreateMemberAccessFunc(Binding binding, Type objectType, Type memberType)
at Telerik.Windows.Data.DataFieldDescriptorExtensions.CreateMemberAccessFunc(IDataFieldDescriptor fieldDescriptor)
at Telerik.Windows.Controls.GridViewBoundColumnBase.InitializeMemberAccessFunc()
at Telerik.Windows.Controls.GridViewBoundColumnBase.GetCellContent(Object item)
at Telerik.Windows.Controls.GridViewBoundColumnBase.OnCopyingCellClipboardContent(Object item)
at Telerik.Windows.Controls.GridView.Clipboard.Writers.WriterBase.RaiseCopyingEventAndGetCellValue(GridViewCellInfo cell)
at Telerik.Windows.Controls.GridView.Clipboard.Writers.WriterBase.GetSelectedItemsAsObjectMatrix(CellInfoCollection selectedCells)
at Telerik.Windows.Controls.GridView.GridViewDataControl.CopyToClipboard()
at Telerik.Windows.Controls.GridView.GridViewDataControl.CopyExecuted(Object sender, ExecutedRoutedEventArgs e)
at Telerik.Windows.Controls.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
at Telerik.Windows.Controls.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at Telerik.Windows.Controls.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at Telerik.Windows.Controls.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
at Telerik.Windows.Controls.ExecutedRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)
at Telerik.Windows.RadRoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at Telerik.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RadRoutedEventArgs routedEventArgs)
at Telerik.Windows.EventRoute.InvokeHandlersImpl(Object source, RadRoutedEventArgs args, Boolean raisedAgain)
at Telerik.Windows.RadRoutedEventHelper.RaiseEvent(DependencyObject element, RadRoutedEventArgs args)
at Telerik.Windows.Controls.RoutedCommand.ExecuteImpl(Object parameter, UIElement target)
at Telerik.Windows.Controls.RoutedCommand.Execute(Object parameter, UIElement target)
at Telerik.Windows.Controls.GridView.GridViewDataControl.OnKeyDown(KeyEventArgs e)
at System.Windows.Controls.Control.OnKeyDown(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags) 

I also tried to replace the e to f like this :
<DataTemplate  x:Key="PaymentErrorsCell">
           <ItemsControl ItemsSource="{Binding PaymentErrors, Mode=OneWay}">                       
               <ItemsControl.ItemTemplate>
                   <DataTemplate>
                       <TextBlock Foreground="{Binding Severity, Converter={StaticResource severityErrorToColorValueConverter}}" Text="{Binding Message}" />
                   </DataTemplate>
               </ItemsControl.ItemTemplate>
           </ItemsControl>
       </DataTemplate>

But the same error ...

Would love to have a solution,

With regards,
Avi

Tags
GridView
Asked by
Avi
Top achievements
Rank 1
Share this question
or