![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | "nested" XAML ? I would ideally like to do the equivalent of #include in a markup file, to shop my applications resources becoming unwieldy. Is there a way to do it ? For example ----MyApp.xaml-------- .... <somehow include "MyStyles.xaml"> <Somehow include "MyControlTemplates.xaml"> .... -- Griff (trying to make an industrial UI with XAML/WPF/c#) |
| | #2 (permalink) |
| Guest | Re: "nested" XAML ? Griff wrote: > I would ideally like to do the equivalent of #include in a markup > file, to shop my applications resources becoming unwieldy. Is there a > way to do it ? You can include external ResourceDictionary like so: <ResourceDictionary Source="MyResources.xaml"/> Where the file MyResources.xaml is part of your build and is marked as type "Content" so it is built into the assembly correctly. HTH, Drew |
| | #3 (permalink) |
| Guest | Re: "nested" XAML ? I'm still not sure I understand. are you saying that - in MyApp.xaml I would put <ResourceDictionary Source="myStyles.xaml"> - and Styles.xaml would look like <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/avalon/2005" xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005"> .... <Style ...../> ... </ResourceDictionary> So far I have not managed to get any sort of permutation working. I get clean compile then runtime error such as "Cannot assign value 'Styles.xaml' to property 'System.Windows.ResourceDictionary.Source' -- Griff (trying to make an industrial UI with XAML/WPF/c#) "Drew Marsh" wrote: > Griff wrote: > > > I would ideally like to do the equivalent of #include in a markup > > file, to shop my applications resources becoming unwieldy. Is there a > > way to do it ? > > You can include external ResourceDictionary like so: > > <ResourceDictionary Source="MyResources.xaml"/> > > Where the file MyResources.xaml is part of your build and is marked as type > "Content" so it is built into the assembly correctly. > > HTH, > Drew > > > |
| | #4 (permalink) |
| Guest | Re: "nested" XAML ? Griff wrote: > I'm still not sure I understand. > > are you saying that - in MyApp.xaml I would put Yes, you can put it in MyApp.xaml or any other place that takes a ResourceDictionary instance... > <ResourceDictionary Source="myStyles.xaml"> > > - and Styles.xaml would look like > <ResourceDictionary > xmlns="http://schemas.microsoft.com/winfx/avalon/2005" > xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005"> > ... > <Style ...../> > .. > </ResourceDictionary> That is also correct, sorry I left that part out. > So far I have not managed to get any sort of permutation working. > > I get clean compile then runtime error such as > "Cannot assign value 'Styles.xaml' to property > 'System.Windows.ResourceDictionary.Source' Hmm... yeah this is starting to ring a bell now, maybe I'm forgetting something. Did you also select to copy the Styles.xaml to the build directory? I think that might be the part I was missing. HTH, Drew |
| | #5 (permalink) |
| Guest | Re: "nested" XAML ? See http://www.designerslove.net/2005/09...es-use-em.html for an example. -- -Nick Kramer [MSFT] http://blogs.msdn.com/nickkramer --- This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm "Drew Marsh" <drub0y@hotmail.no.spamming.com> wrote in message news:f01844f1e7c5c8c7e669faec2982@msnews.microsoft.com... > Griff wrote: > >> I'm still not sure I understand. >> >> are you saying that - in MyApp.xaml I would put > > Yes, you can put it in MyApp.xaml or any other place that takes a > ResourceDictionary instance... > >> <ResourceDictionary Source="myStyles.xaml"> >> >> - and Styles.xaml would look like >> <ResourceDictionary >> xmlns="http://schemas.microsoft.com/winfx/avalon/2005" >> xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005"> >> ... >> <Style ...../> >> .. >> </ResourceDictionary> > > That is also correct, sorry I left that part out. > >> So far I have not managed to get any sort of permutation working. >> >> I get clean compile then runtime error such as >> "Cannot assign value 'Styles.xaml' to property >> 'System.Windows.ResourceDictionary.Source' > > Hmm... yeah this is starting to ring a bell now, maybe I'm forgetting > something. Did you also select to copy the Styles.xaml to the build > directory? I think that might be the part I was missing. > > HTH, > Drew > > |
| | #6 (permalink) |
| Guest | Re: "nested" XAML ? I started originally with the example from http://www.designerslove.net/2005/09...es-use-em.html But I find that when I do exactly that either - I designate the separate file as "content" (and copy to output dir) and get the runtime error Error at element 'ResourceDictionary' in markup file 'myapp.xaml' : Cannot assign value 'Colours1.xaml' to property 'System.Windows.ResourceDictionary.Source'.. or - I designate the separate file as "compile" and get the following compile error for my separate resource dictionary file: A namespace does not directly contain members such as fields or methods or - I designate the separate file as "page" and then start getting different runtime errors concerning bits of my myapp.xaml that previously worked. (For example, not being allowed <RowDefinition /> inside a grid inside a control template, though previously this was accepted). I note that the "Designers Love .NET" example claimed to be compatible with Sept CTP. Maybe this all got broken in Nov ? -- Griff (trying to make an industrial UI with XAML/WPF/c#) "Nick Kramer [MSFT]" wrote: > See http://www.designerslove.net/2005/09...es-use-em.html > for an example. > > -- > -Nick Kramer [MSFT] > http://blogs.msdn.com/nickkramer > > --- > This posting is provided "AS IS" with no warranties, and confers no rights. > Use of included script samples are subject to the terms specified at > http://www.microsoft.com/info/cpyright.htm > > > "Drew Marsh" <drub0y@hotmail.no.spamming.com> wrote in message > news:f01844f1e7c5c8c7e669faec2982@msnews.microsoft.com... > > Griff wrote: > > > >> I'm still not sure I understand. > >> > >> are you saying that - in MyApp.xaml I would put > > > > Yes, you can put it in MyApp.xaml or any other place that takes a > > ResourceDictionary instance... > > > >> <ResourceDictionary Source="myStyles.xaml"> > >> > >> - and Styles.xaml would look like > >> <ResourceDictionary > >> xmlns="http://schemas.microsoft.com/winfx/avalon/2005" > >> xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005"> > >> ... > >> <Style ...../> > >> .. > >> </ResourceDictionary> > > > > That is also correct, sorry I left that part out. > > > >> So far I have not managed to get any sort of permutation working. > >> > >> I get clean compile then runtime error such as > >> "Cannot assign value 'Styles.xaml' to property > >> 'System.Windows.ResourceDictionary.Source' > > > > Hmm... yeah this is starting to ring a bell now, maybe I'm forgetting > > something. Did you also select to copy the Styles.xaml to the build > > directory? I think that might be the part I was missing. > > > > HTH, > > Drew > > > > > > > |
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Internet explorer "stuck" trying to display any XAML file | Sergey Aldoukhov | Avalon | 0 | 01-24-2007 07:17 PM |
| Interpreter demo loading "loose Xaml" interface | pfisk | Avalon | 0 | 05-06-2006 03:28 PM |
| Interpreter demo loading "loose Xaml" interface | pfisk | Avalon | 0 | 05-06-2006 03:24 PM |
| Interpreter demo loading "loose Xaml" interface. | pfisk | Avalon | 0 | 05-06-2006 03:21 PM |
| Can't view xaml files in IE, XamlViewer.xbap is "not trusted" | news.microsoft.com | Avalon | 2 | 04-26-2006 10:00 AM |