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

SfChart is crashing if ChartTitle is not hardcoded in xaml (UWP only)

Thread ID:

Created:

Updated:

Platform:

Replies:

131866 Jul 31,2017 11:34 AM UTC Feb 9,2018 02:42 PM UTC UWP 5
loading
Tags: SfChart
Emil
Asked On July 31, 2017 11:34 AM UTC

I am binding sfChart dynamically in viewmodel and it works fine in Android but in UWP, it crashes with the exception below. It works only if I hardcode something like
  <chart:ChartTitle Text="title"/>


Binding from ViewModel:
  <chart:SfChart.Title>

                <chart:ChartTitle Text="{Binding ChartTitle}"/>

            </chart:SfChart.Title>


System.ArgumentNullException occurred
HResult=0x80004003
Message=Value cannot be null.
Source=
StackTrace:
at System.StubHelpers.HStringMarshaler.ConvertToNativeReference(String managed, HSTRING_HEADER* hstringHeader)
at Windows.UI.Xaml.Controls.TextBlock.put_Text(String value)
at Syncfusion.SfChart.XForms.UWP.ChartTitleMapping.OnChartTitlePropertiesChanged(String propertyName, ChartTitle formChartTitle, Border border)
at Syncfusion.SfChart.XForms.UWP.SfChartMapping.OnChartPropertiesChanged(String propertyName, SfChart formsChart, SfChart nativeChart)
at Syncfusion.SfChart.XForms.UWP.SfChartRenderer.GetNativeChart(SfChart sfChart)
at Syncfusion.SfChart.XForms.UWP.SfChartRenderer.OnElementChanged(ElementChangedEventArgs`1 e)
at Xamarin.Forms.Platform.UWP.VisualElementRenderer`2.SetElement(VisualElement element)
at Xamarin.Forms.Platform.UWP.Platform.CreateRenderer(VisualElement element)
at Xamarin.Forms.Platform.UWP.VisualElementPackager.OnChildAdded(Object sender, ElementEventArgs e)
at Xamarin.Forms.Platform.UWP.VisualElementPackager.Load()
at Xamarin.Forms.Platform.UWP.VisualElementRenderer`2.SetElement(VisualElement element)
at Xamarin.Forms.Platform.UWP.Platform.CreateRenderer(VisualElement element)
at Xamarin.Forms.Platform.UWP.VisualElementPackager.OnChildAdded(Object sender, ElementEventArgs e)
at Xamarin.Forms.Platform.UWP.VisualElementPackager.Load()
at Xamarin.Forms.Platform.UWP.VisualElementRenderer`2.SetElement(VisualElement element)
at Xamarin.Forms.Platform.UWP.Platform.CreateRenderer(VisualElement element)
at Xamarin.Forms.Platform.UWP.VisualElementPackager.OnChildAdded(Object sender, ElementEventArgs e)
at Xamarin.Forms.Platform.UWP.VisualElementPackager.Load()
at Xamarin.Forms.Platform.UWP.VisualElementRenderer`2.SetElement(VisualElement element)
at Xamarin.Forms.Platform.UWP.Platform.CreateRenderer(VisualElement element)
at Xamarin.Forms.Platform.UWP.VisualElementExtensions.GetOrCreateRenderer(VisualElement self)
at Xamarin.Forms.Platform.UWP.NavigationPageRenderer.SetPage(Page page, Boolean isAnimated, Boolean isPopping)
at Xamarin.Forms.Platform.UWP.NavigationPageRenderer.OnPushRequested(Object sender, NavigationRequestedEventArgs e)
at Xamarin.Forms.NavigationPage.d__90.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Xamarin.Forms.NavigationPage.d__48.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

Durgadevi Selvaraj [Syncfusion]
Replied On August 1, 2017 10:41 AM UTC

Hi Emil, 
 
Thanks for contacting Syncfusion Support. 
We have analyzed the reported problem and unable to reproduced it at our end. We have prepared a demo sample with the reference of provided information and it can be downloaded from below link,  
 
Sample: Chart_Sample
 
If you are still able to reproduce the problem, please revert us by  modifying the provided sample. It would be helpful for us to provide a solution sooner. 
 
Regards,  
Durgadevi S 



Emil
Replied On August 3, 2017 04:11 PM UTC

ah ok, i was using onappearing instead constructor. it works fine using constructor now. thank you


Durgadevi Selvaraj [Syncfusion]
Replied On August 4, 2017 06:39 AM UTC

Hi Emil, 
 
We glad to know that your problem has been resolved. 
Please let us know if you need any further assistance. 
Regards, 
Durgadevi S 


Emil
Replied On February 8, 2018 04:52 PM UTC

Hi,

although above workaround works, why is required to have chart:ChartTitle  ? this requirement not exist in Android but in UWP. please try not to set chartTitle at all or set in OnAppearing, you will see this crash.

thanks,

Emil

Durgadevi Selvaraj [Syncfusion]
Replied On February 9, 2018 02:42 PM UTC

 
Thanks for the update. 
 
The null value is not accepted for the Text property of ChartTitle in UWP, so the app crashed in UWP alone. However, we can resolve this problem by setting default value as string.Empty to the ChartHeader property in ViewModel to resolve this issue. Please refer the below codes, 
 
Code Snippet[C#] 
private string _chartHeader = string.Empty; 
public string ChartHeader 
{ 
            get 
            { 
                return _chartHeader; 
            } 
            set 
            { 
                _chartHeader = value; 
                NotifyPropertyChanged("ChartHeader"); 
 
            } 
  } 
 
 
Please find the reference output screenshot below, 
 
 
We have modified the above sample based on this and it can be downloaded from the below link, 
Sample:SfChart_Title
 
 
Please let us know if you have any concerns. 
 
Regards,  
Durgadevi S 


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

;