For a while I’ve been getting some nasty warnings and errors from Visual Studio 2012 with my SDK projects when adding references to the Infor resources. You get the message ‘the resource “styleListView” could not be resolved’ and none of my controls in the Visual Studio 2012 designer would be skinned with the Smart Office theme.
Even worse, I’d get some errors in some instances (such as referencing the StatusBar). But I’d compile and the feature would run without issue and be nicely skinned.
Looks pretty ugly doesn’t it?
I’d had a very casual look in to the issue and had come across a known bug in Visual Studio so didn’t really look in to it much further, until the other day. It just started to bug me, so it was time to investigate.
First thing I did was create a brand new project, just to verify the ones that I had been working hadn’t been messed up with my meddling or fat-fingered typing.
I then added a listview and made reference to the Smart Office styleListView, I added the appropriate assembly references in to the .xaml. Same issue.
As a matter of last resort (desperate times call for desperate measures and all that :-)), I scanned the release notes for the SDK and the DevelopersGuide pdf for anything that would give me a clue as to what I was doing wrong. And nada.
I compiled the samples in the SDK under Visual Studio 2012 and they were skinned correctly. Very odd.
I look at the references and all of mine seem identical. I have a read through a couple of manuals I own on C# and they only confirm that what I am doing is largely correct.
So…at a loss, I go back to the absolute basics – no assumptions…
As you’re probably aware, you can assign a resource dictionary to the application. I hadn’t bothered looking at that as it is generated by the template we use to create our LSOSDK project.
So I look in to the samples LawsonClient project App.xaml and see this:
And I take a look at my fresh projects LawsonClient App.xaml and see this:
So, I add the ui:MangoApplication.Resources to my LawsonClient App.xaml like so:
And then clean my solution, and finally rebuild and all of the errors go away. Applying the extra information to my original project in Visual Studio 2012 designer everything looks much better!
Pingback: Unresolvable XAML references | Potato IT