Sounds like a job for T4 Paul. :)
Prompted by your question, I've incorporated the generation of pack
URIs for all XAML files into the T4 Metadata generation stuff I did a
while ago. Seems to be working ok. I just blogged about it:
http://danielvaughan.orpius.com/post/Using-T4-to-Generate-Pack-URIs-for-XAML-Files.aspx
On Nov 24, 1:26 pm, Paul Stovell <
p...@paulstovell.com> wrote:
> Hi all,
>
> I'm trying to make a bit of code like this work:
>
> Type pageType = typeof(Page1);
> Uri pageUri = GetPackUriForType(pageType);
>
> The problem is I can't find any way of getting the URI from a type.
>
> In the .g.cs files that are built, the URI is embedded as part of the
> InitializeComponent:
>
> public void InitializeComponent() {
> if (_contentLoaded) {
> return;
> }
> _contentLoaded = true;
> System.Uri resourceLocater = new System.Uri("*
> /PageCollection;component/pages/page1.xaml*", System.UriKind.Relative);