how to handle App.Xaml file when converting WPF application to Hosted WPF control

May 4, 2011 at 1:17 PM

Hi,

I have a standalone WPF application which I am trying to convert it as hosted WPF control inside CCA. In current App.xaml for the application has some items under app.resource. Since we convert it to a DLL. The App.XAML will not associate with my original WPF application now. How and where should I handle those app.resource entries?

Thank you.

JZ

May 4, 2011 at 1:57 PM

Easiest way to handle that is to is to create a Resource Dictionary with the resources you need and include it in your control, For backward compatibility you can also make those resources available via the app.xaml in your main app.

Here are a few links on how that stuff works:
http://msdn.microsoft.com/en-us/library/ms750613.aspx - Resources Overview
http://msdn.microsoft.com/en-us/library/aa350178.aspx - Merged Resource Dictionary’s

Mattb-msft

May 4, 2011 at 2:18 PM

Hi Matt,

Thanks for quick response.

I have the dilemma here.

If it puts on main app, it breaks the separation between host and hosted controls.

If it is put on one of the controls, it will not available for other controls or It need add for each of the controls. And there have more than 30 of them.

But if those are only two options we have, I will just need to weigh them out.

Thanks.

JZ

 

May 4, 2011 at 3:08 PM
Put the resources in a separate assembly and reference that resource assembly from each control that requires it. You can then add a reference to the merge dictionary via Uri in the controls that need it .

Mattb

Sent from my Windows Phone

From: jz123
Sent: Wednesday, May 04, 2011 9:18 AM
To: mattb-msft@hotmail.com
Subject: Re: how to handle App.Xaml file when converting WPF application to Hosted WPF control [crmcca:256315]



> From: jz123
>
> Hi Matt,Thanks for quick response.I have the dilemma here.If it puts on main app, it breaks the separation between host and hosted controls.If it is put on one of the controls, it will not available for other controls or It need add for each of the controls. And there have more than 30 of them.But if those are only two options we have, I will just need to weigh them out.Thanks.JZ
>
>
May 6, 2011 at 2:11 PM

Thanks for the sugesstion, Matt. Looking into CCA R2 now.