In my project, I have XAML file like this:
<Grid Margin="50,0,0,0">
//Huge amount of code goes here
</Grid>
It is very difficult to go through all the code in Grid while designing. Can I move all the code to a separate XAML file file and in in this Grid content i will call that XAML file??
<Grid Margin="50,0,0,0">
//call xaml file here
</Grid>
You should define a UserControl; assume the “Huge amount of code” is sth like this:
Now you create a new UserControl an put this Border in it
You can use
UserControl1in other Xamls. You should addxmlns:wp="clr-namespace:WpfApplication"to your Xaml. For example if you want to use it in a Window: