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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Cannot set DisplayBinding on column from XAML

Thread ID:

Created:

Updated:

Platform:

Replies:

130637 May 23,2017 07:17 AM UTC Mar 2,2018 01:07 PM UTC Xamarin.Forms 5
loading
Tags: SfDataGrid
Assem Hakmeh
Asked On May 23, 2017 07:17 AM UTC

     When attempting to set the DisplayBinding property from XAML. The XAML compiler reports a property not found error.

                    <sf:GridTextColumn
                        MappingName="address"
                        DisplayBinding="{Binding address, Converter={StaticResource addressDisplayConverter}}"


Are there any workarounds for this in XAML?


Sivaraman Sivagurunathan [Syncfusion]
Replied On May 24, 2017 11:38 PM UTC

Hi Assem Hakmeh, 
 
Thanks for contacting Syncfusion Support. 
 
We have checked your query. In that, if you are enabling the Xaml compilation in code behind ([XamlCompilation(XamlCompilationOptions.Compile)]) you cannot set the binding in XAML page. This is a known issue in the Framework and has been reported as a bug in Bugzilla as well. You can see the details of it from the below thread. 
 
 
However, you can overcome this issue as of now by setting DisplayBinding for the columns in code-behind instead of Xaml.  
 
Please refer the below code snippet.  
  
// In Xaml  
<syncfusion:SfDataGrid x:Name="dataGrid"  
                           AutoGenerateColumns="False"  
                           ColumnSizer="Star"  
                           ItemsSource="{Binding OrdersInfo}">  
        <syncfusion:SfDataGrid.Columns>    
           <syncfusion:GridTextColumn MappingName="OrderID" />         
        </syncfusion:SfDataGrid.Columns>  
</syncfusion:SfDataGrid>  
  
// In Codebehind  
dataGrid.Columns[0].DisplayBinding = new Binding() { Path = "OrderID", Converter = newDisplayBindingConverter() };  
  
Also, we have attached a simple sample for your reference and you can download the same from the below link.  
 
 
Regards, 
Sivaraman 
 


John Wiese
Replied On February 26, 2018 04:07 PM UTC

Reviewing the Bugzilla report it appears that the Xamarin team suggested that there is a change needed in sfDataGrid.  In the latest update (Feb. 2018) I still receive the error when setting the DisplayBinding in XAML.  Is this a change you plan to make or are my only options to disable XAML-Compilation or set the DisplayBinding in code?

Sivaraman Sivagurunathan [Syncfusion]
Replied On February 28, 2018 03:35 AM UTC

Hi John Wiese 
 
Thanks for using Syncfusion support. 
 
We have checked your query. In Bugzilla report, they suggest to use BindingBase instead binding. If we are using BindingBase instead of using Binding typecast has been occur for each GridCell in SfDataGrid. So we should suggest you to set the DisplayBinding in code behind. Or if you want to maintain the MVVM pattern write the behavior to the SfDataGrid and set the DisplayBinding.  
 
Regards, 
Sivaraman 
 


Assem Hakmeh
Replied On February 28, 2018 04:48 AM UTC

Hi John Wiese 
 
Thanks for using Syncfusion support. 
 
We have checked your query. In Bugzilla report, they suggest to use BindingBase instead binding. If we are using BindingBase instead of using Binding typecast has been occur for each GridCell in SfDataGrid. So we should suggest you to set the DisplayBinding in code behind. Or if you want to maintain the MVVM pattern write the behavior to the SfDataGrid and set the DisplayBinding.  
 
Regards, 
Sivaraman 
 


Hi Sivaraman,

Are you saying that your team has chosen DisplayBinding to be of type Binding instead of BindingBase for performance reasons? Because the cost of type-casting BindingBase to Binding is too high? If that is the case, can you please share any measurements you would have to compare the two?

Sincerely,

Assem

Suriya Kalidoss [Syncfusion]
Replied On March 2, 2018 01:07 PM UTC

Hi JohnWiese, 
    
We have created an incident under your account regarding your query for further follow-ups and you can track the status of the requirement on this incident 199999. 
Regards, 
Suriya 
  


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;