Reputation: 933
I'm trying to do a simple thing but without success.
I need to extend from a button and create a custom button with custom proprieties (nothing to do with styles or visual settings).
I have created a simple class in the namespace AppEdil.UI
.
namespace AppEdil.UI
{
class MainMenuButton : Button
{
public int MenuTabIndex { get; set; }
public MainMenuButton()
{
}
}
}
Then in the window xaml i added the namespace:
xmlns:ui = "clr-namespace:EdilCaselle.UI"
And then i added the buttons:
<!-- Clients -->
<ui:MainMenuButton Style="{StaticResource mainMenuButtonStyle}" Width="70" Height="60" Margin="0, 0, 5, 0" HorizontalAlignment="Left" VerticalAlignment="Center">
<ui:MainMenuButton.Content>
<StackPanel>
<Image Source="Images/Big_Icons/user.png" Height="32" Width="32"/>
<TextBlock>Clienti</TextBlock>
</StackPanel>
</ui:MainMenuButton.Content>
</ui:MainMenuButton>
But i get different errors:
MainMenuButton does not exist in the AppEdil.UI namespace
MainMenuButton class not found and that i must see if i missed a reference or an assembly
MainMenuButton is not supported in a WPF
application (Wtf?)
Can you help me?
Upvotes: 1
Views: 83
Reputation: 6444
You're missing the public keyword from your class. Add that and it will work! :)
Upvotes: 2