Try adding a reference to the namespace where you have the ItemsControl defined, just like you would with any other custom control you define on a page.
Let's say you defined it in the namespace "Exchange_S2".
If the above doesn't work, try the following, on top of the solution mentioned above: Add a reference in AssemblyInfo.cs [assembly: XmlnsDefinition("http://schemas.microsoft.com/client/2007", "Exchange_S2")]
If this post helped you, please mark it as answer! It helps other people too.
some supplenet info:
the WCFService represent the service WCF that is link to my project and SomethingXXX is class with [DataContract] attribute.
x:TypeArgument is about to specified the Generic Class in the UserControl xaml !
this don't run cause the file SomethingEdit.g.cs (the hidden file partial class) don't generate with the normal generic specification like this: SomethingEdit<WCFService.SomethingEO> !!
mchlSync
Star
14968 Points
2799 Posts
Re: Re: Silverlight User Control Inheritance
Aug 23, 2008 08:36 PM | LINK
If it's nested namespace, please check my reply in this post http://silverlight.net/forums/p/23213/83217.aspx#83217
Regards,
Michael Sync
Silverlight MVP
Blog : http://michaelsync.net
gabtub
Member
2 Points
1 Post
Re: Silverlight User Control Inheritance
Oct 29, 2008 12:39 PM | LINK
i just wondered if there's a fix now in the new version for these inheritance problems?
Isil
Member
40 Points
34 Posts
Re: Silverlight User Control Inheritance
Nov 25, 2008 02:25 PM | LINK
I'm still having problems with this.
I'm getting this exception:
System.Windows.Markup.XamlParseException occurred
that is related to this xaml:Message="Unknown Element: ItemControl. [Line: 7 Position: 375]"
LineNumber=7
LinePosition=375
StackTrace:
en System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
en Exchange_S2.EmptyItem.InitializeComponent()
en Exchange_S2.EmptyItem..ctor()
InnerException:
Roet
Member
221 Points
66 Posts
Re: Re: Silverlight User Control Inheritance
Nov 28, 2008 08:13 AM | LINK
Try adding a reference to the namespace where you have the ItemsControl defined, just like you would with any other custom control you define on a page.
Let's say you defined it in the namespace "Exchange_S2".
<exs2:ItemControl x:Class="Exchange_S2.EmptyItem"
xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006
xmlns:exs2="clr-namespace:Exchange_S2"
"clr-namespace:TodayIT.Avalanche2.Web.Controls.Basic mc:Ignorable="d"
MouseEnter="OnMouseEnter" MouseLeave="OnMouseLeave"
xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
MinWidth="110" MinHeight="110" Padding="0,0,0,0" Margin="10,10,10,10"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
d:DesignHeight="200" d:DesignWidth="200" Width="140" Height="140"
MaxWidth="300" MaxHeight="300">
..
</exs2:ItemControl>
Isil
Member
40 Points
34 Posts
Re: Re: Re: Silverlight User Control Inheritance
Dec 06, 2008 02:44 AM | LINK
Thank you very very much
That fixed my problems... but I don't know what I did, could someone explain me??
thank you!
talldaniel
Participant
1159 Points
648 Posts
Re: Re: Silverlight User Control Inheritance
Dec 06, 2008 04:01 AM | LINK
If you go through all of these contortions, it will likely be the case that when the next upgrade is released, the work arounds will bust.
wjchristenson2
Member
104 Points
51 Posts
Re: Re: Silverlight User Control Inheritance
Jan 22, 2009 01:39 AM | LINK
I've just blogged on how I got UserControl inheritance to work for me. Hope this helps:
http://www.mostlydevelopers.com/blog/post/2009/01/21/Silverlight-User-Control-Inheritance.aspx
A Mostly Developers Blogger
Please remember to click “Mark as Answer” on the post that helps you.
zuppaman
Member
28 Points
4 Posts
Re: Re: Silverlight User Control Inheritance
Mar 06, 2009 10:40 AM | LINK
I also encountered the same problem.
Like wjchristenson2 created a blog post about it.
You can solve this problem with two methods.
Creating a wrapper as discussed above our use the strategy pattern.
Check out the code at : http://www.lab101.be/2008/07/silverlight-usercontrol-inheritance/
PatriceSL
Member
2 Points
1 Post
Re: Re: Silverlight User Control Inheritance
Dec 08, 2009 12:36 PM | LINK
rapidly, here's my code :
namespace MyApp
{
public class BasePage : UserControl {...}
public class BaseEditPage<T>: BasePage where T: WCFService.EntityObject, new() {...}
public class SomethingEdit : BaseEditPage<WCFService.SomethingEO> {...}
}
I've no error with this code
BUT... my xaml don"t compile:
<my
:BaseEditPage x:Class="MyApp.SomethingEdit"x:TypeArguments="myWCF:SomethingEO"
xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation
xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
xmlns:d=http://schemas.microsoft.com/expression/blend/2008 xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006
xmlns:my="clr-namespace:MyApp;assembly=MyAppProject"
xmlns:myWCF="clr-namespace:WCFService;assembly=MyAppProject">
<my:BaseEditPage>
some supplenet info:
the WCFService represent the service WCF that is link to my project and SomethingXXX is class with [DataContract] attribute.
x:TypeArgument is about to specified the Generic Class in the UserControl xaml !
this don't run cause the file SomethingEdit.g.cs (the hidden file partial class) don't generate with the normal generic specification like this: SomethingEdit<WCFService.SomethingEO> !!
any help will be very great !!!
to read you,
Patrice
Tintin1983
Member
38 Points
98 Posts
Re: Silverlight User Control Inheritance
Jul 14, 2010 03:59 AM | LINK
Gees, it is 2010 now, and I am still getting the same bug in Silverlight 4.
Anyone know any update on this known issue?