C
C#6mo ago
YouWouldnt

✅ 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
Denis
Denis6mo ago
You create your own usercontrols Or custom controls And you'd use them like your regular wpf controls in the main window
YouWouldnt
YouWouldnt6mo ago
Sorry can you expand on this a little bit?
YouWouldnt
YouWouldnt6mo ago
Here’s what the project is. I just don’t want to overload the main window
No description
No description
Denis
Denis6mo ago
$code
MODiX
MODiX6mo ago
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/
Denis
Denis6mo ago
$codegif
Denis
Denis6mo ago
Denis
Denis6mo ago
UserControl | Avalonia Docs
UserControl control is a ContentControl that represents a reusable collection of controls in a predefined layout.
YouWouldnt
YouWouldnt6mo ago
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
<Canvas> Some Code </Canvas>
<Canvas> Some Code </Canvas>
No worries I’ve made it work. Legendary bro. You’ve been a big help
Denis
Denis6mo ago
$close
MODiX
MODiX6mo ago
Use the /close command to mark a forum thread as answered