From what I know, when creating a custom control on visual studios, it comes with a class file and a resource dictionary located in Themes/Generic.xaml.
I want to see if there is a way to avoid having multiple files and create one UserControl so I can just have one file with the design on the .xaml side and .xaml.cs for the codebehind.


I know I can create a usercontrol called MyCustomControl but of course it won’t let me target it like the code I have below so I have to set the target type to UserControl. The problem is that on MainWindow.xaml where I call MyCustomControl, if I have a style that I want to add to my custom control, it will override everything such as the toggle button and border from the code below.
So is there a way to be able to achieve this? I can provide more info if needed.
no comments yet
Be the first to share what you think!
C# devs
null reference exceptions

source