Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

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));
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: invalidoperationexception c# ui thread 
Csharp :: Getting the text from a drop-down box 
Csharp :: request a pricipal permission 
Csharp :: c# check port in remote pc 
Csharp :: guicontrol text ahk 
Csharp :: dictionaries in unity 
Csharp :: c# lambda group by multiple columns 
Csharp :: rename join table ef core 
Csharp :: how to get length of okobjectresult c# 
Csharp :: or operator in shell 
Csharp :: unity audiosource play 
Csharp :: entityframework index 
Csharp :: c# ip address to string 
Csharp :: indexing an array 
Csharp :: select a whole row out of a 2d array C# 
Csharp :: c# read huge file 
Csharp :: method c# 
Csharp :: c# copy all files in directory and subdirectories 
Csharp :: c# external execute batch 
Csharp :: c# convert xml to list string 
Csharp :: hide external app from taskbar 
Csharp :: c# define array 
Csharp :: get xml from url 
Csharp :: exception is null c# 
Csharp :: lightbox 
Csharp :: C# date type no time 
Csharp :: read system data dataset 
Csharp :: c# bool? to bool 
Csharp :: wpf button to return to last window 
Csharp :: c# ilogger for inherited class 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =