We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Changing text value in sfDataGrid

Here is my code:

     <sfgrid:GridTemplateColumn MappingName="Surname" HeaderText="Patient Record Status">        
                        <sfgrid:GridTemplateColumn.CellTemplate>        
                            <DataTemplate>          
                                <Label x:Name="label" Text="{Binding Surname}" TextColor="Black" />         
                            </DataTemplate>         
                        </sfgrid:GridTemplateColumn.CellTemplate>
                    </sfgrid:GridTemplateColumn>

And I am getting exception:
Unable to cast object of type 'Xamarin.Forms.Xaml.ListNode' to type 'Xamarin.Forms.Xaml.IElementNode'

I am also trying to change mapped value with converter:

    <ContentPage.Resources>
        <ResourceDictionary>
            <pages:BlaBlaConverter x:Key="SomeConverter"/>
        </ResourceDictionary>
    </ContentPage.Resources>

and

                   <sfgrid:GridTextColumn Width="200"
                                           HeaderText="Surname"
                                           MappingName="Surname" DisplayBinding="{Binding Surname, 
                                   Converter={StaticResource SomeConverter}}"/>

but getting:

Type StaticResource SomeConverter not found in xmlns http://xamarin.com/schemas/2014/forms MyApp


3 Replies

AN Ashok N Syncfusion Team July 27, 2017 08:58 AM UTC

Hi Alexej, 

Thanks for contacting Syncfusion support.  

We have checked the reported exception in GridTemplateColumn and GridTextColumn.DiplayBinding StaticResource SomeConverter not found issue with 15.2.0.46 but we are not able to reproduce the issue. Unbound column values was updated after edited values was committed in view. For your reference we have attached the working copy of the sample in the below location, please refer it. Could you please do revert us by modifying our sample to replicate the issue. Otherwise please share your sample along with replication procedure, that would be more helpful for us to proceed further.      
     
  
Regards, 
Ashok 



AL Alex July 27, 2017 12:12 PM UTC

Thank you for sample. It works.

Very strange, but when I have replaced my XAML:

<sfgrid:GridTemplateColumn MappingName="Surname" HeaderText="First Name binding">        
                        <sfgrid:GridTemplateColumn.CellTemplate>        
                            <DataTemplate>          
                                <Label x:Name="label" Text="{Binding Surname}" TextColor="Black" />         
                            </DataTemplate>         
                        </sfgrid:GridTemplateColumn.CellTemplate>
                    </sfgrid:GridTemplateColumn>

with equal XAML from sample my project also works:

               <sfgrid:GridTemplateColumn MappingName="FirstName" HeaderText="First Name binding">
                    <sfgrid:GridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Label x:Name="label" Text="{Binding FirstName}" TextColor="Black" />
                        </DataTemplate>
                    </sfgrid:GridTemplateColumn.CellTemplate>
                </sfgrid:GridTemplateColumn>



AN Ashok N Syncfusion Team July 28, 2017 05:14 AM UTC

Hi Alexej,  

Thanks for your update. Please let us know if you require further assistance on this. 

Regards, 
Ashok 


Loader.
Up arrow icon