Hi,
I am writing a XAML/Net3 baed application and I wish to create my own canvas that has some base methods that I need.
I created a new class:
class MyCanvas : Canvas
{
void MyCustomFunc()
{
// Do my custom stuff here
// eg: MyCanvas.ResizeFullScreen();
}
}
I have a GUI element
<
Canvasx:Class="MYApp.UI.SomeScreen"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"Background="Transparent">
</
Canvas>
which generates an error:
partial declarations of 'MYApp.UI.Logo' must not specify different base classes
So I changed the XAML to:
<MyCanvasx:Class="MYApp.UI.SomeScreen"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"Background="Transparent">
</MyCanvas
>
Which tells me there is no MyCanvas in the XML namespace.
Then I tried to create a <Style> tag to define this canvas type to the XML namespace and I find that the type Canvas does not support Style tag the way a UserControl does.
My question is: Is it indeed possible to derive your own Canvas type? If so how?
Thanks!