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, |
|
|
Regarding the first issue, this is a WPF behaviour to do with the default display of objects. By default, WPF calls ToString() on an object of class or struct in order to present it; however it seems that for interface types this does not happen and WPF just does not present the content. You can see this in action using the following XAML: <StackPanel> and setting the DataContext to be a PersonFull object. The second text block displays the ToString() (in your case the class type name), but the first text block is blank. In the property grid, the solution to this is to provide a TypeEditor for the interface type e.g. <ms:TypeEditor EditedType="{x:Type local:PersonFull+ITest}" EditorTemplate="{StaticResource ITestTemplate}" AllowExpand="True" /> Note that if you want the Test class to have a different type editor from the ITest interface then the former must precede the latter in the list (because a type editor for ITest will also match Test, and the grid chooses the first matching editor in the list). (Looking into your second issue and will respond in another post.) |
|
|
The background colouring issue is because we try to run the background colour of the editor all the way up to the separator line, and the read-only editor is hardwired to use the system "control" colour. Unfortunately the only way to overcome this is to hijack the read-only editor and replace it with your own. The way to do this is to create a DataTemplate with the key {x:Static ms:PropertyGrid.ReadOnlyDisplayKey} and put this in the resource search path (e.g. in your Window.Resources dictionary). Here is a starting point which just makes the entire read-only editor transparent, so that both the editor area and the margin around it (the splitter) will take on the grid background colour. You can use this as a starting point for your own design. <Window.Resources> |
|
|
Hi Ivan, 2. For color issue, I will try it. |
|
|
I have committed a fix for the "non-expandable interfaces" problem. It is kinda heuristic -- the underlying problem is that .NET is telling us something that makes it hard for us to distinguish this case from a case that is legitimately non-expandable -- but it should solve your problem. The fix will be in nightly builds numbered 20081010 and above. Unfortunately, availability of nightly builds is currently delayed due to a server move. Let us know if this is urgent and we will push one up by hand. As an interim workaround, if you control the interface types and there aren't too many of them, you can make them expandable again by adding the following attribute to each type: [TypeConverter(typeof(TypeConverter))] (You can of course remove this again once you receive the fix.) |
|
|
I have added TypeConverter for now. Thanks Ivan :) |
|
|
I have tried override data template for readonly property and also collection property using your template above. Thanks. |
|