All this XML stuff these days has its advantages but as primarily a Windows 
Forms developer starting to work on WP7 apps and such I have to say I'm 
severely disappointed at all the design time controls we are losing.  I've 
spent many hours in the past poring over config files for remoting and similar 
things only to eventually give up on it and do it all via code because I just 
couldn't figure out why it wasn't working (and I'm already finding myself doing 
the same thing in WP7 to an extent.)  There needs to be better error handling 
on these XML files to catch this sort of stuff upfront, cause I bet if you were 
doing this in WinForms it would have fixed that for you.  Of course they tell 
us this stuff is coming, but I don't like the chances it will ever get to the 
level WinForms is now, cause there's XML config stuff that's been around in VS 
for quite some time (excluding XAML) that still doesn't have editors/validation 
to stop these sorts of silly time consuming errors.

Regards,

Nathan Keir
Systems Analyst
John Deere Financial Limited A.C.N. 078 714 646
Australian Credit Licence Number 391484
Incorporated in Queensland, Australia
166-170 Magnesium Drive, Crestmead, QLD, Australia 4132
PO Box 1544, Browns Plains BC, QLD, Australia 4118
+61 7 3802 3274 (office)
+61 7 3802 3142 (fax)
[email protected]<mailto:[email protected]>
www.JohnDeere.com.au<http://www.johndeere.com.au/>
CONFIDENTIALITY. This message, including attachments, may be confidential. If 
you believe this message was sent to you in error, do not read it. If you are 
not the intended recipient, any retention, dissemination, distribution, or 
copying of this communication is strictly prohibited. Please reply to the 
sender that you have received the message in error and delete it.

From: [email protected] [mailto:[email protected]] On 
Behalf Of Greg Keogh
Sent: Monday, 26 March 2012 9:28 AM
To: 'ozDotNet'
Subject: ResourceDictionary gotcha

Folks, I modified a WPF app recently to use 
ResourceDictionary.MergedDictionaries in most the controls so I could put 
shared resources and styles in a shared library project. So I have lines like 
this as I described last week:

<ResourceDictionary>
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary 
Source="FooApp.Common;Component/CommonDictionary.xaml" />
        ...
    </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

There is something subtly and terribly wrong with the Source line above (can 
anyone see it immediately?). In VS2010 and Blend 4 you can design controls 
okay, but when they are nested the designers fail and tell you the resource is 
not found. This problem was so irritating that I knocked-up a mini solution to 
demonstrate it to ask the group if anyone could figure out what was wrong. 
Well, the mini sample worked.

So after days of puzzling over why the big app worked and the mini one didn't, 
I stumbled across the difference ... You have to put a leading / before the 
resource Uri like Source="/FooApp..." I see that online articles do the correct 
thing, but I accidentally forgot the / and dug a hole for myself. It's terrible 
that such a tiny mistake can waste so many man-hours.

Greg


Reply via email to