How do I bind a property of a class that is in another assembly in WPF?

In WPF, you can bind a property to a class that is a different assembly for a control that is in a different assembly. Please, help. Thanks to

+2


source to share


1 answer


Yes you can reference this assembly to your wpf project than add namespace to xaml like this

<UserControl xmlns:custom="clr-namespace:SampleClass;assembly=SampleLibrary"...

      

than adding this class to UserControl resources



<UserControl.Resources>
  <custom:SampleClass x:Key="myClass"/>
</UserControl.Resources> 

      

than to bind a property to it

 <TextBox Text={Binding Source={StaticResource myClass},Path=MyProperty}/>

      

+8


source







All Articles