After you've added the reference, you can call the UserControl directly from the code behind, like this:
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.Content = new WpfControlLibrary1.UserControl1();
}
}
If you want to use it from the XAML code, use this:
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:lib="clr-namespace:WpfControlLibrary1;assembly=WpfControlLibrary1"
Title="MainWindow" Height="350" Width="525">
<Grid>
<lib:UserControl1 />
</Grid>
</Window>
The xmlns:lib attribute of the Window element, maps the xml namespace
lib
to the
WpfControlLibrary1
namespace. This is the syntax:
xmlns:{name}="clr-namespace:{namespace};assembly={assembly}"
I hope this helped you!
PS:
remember to recompile the whole solution, otherwise, the IntelliSense won't be able to detect the new namespace!