Unable to add ResourceDictionaries to AcropolisApplication.Resources
I want to include some resources at the application level like so:
<AcropolisApplication.Resources>
<Framework:ResourceDictionary>
<Framework:ResourceDictionary.MergedDictionaries>
<Framework:ResourceDictionary Source="/Resources/BrushResources.xaml"/>
</Framework:ResourceDictionary.MergedDictionaries>
</Framework:ResourceDictionary>
</AcropolisApplication.Resources>
But the compiler complains with the following message:
Error 20 The "MonikerCompileTask" task failed unexpectedly.
MS.Internal.Xaml.XamlException: Missing End Property Tag Line:11 Offset:4
at MS.Internal.Xaml.XamlException.Throw(XamlReaderContext ctx, String error)
at MS.Internal.Xaml.Parser.XamlParser.Parse_ENDTAG()
at MS.Internal.Xaml.Parser.XamlParser.P_PropertyCollection()
at MS.Internal.Xaml.Parser.XamlParser.ParseRule(Rule rule, Repeat repeat, String ruleName)
at MS.Internal.Xaml.Parser.XamlParser.P_Property()
at MS.Internal.Xaml.Parser.XamlParser.ParseRule(Rule rule, Repeat repeat, String ruleName)
at MS.Internal.Xaml.Parser.XamlParser.P_FullElement()
at MS.Internal.Xaml.Parser.XamlParser.ParseRule(Rule rule, Repeat repeat, String ruleName)
at MS.Internal.Xaml.Parser.XamlParser.P_Element()
at MS.Internal.Xaml.Parser.XamlParser.ParseRule(Rule rule, Repeat repeat, String ruleName)
at Microsoft.Acropolis.Design.XamlPropertyProvider.RegisterXaml(XmlReader xamlStream)
at Microsoft.Acropolis.Design.XamlPropertyProvider.Register(String fileName)
at Microsoft.Build.Tasks.Acropolis.MonikerCompileTask.RegisterFile(String fileName)
at Microsoft.Build.Tasks.Acropolis.MonikerCompileTask.Execute()
at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult) Frontend
-
Any clue why?
Thanks,
Pavan
You can add a custom theme to your Acropolis Application and merge your resources into the theme:
XAML (note that I'm merging Acropolis theme into my custom theme, because I don't want to recreate all the theme from scratch).
Code Snippet
<
acrowin:Theme x:Class="AcropolisApp23.MyCustomTheme" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:acrowin="clr-namespace:Microsoft.Acropolis.Windows;assembly=Microsoft.Acropolis.Windows" xmlns:acrothemes="clr- namespace:Microsoft.Acropolis.Windows.Themes;assembly=Microsoft.Acropolis.Windows.Themes" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <
acrowin:Theme.MergedDictionaries> <acrothemes:AcropolisTheme/> <</< FONT>acrowin:Theme.MergedDictionaries>
</
acrowin:Theme> Code-behind (include the call to InitializeComponent())
Code Snippet
using
Microsoft.Acropolis.Windows; namespace
AcropolisApp23 {
public partial class MyCustomTheme : Theme {
public MyCustomTheme() {
InitializeComponent();
}
}
}
Register your theme in the Application constructor:
Code Snippet
public Application()
{
RegisterThemeAssembly(typeof(MyCustomTheme));
InitializeComponent();
}
And finally, specify your theme in the Applicationd definition:
Code Snippet
<
AcropolisApplication x:Class="AcropolisApp23.Application" ......
Theme
="AcropolisApp23.MyCustomTheme">.... Alex,
Reason for asking my question was my resource dictionaries have UI Styles, colors as well as application data (Typical resource dictionary of WPF app). This application data are DPs which I am using and updating throughout application kind of maintain current state of application.
If I create a theme with my application data (Styles as well), this business objects specific to this application will be unnecessary there in another application where I want to reuse this theme (Colors and Styles only).
This was the reason for asking this question. Please suggest and do let me know if you need more detail.
Thanks
AllTec