When I changed this:
public partial class FrmCategories : UserControl
to this:
public partial class FrmCategories : MyUserControl
Where MyUserControl
inherits from UserControl
.
I got this error:
Error 2 Partial declarations of 'WpfTest.FrmCategories' must not specify different base classes
\Projects\WpfTest\WpfTest\FrmCategories.xaml.cs 21 26 WpfTest
XAML:
<UserControl x:Class="WpfTest.FrmCategories"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:we="clr-namespace:WpfTest"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" Background="Azure" Height="131" Width="229">
<StackPanel Margin="5,24,5,0" Name="catFrm" Height="75" VerticalAlignment="Top">
I'm beginning WPF (as the name of the project implies), so I expect a trivial error here
You need to change the root element of the XAML file:
<we:MyUserControl x:Class="WpfTest.FrmCategories"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:we="clr-namespace:WpfTest"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" Background="Azure" Height="131" Width="229">
<StackPanel Margin="5,24,5,0" Name="catFrm" Height="75" VerticalAlignment="Top">
</we:MyUserControl>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With