1
Answer

Using WPF User Control in application

Ask a question
Ron

Ron

12y
1.6k
1
I'm having difficulty using a User Control in a application.

Application:

Xaml:

<Window x:Class="MyApp.MyAppMain"
...
</Window>

Xaml.cs:
namespace MyApp
{
    public partial class MyAppMain : Window
    ...
}

User Control:

Xaml:

<UserControl x:Class="MyApp.FileLookup"
             x:Name="FileLookup"
             ...
</UserControl>
             
Xaml.cs:
             
namespace MyApp
{
     public partial class FileLookup : UserControl
}

Integrating User Control into App:

Xaml:

<Window x:Class="MyApp.MyAppMain"
        <xmlns:local="clr-namespace:MyApp.FileLookup">
        ...       

    <Grid>   
        <local:FileLookup />
    </Grid>

</Window>

Regardless of where in the application I insert <local:FileLookup />, I get an indication that the FileLookup can't be found. Where am I going wrong?




Answers (1)