Telerik Forums
UI for WPF Forum
6 answers
124 views
Hi,

We are currently having issues running our application on Windows 7 tablet PC's. When the grid has data, we get a NullReferenceException. I found it that the exception will not occur when removing a specific column definition from the gridview:

  <telerik:GridViewColumn     CellTemplate="{StaticResource StatusButtons}"
                                            IsFilterable="False"
                                            MaxWidth="120"
                                            MinWidth="120"
                                            />

The application works fine on non-touch devices, but on touch devices (Win 7, .Net 3.5) the error occurs. Stopping the "Tablet PC Input" service does not help as mentioned in other threads.

The exception plus stacktrace

2012-01-09 10:09:18,868 FATAL - User Interface : Unhandled Exception
System.NullReferenceException: De objectverwijzing is niet op een exemplaar van een object ingesteld.
   bij System.Windows.Automation.Peers.AutomationPeer.EnsureChildren()
   bij System.Windows.Automation.Peers.AutomationPeer.UpdateChildren()
   bij System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   bij System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   bij System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   bij System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   bij System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   bij System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   bij System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   bij System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   bij System.Windows.ContextLayoutManager.fireAutomationEvents()
   bij System.Windows.ContextLayoutManager.UpdateLayout()
   bij System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   bij System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
   bij System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   bij System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   bij System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   bij System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   bij System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)


The Xaml:
<UserControl x:Class="BrabantWater.UI.Screens.ZInspectionListScreen"
    xmlns:imageFactory="clr-namespace:Sap.Eam.UI.Theme;assembly=CustomTheme_WPF"
    Height="auto" Width="auto">
    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="boolToVisConverter"/>
        <DataTemplate x:Key="StatusButtons">
            <StackPanel Orientation="Horizontal" Width="110">
                <telerik:RadButton Click="RadButtonDelete_Click" MinWidth="50"
                                   IsEnabled="{Binding Path=IsDeletable, Mode=OneWay}">
                    <Image Source="{Binding Path=DeleteImage, Mode=OneWay}" Width="32"/>
                </telerik:RadButton>
                <telerik:RadButton Click="RadButtonStatus_Click" MinWidth="50"
                                   IsEnabled="{Binding Path=IsEditable,Mode=OneWay}">
                    <Image Source="{Binding Path=StatusImage, Mode=OneWay}" Width="32"/>
                </telerik:RadButton>
            </StackPanel>
        </DataTemplate>
    </UserControl.Resources>
    <Grid x:Name="GridContainer">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
 
        <StackPanel Grid.Row="0" Orientation="Horizontal" Margin="5,5,5,5" Height="35" HorizontalAlignment="Stretch" VerticalAlignment="Center">
            <telerik:RadButton x:Name="ButtonNewInstallation" Content="{lex:LocText Key=Inspection_New_Installation, Dict=InspectionResources, Assembly=Win32Resources}" MinWidth="100" Click="ButtonNewInstallation_Click"/>
            <telerik:RadButton x:Name="ButtonNewDamage" Content="{lex:LocText Key=Inspection_New_Defect, Dict=InspectionResources, Assembly=Win32Resources}" Margin="10,0,0,0" MinWidth="100" Click="ButtonNewDamage_Click"/>
        </StackPanel>
                     
        <telerik:RadGridView x:Name="InspectionGrid"
                             AlternationCount="2"
                             AutoGenerateColumns="False"
                             CanUserFreezeColumns="False"    
                             CanUserReorderColumns="False"
                             ColumnWidth="*"
                             EditTriggers="None"
                             Grid.Row="1"
                             Margin="5"
                             MouseDoubleClick="InspectionGrid_MouseDoubleClick"
                             RowIndicatorVisibility="Collapsed"
                             SelectionChanged="InspectionGrid_SelectionChanged"
                             SelectedItem="{Binding Path=CurrentInspection, Mode=TwoWay}"
                             ShowGroupPanel="false">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn UniqueName="DamageCodeDescription"
                                            Header="{lex:LocText Key=Inspection_Space, Dict=InspectionResources, Assembly=Win32Resources}"
                                            DataMemberBinding="{Binding Path=DamageCodeDescription, Mode=OneWay}"/>
                <telerik:GridViewDataColumn UniqueName="ItemCodeDescription"
                                            Header="{lex:LocText Key=Inspection_Part, Dict=InspectionResources, Assembly=Win32Resources}"
                                            DataMemberBinding="{Binding Path=ItemCodeDescription, Mode=OneWay}"/>
                <telerik:GridViewDataColumn UniqueName="ItemDescription"
                                            Header="{lex:LocText Key=Inspection_Addition, Dict=InspectionResources, Assembly=Win32Resources}"
                                            DataMemberBinding="{Binding Path=ItemDescription, Mode=OneWay}"/>
                <telerik:GridViewDataColumn UniqueName="CauseCodeDescription"
                                            Header="{lex:LocText Key=Inspection_Task, Dict=InspectionResources, Assembly=Win32Resources}"
                                            DataMemberBinding="{Binding Path=CauseCodeDescription, Mode=OneWay}" />
                <telerik:GridViewDataColumn UniqueName="TaskCodeDescription"
                                            Header="{lex:LocText Key=Inspection_Finding, Dict=InspectionResources, Assembly=Win32Resources}"
                                            DataMemberBinding="{Binding Path=TaskCodeDescription, Mode=OneWay}" />
                <telerik:GridViewDataColumn UniqueName="ActivityCodeDescription"
                                            Header="{lex:LocText Key=Inspection_Risk, Dict=InspectionResources, Assembly=Win32Resources}"
                                            DataMemberBinding="{Binding Path=ActivityCodeDescription, Mode=OneWay}" />
                <telerik:GridViewImageColumn DataMemberBinding="{Binding Path=AttachmentImage, Mode=OneWay}"
                                            Header="{lex:LocText Key=Inspection_Attachments, Dict=InspectionResources, Assembly=Win32Resources}"
                                            ImageHeight="32"
                                            ImageWidth="32"
                                            IsFilterable="False"
                                            MaxWidth="60"
                                            MinWidth="60"
                                            />
                <telerik:GridViewColumn     CellTemplate="{StaticResource StatusButtons}"
                                            IsFilterable="False"
                                            MaxWidth="120"
                                            MinWidth="120"
                                            />
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>     
    </Grid>
