✅ Adding XAML code from a seperate file into the MainWindow
Is it possible to add XAML code into a file from own other. These are files that I will regularly need to edit and update so having them in a seperate file from the MainWindow is important.
E.g “Panel1.xaml” needs to have its code “injected” into MainWindow
13 Replies
You create your own usercontrols
Or custom controls
And you'd use them like your regular wpf controls in the main window
Sorry can you expand on this a little bit?
Here’s what the project is. I just don’t want to overload the main window
$code
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
For longer snippets, use: https://paste.mod.gg/$codegif
https://wpf-tutorial.com/usercontrols-and-customcontrols/creating-using-a-usercontrol/
Ah you are using avalonia not WPF
Well, same thing then
UserControl | Avalonia Docs
UserControl control is a ContentControl that represents a reusable collection of controls in a predefined layout.
Reddit
From the AvaloniaUI community on Reddit
Explore this post and more from the AvaloniaUI community
Appreciate it. I’ll have to do a bit of playing around with it but at least I now know the answer on how to do it 😁
Do you know if this works with tools such as
No worries I’ve made it work. Legendary bro. You’ve been a big help
$close
Use the /close command to mark a forum thread as answered