InvalidOperationException - simple scenario

3 posts, 0 answers
  1. Vasile
    Vasile avatar
    33 posts
    Member since:
    Dec 2010

    Posted 13 Mar 2011 Link to this post

    Hello

    I try to use RadDataFilter control in my application, and I get and exception whenever I change the filtered property. I belived it may be from my application and then I created a separate project where I shrink down the code to the minimum necessary, the error is still reproduced.

    System.Windows.Data Error: 'MS.Internal.Data.DynamicValueConverter' converter failed to convert value 'null' (type 'null'); BindingExpression: Path='Operator' DataItem='Name IsEqualTo <Unset> ' (HashCode=61337593); target element is 'Telerik.Windows.Controls.Data.DataFilter.FilterEditor' (Name=''); target property is 'FilterOperator' (type 'Telerik.Windows.Data.FilterOperator').. System.InvalidOperationException: Can't convert type null to type Telerik.Windows.Data.FilterOperator.

     

    at MS.Internal.Data.DynamicValueConverter.Convert(Object value, Type targetType, Object parameter, CultureInfo culture)

    at System.Windows.Data.BindingExpression.ConvertToTarget(Object value).

    How I did it.
    When running project (I cannot attach sample) press once "+" button to add a filter criteria.
    It will display the first property filter "Name" correctly, no expcetion.
    If you select another property it will throw the exception above, in "Release" mode you will not see it, but in debug you will see the error in Output window and depending if stop on exceptions is selected, the program will stop if the error occurs.

    The xaml code is just like this 

     

    <Grid x:Name="LayoutRoot" Background="White">
    <telerik:RadDataFilter Name="filter1" AutoGenerateItemPropertyDefinitions="True" Source="{Binding}">
    </telerik:RadDataFilter>
    </Grid 

     

     

     

    and in code behind I have

     

    public partial class MainPage : UserControl
        {
            public class Record
            {
                public string Name { get; set; }
                public int Id { get; set; }
            }

     

            public ObservableCollection<Record> Records = new ObservableCollection<Record>();

     

            public MainPage()
            {
                InitializeComponent();

     

                #region Create Sample records
                Records.Add(new Record()
                {
                    Name = "U1",
                    Id = 1
                });
                Records.Add(new Record()
                {
                    Name = "U2",
                    Id = 2
                });
                Records.Add(new Record()
                {
                    Name = "U3",
                    Id = 3
                });
                Records.Add(new Record()
                {
                    Name = "U4",
                    Id = 4
                });
                #endregion

     

                filter1.DataContext = Records;
            }
        }

     

  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 14 Mar 2011 Link to this post

    Hi Vasile,

    You should not worry about this exception, since it is expected and is handled internally.

    Nevertheless, we will add an IValueConverter to the Binding so that you are not getting this exception in the Output Window any more.

    The fix will make it for one of the next Latest Internal Build's.

    I hope this helps.

    All the best,
    Ross
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. DevCraft banner
  4. Vasile
    Vasile avatar
    33 posts
    Member since:
    Dec 2010

    Posted 16 Mar 2011 Link to this post

    Hello Ross,

    Glad to hear that you are going to improve this.

    Thank you
    Vasile
Back to Top