</UserControl>

The version of the Telerik WPF components being used: 2010.2.0716.35.

How can we solve this issue?

Kind regards,

Mike
Martin
Top achievements
Rank 1
 answered on 11 Jan 2012
5 answers
91 views
Is there anyway to delay the execution of the query? What I'd like to do is create the datasource. Bind a DataFilter to it, then bind a gridview to the filtered source. But I'd like to not show any results in the gridview until the user has added filters. Basically use this as a searching mechanism.

Is this possible?

Also, are there any samples on how to use this in an MVVM scenario using QueryableEntityCollection<T> in the viewmodel?
Rossen Hristov
Telerik team
 answered on 11 Jan 2012
1 answer
188 views
i had an wpf application contains radtreeview ,i add HierarchicalDataTemplate inside RadTreeview Item Template which contains:

1- RadComboBox 
2- grid contains three textboxs and radcombobox.

when radcomobox selectionchanged the grid bind data into textboxes  according to the selected value in the combobox.

how i can return the current row when RadComboBox is changed, and how i get the contorls inside the row as well.

Regards 


Petar Mladenov
Telerik team
 answered on 11 Jan 2012
2 answers
201 views
I want to get the row in the data loaded event to set the focus on that row.
Vishwajeet
Top achievements
Rank 1
 answered on 11 Jan 2012
1 answer
84 views
Hi there

