Get/Set nested property values

Posted by Daniel Deer on Stack Overflow See other posts from Stack Overflow or by Daniel Deer
Published on 2009-06-25T07:42:43Z Indexed on 2010/05/14 8:04 UTC
Read the original article Hit count: 189

Filed under:
|
|
|

I'll try to be more descriptive here.
A Few Q's:

  1. using:
    var foo = new Foo() { Bar = new Bar() { Value = "Value" } };
    var value = DataBinder.Eval(foo, "Bar.Value");

    Or: This one
    It is possible to retrieve an internal nested property using property path syntax. Is there a way to set/trigger a nested property (a regular property not DependencyProperty) easily with some kind of simple mechanisms as described here? I want to acheive something like:
    string newValue = "Hello World!";
    DataBinder.EvalSet(foo, "Bar.Value", NewValue);

  2. Is there any mechanism that support both property path (for nested objects) and XPATHs (if the objects are XPATH navigable of course) ? again, that supports get and set options.

Thanks, DD

© Stack Overflow or respective owner

Related posts about c#

Related posts about databinding