WPF / ValidationRules / Generics / Enumerations problem (C#)

eric-914eric-914 Posts: 46
edited October 30, 2013 2:29PM in SmartAssembly
Hello, this is occurring w/in WPF and a control's validation rules definition, but I suspect it's more a problem regarding generics.

I've got the following generic class that derives from ValidationRule (WPF):
public class MyBaseRule<T> : ValidationRule
{
  public T Data { get; set; }
  ...
}
And I've got implementation classes off of the generic class, like:
public class MyRule : MyBaseRule<SomeEnumeration> 
{
  public SomeEnumeration Data2 { get; set; }
  ...
}

Now in WPF, w/in the ValidationRules definition:
<Binding.ValidationRules>
  <Validation:MyRule Data="SomeEnumerationValue" />
</Binding.ValidationRules>

This will FAIL, w/ a NotImplementedException.

However, if I use Data2 in place of Data, things will work.

I have turned OFF all pruning, obfuscation, and so on, to try and narrow this down. This is only happening after being run through SA.

Can anyone tell me why WPF can't see the Data property of the generic parent class, but is ok w/ seeing the Data2 property, which should be the same thing?

Comments

  • Jessica RJessica R Posts: 1,319 Rose Gold 4
    Hi Eric!

    I sent you a message a few days ago regarding your post, but in case you haven't received it..

    I'm afraid I'm not immediately sure why this error is happening. Do you think you would you be able to provide us with your unprocessed application to do some testing on this?

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


Sign In or Register to comment.