<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: WPF Control Inheritance With Generics</title>
	<atom:link href="http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/feed/" rel="self" type="application/rss+xml" />
	<link>http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/</link>
	<description>C#, .NET, Ruby, Rails, book reviews, mind hacks, Wing Chun and the occasional personal bit.</description>
	<lastBuildDate>Fri, 18 May 2012 08:47:53 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Soumow</title>
		<link>http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/#comment-19540</link>
		<dc:creator>Soumow</dc:creator>
		<pubDate>Wed, 03 Mar 2010 09:32:56 +0000</pubDate>
		<guid isPermaLink="false">http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/#comment-19540</guid>
		<description>Hello
I tried it with Visual Studio 2008 SP1 and Visual Studio 2010 RC and it doesn&#039;t work.
plz i need help.</description>
		<content:encoded><![CDATA[<p>Hello<br />
I tried it with Visual Studio 2008 SP1 and Visual Studio 2010 RC and it doesn't work.<br />
plz i need help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrice</title>
		<link>http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/#comment-17780</link>
		<dc:creator>Patrice</dc:creator>
		<pubDate>Fri, 05 Feb 2010 09:07:50 +0000</pubDate>
		<guid isPermaLink="false">http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/#comment-17780</guid>
		<description>hello James,

I&#039;m not sure to understand correctly your answer.

Here what I done:
My Application is already running with 3-layer for ASP.NET 3.5 and AJAX (UI, BLL, DAL).
To use my BLL with Silverlight, apparently, I must use a layer in addition: service web layer (I do it via WCF) so I write a WCF Service between my UISilverlight and my existing BLL.

I put attribute [DataMember] on all the properties of my entityobjects in my BLL.
So the WCF Service let me (in the UI) accessed to my entity objects.
Then, I decided to use this entityobject as object for my generic class (see mail above).

I write the inheritance code (see the mail above), no compilation problem.
I write simultaneously the xaml with special xmlns for my WCF object and the &quot;x:TypeArgument&quot;... 
If I had a good understanding of the process, this tag is use to specify the generic class object. 

Apparently the hidden file &quot;xxxx.g.cs&quot; isn&#039;t created with the generic inheritance but only with my baseClass without generic.

So a conflit appears in the partial xaml code because my partial class in codebehind declare a generic class ans the same partial class in the&quot;xxxxx.g.cs&quot; file declare only the class without inheritance.

Now that I presented my problem. What is for you, the best solution to resolve this ?
About the &quot;change events&quot; that you tell in your mail, how such a thing can be done with my project ? What do I need to change ? 

To read you.
Patrice</description>
		<content:encoded><![CDATA[<p>hello James,</p>
<p>I'm not sure to understand correctly your answer.</p>
<p>Here what I done:<br />
My Application is already running with 3-layer for ASP.NET 3.5 and AJAX (UI, BLL, DAL).<br />
To use my BLL with Silverlight, apparently, I must use a layer in addition: service web layer (I do it via WCF) so I write a WCF Service between my UISilverlight and my existing BLL.</p>
<p>I put attribute [DataMember] on all the properties of my entityobjects in my BLL.<br />
So the WCF Service let me (in the UI) accessed to my entity objects.<br />
Then, I decided to use this entityobject as object for my generic class (see mail above).</p>
<p>I write the inheritance code (see the mail above), no compilation problem.<br />
I write simultaneously the xaml with special xmlns for my WCF object and the "x:TypeArgument"...<br />
If I had a good understanding of the process, this tag is use to specify the generic class object. </p>
<p>Apparently the hidden file "xxxx.g.cs" isn't created with the generic inheritance but only with my baseClass without generic.</p>
<p>So a conflit appears in the partial xaml code because my partial class in codebehind declare a generic class ans the same partial class in the"xxxxx.g.cs" file declare only the class without inheritance.</p>
<p>Now that I presented my problem. What is for you, the best solution to resolve this ?<br />
About the "change events" that you tell in your mail, how such a thing can be done with my project ? What do I need to change ? </p>
<p>To read you.<br />
Patrice</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/#comment-15758</link>
		<dc:creator>James</dc:creator>
		<pubDate>Tue, 08 Dec 2009 23:15:36 +0000</pubDate>
		<guid isPermaLink="false">http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/#comment-15758</guid>
		<description>Hi Patrice, if the EntityObject is just a plain .net object, even if it has been generated, and it has properties, it should work OK. However, you won&#039;t have change events or similar, so won&#039;t be able to reflect changes in the object&#039;s data after initial bind. Rather than using the WCF service objects, you may want to introduce a domain layer that you control, and mapping in between. Your domain layer could then include change event notification for example, and decouple (somewhat) from changes in the services.
James</description>
		<content:encoded><![CDATA[<p>Hi Patrice, if the EntityObject is just a plain .net object, even if it has been generated, and it has properties, it should work OK. However, you won't have change events or similar, so won't be able to reflect changes in the object's data after initial bind. Rather than using the WCF service objects, you may want to introduce a domain layer that you control, and mapping in between. Your domain layer could then include change event notification for example, and decouple (somewhat) from changes in the services.<br />
James</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrice BIRROCHON</title>
		<link>http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/#comment-15734</link>
		<dc:creator>Patrice BIRROCHON</dc:creator>
		<pubDate>Tue, 08 Dec 2009 09:00:35 +0000</pubDate>
		<guid isPermaLink="false">http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/#comment-15734</guid>
		<description>I refined my question. (some code disapear in my comment when i &#039;ve posted on your site ??)

is it possible to make an EntityObjet from a WCF Service to a &quot;x:TypeArgument&quot; in the xaml ?

to read you,
Patrice</description>
		<content:encoded><![CDATA[<p>I refined my question. (some code disapear in my comment when i 've posted on your site ??)</p>
<p>is it possible to make an EntityObjet from a WCF Service to a "x:TypeArgument" in the xaml ?</p>
<p>to read you,<br />
Patrice</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrice BIRROCHON</title>
		<link>http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/#comment-15733</link>
		<dc:creator>Patrice BIRROCHON</dc:creator>
		<pubDate>Tue, 08 Dec 2009 08:56:49 +0000</pubDate>
		<guid isPermaLink="false">http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/#comment-15733</guid>
		<description>hello, very interesting example.
in my case, I have somes baseclass generic like this:

public class BaseClass: UserControl
{...}

public class BaseEditClass: BaseClass where T:
WCFService.EntityObj, new()
{...}

public class SomethingEdit : BaseEditClass
{...}

how can i declare my UserControl XAML ? Do you have an idea on this ? or is it impossible to declare a xaml like this:




Thanks in advance for your answer.
Patrice</description>
		<content:encoded><![CDATA[<p>hello, very interesting example.<br />
in my case, I have somes baseclass generic like this:</p>
<p>public class BaseClass: UserControl<br />
{...}</p>
<p>public class BaseEditClass: BaseClass where T:<br />
WCFService.EntityObj, new()<br />
{...}</p>
<p>public class SomethingEdit : BaseEditClass<br />
{...}</p>
<p>how can i declare my UserControl XAML ? Do you have an idea on this ? or is it impossible to declare a xaml like this:</p>
<p>Thanks in advance for your answer.<br />
Patrice</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: M. Jahedbozorgan</title>
		<link>http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/#comment-10615</link>
		<dc:creator>M. Jahedbozorgan</dc:creator>
		<pubDate>Sun, 08 Mar 2009 15:18:44 +0000</pubDate>
		<guid isPermaLink="false">http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/#comment-10615</guid>
		<description>Hi,
In your example, can the base control be a partial class? (I want the second part be a .xaml file)</description>
		<content:encoded><![CDATA[<p>Hi,<br />
In your example, can the base control be a partial class? (I want the second part be a .xaml file)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tracy</title>
		<link>http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/#comment-10488</link>
		<dc:creator>Tracy</dc:creator>
		<pubDate>Tue, 03 Mar 2009 18:32:19 +0000</pubDate>
		<guid isPermaLink="false">http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/#comment-10488</guid>
		<description>OOPS!  I mean to say when I change from 

public partial class BaseUserControl : UserControl

TO 
public partial class BaseUserControl : UserControl where T : IPresenter

I receive an error.  I fiddled with removing partial but still get errors.

Any help is welcome.

Any help would be wildly appreciated.</description>
		<content:encoded><![CDATA[<p>OOPS!  I mean to say when I change from </p>
<p>public partial class BaseUserControl : UserControl</p>
<p>TO<br />
public partial class BaseUserControl : UserControl where T : IPresenter</p>
<p>I receive an error.  I fiddled with removing partial but still get errors.</p>
<p>Any help is welcome.</p>
<p>Any help would be wildly appreciated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tracy</title>
		<link>http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/#comment-10487</link>
		<dc:creator>Tracy</dc:creator>
		<pubDate>Tue, 03 Mar 2009 17:52:53 +0000</pubDate>
		<guid isPermaLink="false">http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/#comment-10487</guid>
		<description>Can I send you a quick sample that I am having troubles with?  I have followed this model...but when I change the signature on the BaseUserControl 
from :
public  partial class BaseUserControl : UserControl


TO 

public partial class BaseUserControl : UserControl where T : IPresenter

I receive the following error:

The name &#039;InitializeComponent&#039; does not exist in the current context	

C:\_SOURCE_\NewGenericsTWO\BaseUserControl.xaml.cs	

It is probably something very simple...  Can you help?</description>
		<content:encoded><![CDATA[<p>Can I send you a quick sample that I am having troubles with?  I have followed this model...but when I change the signature on the BaseUserControl<br />
from :<br />
public  partial class BaseUserControl : UserControl</p>
<p>TO </p>
<p>public partial class BaseUserControl : UserControl where T : IPresenter</p>
<p>I receive the following error:</p>
<p>The name 'InitializeComponent' does not exist in the current context	</p>
<p>C:\_SOURCE_\NewGenericsTWO\BaseUserControl.xaml.cs	</p>
<p>It is probably something very simple...  Can you help?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/#comment-9828</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Wed, 14 Jan 2009 15:38:54 +0000</pubDate>
		<guid isPermaLink="false">http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/#comment-9828</guid>
		<description>Very good, straight to the point, article about how to use inheritance and generics with WPF.

After a few years web programming I&#039;m back on desktop programming and a lot of things have changed. This post was very helpful starting with WPF on enterprise level.</description>
		<content:encoded><![CDATA[<p>Very good, straight to the point, article about how to use inheritance and generics with WPF.</p>
<p>After a few years web programming I'm back on desktop programming and a lot of things have changed. This post was very helpful starting with WPF on enterprise level.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan</title>
		<link>http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/#comment-9712</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Wed, 31 Dec 2008 15:10:37 +0000</pubDate>
		<guid isPermaLink="false">http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/#comment-9712</guid>
		<description>You rock dude! Thats exactly what I was looking for. Thank you so much ;)</description>
		<content:encoded><![CDATA[<p>You rock dude! Thats exactly what I was looking for. Thank you so much <img src='http://jamescrisp.org/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Todd Beaulieu</title>
		<link>http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/#comment-8694</link>
		<dc:creator>Todd Beaulieu</dc:creator>
		<pubDate>Fri, 12 Sep 2008 20:23:44 +0000</pubDate>
		<guid isPermaLink="false">http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/#comment-8694</guid>
		<description>I&#039;ve found little on this topic. Thanks for the post. I must be thick, but I just can&#039;t get this going. using VS 2008/3.5.

I have a ViewModel that I need to pass into a user control. No luck so far.

For starters, as soon as I add the generic construct, the InitializeComponent method disappears.

Assuming I can get this working, I was going to place an instance of each control, bound to various entities, on seperate PAGE objects that I am showing in a frame. It looks like I&#039;d need to put them as root elements, though. I wonder if I can have a xaml file with just an instance of this UC with the x:TypeArguments specified and point a frame to it?</description>
		<content:encoded><![CDATA[<p>I've found little on this topic. Thanks for the post. I must be thick, but I just can't get this going. using VS 2008/3.5.</p>
<p>I have a ViewModel that I need to pass into a user control. No luck so far.</p>
<p>For starters, as soon as I add the generic construct, the InitializeComponent method disappears.</p>
<p>Assuming I can get this working, I was going to place an instance of each control, bound to various entities, on seperate PAGE objects that I am showing in a frame. It looks like I'd need to put them as root elements, though. I wonder if I can have a xaml file with just an instance of this UC with the x:TypeArguments specified and point a frame to it?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

