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, A bug was reported to me in my app that I'm trying to track down but I'm stuck. When sorting my properties alphabetically one specific type of fields editor loses its foreground color. I am binding the propertyeditor to a collection of objects and based on the type of object it loads a different editor. I have defined this in the PropertyGrid.Editors section: <ms:TypeEditor EditedType="{x:Type mw:TimeObject}" EditorTemplate="{StaticResource TimeEditor}" />My TimeEditor Resource simply points to a WPFElements DateTimePicker and looks like the following: < mse:DateTimePicker IsEnabled="{Binding IsEnabled}" Format="LongTime" Value="{Binding TimeValue, Mode=TwoWay}" />Note that ms points to the property grid assembly and mse points to the WPFElements assembly. I've attached two images of the property grid, one showing the field beforehand and one showing the field aftwards. As you can see in the "after" the text is missing. I can however highlight the text and even edit it (although I can't see what I'm editing). If I go back to categorical sort the changes I made have been applied so the text is there but its back color is somehow being set to transparant or something. Any thoughts? This appears to be a problem either in the PropertyGrid or in the DateTimePicker control. I wanted to post this before I left but I can try to build a sample tomorrow if you cannot replicate.
Thanks,
Sean |
|
|
Hi Sean, Sorry for the delay in replying. We have not been able to reproduce this problem using either the standard style or the Blue style on which your custom style is based. It may be a custom styling issue but I'm baffled as to why it would occur when sorting alphabetically but not when grouping by category. Do you see the same problem when no sorting or grouping is applied? If so, is there anything in the GroupStyle that might be influencing the foreground? (I am thinking of something in GroupStyle that might be setting the foreground and thereby hiding a problem with the ungrouped foreground.) If you revert temporarily to the "out of the box" Blue style, does that cure the problem? If so, if you diff the Blue style and your custom style, does anything stand out as affecting the foreground? If this doesn't help you track it down then we'd be happy to take a look at a repro sample. |
|
|
Ivan, First to answer your question, we see the same problem whenever the grid is sorted alphabetically or is not sorted at all. The problem goes away when we are "grouping." As for something with my styles, I decided to remove the custom styling to see if the problem went away but it did not. I now declare my grid as follows: < ms:PropertyGrid Margin="0,0,0,0" x:Name="PropertyGrid1" IsToolBarVisible="True" Grouping="{x:Static ms:PropertyGrouping.ByCategory}" Style="{StaticResource {x:Static mss:Alloy.StyleKey}}" Background="#FFFF1818" BorderBrush="#FF250F0F" Grid.Row="0"><ms:PropertyGrid.Editors> <ms:TypeEditor EditedType="{x:Type mw:StartEndDurationObject}" EditorTemplate="{StaticResource StartEndDurationEditor}" /> <ms:TypeEditor EditedType="{x:Type mw:BooleanPropertyObject}" EditorTemplate="{StaticResource CheckboxEditor}" /> <ms:TypeEditor EditedType="{x:Type mw:ComboboxPropertyObject}" EditorTemplate="{StaticResource ComboboxEditor}" /> <ms:TypeEditor EditedType="{x:Type mw:CheckListPropertyObject}" EditorTemplate="{StaticResource ComboListEditor}" /> <ms:TypeEditor EditedType="{x:Type mw:DateTimePropertyObject}" EditorTemplate="{StaticResource DateTimeEditor}" /> <ms:TypeEditor EditedType="{x:Type mw:DoublePropertyObject}" EditorTemplate="{StaticResource NumberEditor}" /> <ms:TypeEditor EditedType="{x:Type mw:TimeObject}" EditorTemplate="{StaticResource TimeEditor}" /> <ms:TypeEditor EditedType="{x:Type mw:TimeSpanFromSecondsObject}" EditorTemplate="{StaticResource TimeSpanEditor}" /> <ms:TypeEditor EditedType="{x:Type mw:ReadOnlyTextObject}" EditorTemplate="{StaticResource ReadOnlyTextEditor}" /> </ms:PropertyGrid.Editors> </ms:PropertyGrid> As you can see I am simply using the default Alloy style. Attatched is a screenshot of the time object that is missing (highlighted in red). I am working on a repro sample but ran into some difficulties getting it together this afternoon. I will post it tomorrow. In the meantime if you have any more ideas for me to look at tomorrow let me know! Thanks, Sean |
|
|
What a day, but I have figured out the problem. The way my application is structured is that I have a generic "object host" user control that I use to acheive a standard look for all open items in the interface. The "object host" control that is hosting the property editor had the Foreground property set to {x:Null}. While this isn't a problem for any other controls, and isn't a problem for a Mindscape Elements DateTimePicker control when grouping is applied to the property grid, it is apparantly a problem when the grouping is not set. It appears that somehow the DateTimePicker's foreground property starts to inherit this value when grouping is not set. Hence it is "transparent" as it is set to x:null. The solution could be implemented in one of 2 places. I could remove the Foreground property from the object host control that is hosting the PropertyGrid, or I could explicitly specify a foreground color in my DataTemplate where I declared my DateTimePicker. I've also noticed that the background on this DateTimePicker control is also transparent rather than white as with most controls. I've attached a sample to this message that illustrates the problem and has comments in the XAML that indicate where changing the setting makes the problem go away. I suspect there is a glitch in the Mindscape Elements though for this particular control (DateTimePicker) in that it doesn't have default background and foreground colors setup the way other controls. Grouping it in the property grid seems to fix the problem but ungrouping it leads it to inherit from further up in the visual tree, inheriting transaparent at times which is problematic. I hope this is helpful. Sean |
|
|
Thanks for the very detailed information and for the repro case. I've had a look at what DateTimePicker might be doing differently from any other control, but it's not yet leaping out at me, so this might take a bit of time to fix. To help me prioritise, is it viable for you as an interim workaround to explicitly specify a foreground colour in the DataTemplate where you declare the DateTimePicker? |
|
|
Ivan, I actually removed the x:Null from the Object Hosting control which makes the problem disappear in my app. In terms of prioritizing I'm fine with this workaround, I just wanted to post the repro case to log the issue/solution for others and so you knew where to look if you get time to address it. Sean |
|