This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi There I've noticed something funny, and was wondering if you can reproduce this or shed any light. I've got a PropertyGrid styled with TreeView + GroupStyle control template using Expanders. When I load a form once, the component displays correctly. Weirdly though, when I create more instances of the same form - the PropertyGrid isn't there any more? If I leave out the GroupStyle template, everything appears to be ok, so I presume it has something to do with this. Strange though that it works once, but only once. I've attached a small project to illustrate. The project needs a reference to the component obviously, and the sample data library. Oh, and I'm using the 20080425 Nightly Build. Regards, Justin.
|
|
|
Hi Justin, This has something to do with the way WPF instantiates inline resources. If you extract your Style declaration to be a separate resource in your ResourceDictionary, and reference it as <GroupStyle ContainerStyle="{StaticResource MyGroupStyle}" />, that fixes the problem. I'm afraid this is a bit of a "cargo cult programming" answer rather than explaining what's happening under the surface to cause the odd behaviour. I've seen this difference between inlined and resource-based objects (e.g. styles and templates) before but haven't delved sufficiently into it to know why it happens or whether there is a way to get the expected behaviour while still keeping the inline declaration. Sorry! |
|
|
thanks for the tip - your workaround did the trick. |
|