Horje
wpf binding object get value Code Example
wpf binding object get value
public static class PropertyPathHelper
{
    public static object GetValue(object obj, string propertyPath)
    {
        Binding binding = new Binding(propertyPath);
        binding.Mode = BindingMode.OneTime;
        binding.Source = obj;
        BindingOperations.SetBinding(_dummy, Dummy.ValueProperty, binding);
        return _dummy.GetValue(Dummy.ValueProperty);
    }

    private static readonly Dummy _dummy = new Dummy();

    private class Dummy : DependencyObject
    {
        public static readonly DependencyProperty ValueProperty =
            DependencyProperty.Register("Value", typeof(object), typeof(Dummy), new UIPropertyMetadata(null));
    }
}




Csharp

Related
C# Property Code Example C# Property Code Example
c# builder pattern fluent example Code Example c# builder pattern fluent example Code Example
C# Zip large files causes OOM exception Code Example C# Zip large files causes OOM exception Code Example
Make UI/Canvas look at Camera always. Code Example Make UI/Canvas look at Camera always. Code Example
C# how to stop user type into combobox Code Example C# how to stop user type into combobox Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11