I'm grouping appointments on a day view by employees (EmployeeResource) so I see all the employee's appointments for the day on a column. Now, in the header template, I would like to show a total of hours already assigned (basically the sum of appointments durations.

The dirty version would be to provide such a total as a property of the EmployeeResource and update my resources on all edited/created/deleted events. However, I'm hoping there's a more elegant approach to this.

Thanks for your advice
Philipp
Yana
Telerik team
 answered on 11 Jan 2012
1 answer
42 views
I am trying to bind a RadGrid to a generic list of custom class through OnNeedDataSource. The grid displays the correct number of rows, however, the values for the fields are empty. I can bind to a datasource object without a problem, but I am going to be adding additional functionality where this method will be necessary. For simplicity sake, I am just trying to bind a single exposed property from the custom class object.

.ASPX

<form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1"  runat="server">
          
    </telerik:RadScriptManager>
    <div>
     <telerik:RadGrid runat="server" AllowPaging="True" ID="RadGrid2" OnNeedDataSource="RadGrid2_NeedDataSource" Width="600px" PageSize="8">
            <MasterTableView Width="100%" >
                <Columns>
                     <telerik:GridBoundColumn HeaderText="Project Name" DataField="name" ></telerik:GridBoundColumn>
                </Columns>
                <NoRecordsTemplate>
                    <div style="height: 30px; cursor: pointer;">
                        No items to view</div>
                </NoRecordsTemplate>
                <PagerStyle Mode="NumericPages" PageButtonCount="4" />
            </MasterTableView>
        </telerik:RadGrid>
    </div>
    </form>

ASPX.VB
Imports System
Imports System.Collections.Generic
Imports System.Configuration
Imports System.Data
Imports System.Data.Common
Imports System.Data.SqlClient
Imports System.Web.UI
Imports Telerik.Web.UI
Public Class bookmarks
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  
    End Sub
    Protected Sub RadGrid2_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid2.NeedDataSource
        RadGrid2.DataSource = getBookMarks
    End Sub
    Private ReadOnly Property getBookMarks() As IList(Of project)
        Get
            Dim strSQL As String = "SELECT PROJ_NAME FROM [OPI_TIMESHEETS] o left outer join DCSC_PROJECT d on o.project_number = d.PROJ_NO "
            Dim results As IList(Of project) = New List(Of project)()
            Using connection As IDbConnection = DbProviderFactories.GetFactory("System.Data.SqlClient").CreateConnection()
                connection.ConnectionString = ConfigurationManager.ConnectionStrings("projcentral").ConnectionString
  
                Using command As IDbCommand = connection.CreateCommand()
                    command.CommandText = strSQL
  
                    connection.Open()
                    Try
                        Dim reader As IDataReader = command.ExecuteReader()
                        While reader.Read()
                            Dim name As String = reader.GetValue(reader.GetOrdinal("PROJ_NAME"))
                            results.Add(New project(name))
                        End While
  
                    Catch ex As SqlException
                        results.Clear()
                        'lblmsg.Text = ex.Message
                    End Try
                End Using
            End Using
            lblMsg.Text = results.Count & " items in list"
            Return results
  
        End Get
    End Property
    Class project
  
        Private _projName As String
  
        Sub New(ByVal name As String)
  
            _projName = name
  
        End Sub
#Region "properties"
  
        Private ReadOnly Property Name() As String
            Get
                Return _projName
            End Get
        End Property
  
#End Region
    End Class
  
End Class
Vlad
Telerik team
 answered on 11 Jan 2012
1 answer
56 views
I'm using RadCarousel component and I want know if there any method
to get the item position inside radCarousel (x and y),  I need to retrieve this data when the selected item inside the component has change! I need to know the size, and the x,y of the item, so i can do a background effect around the item
Maya
Telerik team
 answered on 11 Jan 2012
1 answer
84 views
How can i solve this problem?
reference attached file.
Rosi
Telerik team
 answered on 11 Jan 2012
1 answer
112 views
Hi, how could i get the direction that the carrousel is moving to (is moving left, right)?
Maya
Telerik team
 answered on 11 Jan 2012
4 answers
184 views
I know this question has been asked before, but I haven't seen a good, simple answer.

I want to add a GridViewSelect column that is bound to my ViewModel. I know it's been said that the built in GridViewSelectColumn simply doesn't support this. And that there are some virtualization issues if you try to bind to the actual GridViewRow/Cell.

I just want a nice simple, generic (not tied to my specific model, and not reliant on Bindings without Converters) implementation. I'd rather not add a dependency on Blend Interactivity.

Can this be accomplished by simply sub-classing GridViewSelectColumn or GridViewDataColumn? Or can I set the cell header style to be bound somehow?

I'm just looking for a simpler implementation than what I've seen already.

Thank you.
Maya
Telerik team
 answered on 11 Jan 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?