Mittwoch, 24. Februar 2016

Static Binding to Object of a DataClass

Central Object of Data Class is located in App.xaml.cs for instance...

 private static IniStructure _iniObj;
        public static IniStructure IniObj
        {
            get { return _iniObj; }
            set { _iniObj = value; }
        }

This IniObj contains a member called "Username".

add the application namespace to xaml

xmlns:myProj="clr-namespace:MyProjectNamespace"

add the binding to the property Text of a TextBox

Text="{Binding Source={x:Static myProj:App.IniObj}, Path=Username}"