I would like to add one more contribution, which, in my opinion, may be useful for others who are faced with my same situation.
Another possible solution, which, in my opinion, is suitable if the controls you are going to create are not particularly complex, is to create a basic User Control containing the common functions that you want to share: such control will be completely written in C #. In fact, this allows you to inherit user controls consisting of XAML and code. In XAML of an inherited control instead
<UserControl> ... </UserControl>
You will have
<MyProject: MyBaseControl x:Class="MyProject.MyExtendedControl"> ... </MyProject: MyBaseControl>
and then in the code behind you also need to specify the following:
class MyExtendedControl : MyBaseControl
Hope this helps.
Tilvia
source share