![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | "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#) |
My System Specs![]() |
| | #2 (permalink) |
| | 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 |
My System Specs![]() |
| | #3 (permalink) |
| | 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 > > > |
My System Specs![]() |
| | #4 (permalink) |
| | 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 > > |
My System Specs![]() |
| | #5 (permalink) |
| | 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 > > > > > > > |
My System Specs![]() |