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
|
Hello, I'm not sure if this is related to a previous post which I raised on the forum, but I'm having another strange problem with disappearing UI elements. I've got a property grid set up as follows. Hope this isn't too verbose, I've just cut and pasted: < mindscape:PropertyGrid Name="PropertyGridDocuments" Style="{DynamicResource PropertyGridStyle}"> <mindscape:PropertyGrid.Resources><!--<DocVersionCollectionEditor>--> <DataTemplate x:Key="DocVersionCollectionEditor"> <StackPanel Orientation="Vertical"> <ListView BorderBrush="#CCC" Background="#FFF" BorderThickness="1" ItemsSource="{Binding Value, Mode=OneWay}" Height="75" utility:ListViewColumnStretch.Stretch="True"> <ListView.View> <GridView> <GridView.ColumnHeaderContainerStyle> <Style TargetType="GridViewColumnHeader"> <Setter Property="Visibility" Value="Hidden" /> <Setter Property="Height" Value="0" /> </Style> </GridView.ColumnHeaderContainerStyle> <GridViewColumn Width="50"> <GridViewColumn.CellTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <Image Width="16" Height="16" Source="pack://application:,,,/Pulse.PLMSuite.Core;component/Images/General/Version.png" /> <TextBlock Margin="2,0,0,0" VerticalAlignment="Center" Text="{Binding Path=VersionNo}" /> </StackPanel> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> <GridViewColumn Header="Created On" DisplayMemberBinding="{Binding Path=VersionCreatedOn}"/> <GridViewColumn Header="Created By" DisplayMemberBinding="{Binding Path=VersionCreatedBy}"/> </GridView> </ListView.View> </ListView> </StackPanel> </DataTemplate> <!--</DocVersionCollectionEditor>--> <!--<DocModelCollectionEditor>--> <DataTemplate x:Key="DocModelCollectionEditor"> <StackPanel Orientation="Vertical"> <ListView BorderBrush="#CCC" Background="#FFF" BorderThickness="1" ItemsSource="{Binding Value, Mode=OneWay}" Height="75" utility:ListViewColumnStretch.Stretch="True"> <ListView.View> <GridView> <GridView.ColumnHeaderContainerStyle> <Style TargetType="GridViewColumnHeader"> <Setter Property="Visibility" Value="Hidden" /> <Setter Property="Height" Value="0" /> </Style> </GridView.ColumnHeaderContainerStyle> <GridViewColumn> <GridViewColumn.CellTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <Image Width="16" Height="16" Source="pack://application:,,,/Pulse.PLMSuite.Core;component/Images/General/Folder.png" /> <TextBlock Margin="2,0,0,0" VerticalAlignment="Center" Text="{Binding Path=DocModelName}" /> </StackPanel> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> </GridView> </ListView.View> </ListView> </StackPanel> </DataTemplate> <!--</DocModelCollectionEditor>--> </mindscape:PropertyGrid.Resources> <mindscape:PropertyGrid.BuiltInEditorStyles> <mindscape:BuiltInEditorStyle EditorKey="{x:Static mindscape:PropertyGrid.CheckBoxEditorKey}" Style="{StaticResource CheckBoxEditorStyle}" /> <mindscape:BuiltInEditorStyle EditorKey="{x:Static mindscape:PropertyGrid.ListSelectEditorKey}" Style="{StaticResource ListSelectEditorStyle}" /> <mindscape:BuiltInEditorStyle EditorKey="{x:Static mindscape:PropertyGrid.SimpleTextEditorKey}" Style="{StaticResource SimpleTextEditorStyle}" /> </mindscape:PropertyGrid.BuiltInEditorStyles> <mindscape:PropertyGrid.Editors> <mindscape:PropertyEditor PropertyName="DocVersionCollection" EditorTemplate="{StaticResource DocVersionCollectionEditor}"/> <mindscape:PropertyEditor PropertyName="DocModelCollection" EditorTemplate="{StaticResource DocModelCollectionEditor}"/> </mindscape:PropertyGrid.Editors> </mindscape:PropertyGrid> Problem Description: I set the SelectedObject property of the grid to display the data - this is fine. However, I then change the underlying data (specifically a collection, what is being displayed by the "DocModelCollectionEditor" template) and want to update the property grid with the new information - so I assign the SelectedObject property again, and my custom PropertyEditor templates are gone! Curious. Any advice? Thanks, Justin Rafferty. |
|
|
Hello Justin, This does seem to be related to that previous post and I am afraid I am going to give you a similar answer *grin*. If you move the CellTemplate inline DataTemplates to be separate resources within the PropertyGrid.Resources section, and change the GridViewColumn.CellTemplate declarations to refer those resources, your custom property editors will be restored. (At least they were for me; let me know if this doesn't fix it for you.) |
|
|
Thanks yet again Ivan. I wouldn't have thought about the cell templates at all. I was mucking around with where the PropertyEditor templates lived. Problem fixed now though, so cheers. |
|