I have a class in assembly “AssemblyX” with property “Comment”. I want to bind AssemblyX.Comment to TextBlock.Text in another assembly?
I’m trying to do it in the following way but it is not working.
<Window xmlns:cc="clr-namespace:SomeNamespace;assembly=AssemblyX">
<TextBlock Text={Binding cc:Comment}/>
...
You usually don’t bind to a property of a class, you bind to a property of an instance of a class. So in your codebehind you’d create an instance:
And in your xaml you bind:
In this case it absolutely does not matter in what assembly
SomeClassis declared, as long as you current project references that assembly. It also doesn’t matter whatSomeClassis named. All that matters is that the instance you bind against has a property namedComment.If the property of your class is static and you therefore don’t have an instance, you can bind to the static property like this: