I have a simple UserControl where I want to bind a Label text value to a property in a DLL. My Main Application allows me to insert my own user control by specifying the XAML.
In the below XAML the CheckSubtotal property which I am using is part of the application which loads the user control. This property populates in the control without any problems. In the below XAML the TestValue property is in MyTestDLL.dll which I have specified at the beginning of the XAML. This property is NOT populating in the control.
Example DLL - MyTestDLL.dll
namespace MyTestNamespace
{
public class Application
{
public static string TestValue = "TestVal";
public Application()
{}
}
}
Example XAML
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:systemWindows="clr-namespace:System.Windows;assembly=PresentationFramework"
xmlns:local="clr-namespace:MyTestNamespace;assembly=MyTestDLL"
>
<Grid>
<DockPanel>
<Border DockPanel.Dock="Left" Width="294" Margin="3,0,4,3" CornerRadius="0,0,3,3" Padding="2" BorderBrush="Black" BorderThickness="0" Background="White">
<DockPanel>
<StackPanel DockPanel.Dock="Bottom" HorizontalAlignment="Stretch" Margin="5,0,5,0">
<Grid>
<Label FontSize="20" Content="SubTotal:" HorizontalAlignment="Left" Margin="10,0,0,0" Width="129.51"/>
<Label FontSize="20" HorizontalAlignment="Right" Margin="0,0,21,0" Content="{Binding Path=CheckSubtotal}"/>
</Grid>
<Grid>
<Label FontSize="20" Content="TestValue:" HorizontalAlignment="Left" Margin="10,0,0,0" Width="129.51"/>
<Label FontSize="20" HorizontalAlignment="Right" Margin="0,0,21,0" Content="{Binding Path=TestValue}"/>
</Grid>
</StackPanel>
</DockPanel>
</Border>
</DockPanel>
</Grid>
</UserControl>