Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit AG_E_PARSER_BAD_TYPE when extending control
5 replies. Latest Post by toppless on June 30, 2009.
(0)
toppless
Member
1 points
12 Posts
06-30-2009 8:00 AM |
Hi,
i'm trying to extend a button to enrich it with my own functionality. But running my test application produces AG_E_PARSER_BAD_TYPE exception.Code snippets:
MainControl.xaml.cs
using System.Windows.Controls; namespace TestApp { public partial class MainControl : UserControl { public MainControl() { // Required to initialize variables InitializeComponent(); } } }
MainControl.xaml
<
MyButton.cs
using System.Windows.Controls; namespace TestApp { partial class MyButton : Button { public MyButton() : base() { } } }
Can somebody tell me what is going wrong?
THX
Roet
211 points
65 Posts
06-30-2009 8:10 AM |
Why did you make the MyButton class partial, and not public?
varshavmane
Contributor
6733 points
1,580 Posts
06-30-2009 8:16 AM |
Check this post :
http://silverlight.net/forums/t/65077.aspx
06-30-2009 8:22 AM |
By the way, did you have quotes around the xmlns?
xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
should be:
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
06-30-2009 8:27 AM |
Thanks "internal" was a copy & paste mistake.
Originally i was trying to take a Silverlight Button source code and try to rename the types. But somehow i stuck on the ResourceDictionary. Could you give me advice, which part of the generic.xml should i take an modify in order to get it workin as my own "MyButton"?
And yes, i have quotes on xmlns. Editor just kicked them out.
06-30-2009 8:31 AM |
Got it working. Had a typo in the ControlTemplate/TargetType definition.