Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
585
AutoSalesDashboard Sample Problems
posted

I am trying to check out the AutoSalesDashboard.

First problem was that it wouldn't compile - looks like it was expecting a different build version of the Infragistics DLL in the project than was delivered with the ZIP.  I removed all references and added back from my installed version and compile and run works OK now.

However, when I try to open DashboardView.xaml in VS designer it throws an exception :

System.InvalidCastException
Unable to cast object of type 'System.Windows.Data.Binding' to type 'System.IConvertible'.
at System.Convert.ToDouble(Object value) at AutoSalesDashboard.Converters.ValueToStringFormatConverter.Convert(Object value, Type targetType, Object parameter, CultureInfo culture) in C:\Users\brian.AVC\Downloads\NetAdvantage_Silverlight_Showcase_AutoSalesDashboard_Source\AutoSalesDashboard\Converters\ValueToStringFormatConverter.cs:line 46

Is it normal for this to be thrown at design time?

Any way to view the XAML in the designer?

Parents
No Data
Reply
  • 30945
    Suggested Answer
    Offline posted

    Hello,

     

    Thank you for your post. I have been looking into the error that you have described and it seems that the reason for it is that the System.Convert.ToDouble is used with the value  parameter in the Convert method of the ValueToStringFormatConverter class. It seems that the binding is triggered when the design is used and the cast error is appearing. You can change the convert method of the ValueToStringFormatConverter class as follows in order to avoid the designer issue:

     

    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        if (value != null && value is double)
        {
            double v = (double)value;
    
            if (v != 0 && v / 1000 > 1)
            {
                return "#,##0, K";
            }
        }
    
        return "";
    }
    

     

    Also I can suggest using Microsoft Expression Blend when you wish to see the change the application’s appearance, design time, since the Expression Blend is a designer oriented IDE. Using Expression Blend Preview for Silverlight 5, the DashboardView of AutoSalesDashboard sample application is displaying without any errors to appear.

     

    Please let me know if you need any further assistance on the matter.

     

    Sincerely,

    Krasimir

    Developer Support Engineer

    Infragistics

    www.infragistics.com/support

Children