Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

New Post: PropertyGrid Collection Editor - Class types for new objects

$
0
0
Hi,

Thank you for your quick reply.

I have a list of Pads (listed in a listbox (each pad contains an outline which is a ShapeCollection
<ListBox x:Name="PadListBox" Grid.Column="0" ItemsSource="{Binding Path=Pads}" Margin="5,39,5,5" SelectedIndex="0" >
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Rectangle Name="Border" StrokeThickness="1" StrokeDashArray="2" Fill="Transparent" SnapsToDevicePixels="true" />
                        <DTGraphics:PadCanvas SnapsToDevicePixels="True" Width="70" Height="70" Background="Beige"  CurrentPad="{Binding Path=.}" />
                        <TextBlock VerticalAlignment="Bottom" HorizontalAlignment="Center" Text="{Binding Path=Name}"/>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
I placed the CollectionControl in the Template for the Pad.Outline - so the CollectionControl is placed with the other properties.
When I select another Pad from the listbox, the shapes that I added in the CollectionControl are not saved in the Outline.
<xctk:PropertyGrid  Grid.Column="1"
                        x:Name="propertyGrid"
                        ShowSummary="True"
                        IsCategorized="True"
                        ShowAdvancedOptions="False" 
                        SelectedObject="{Binding ElementName=PadListBox, Path=SelectedItem}"
                        SelectedObjectName="{Binding ElementName=PadListBox, Path=SelectedItem.ToString}"
                        Margin="5"
                        >
            <xctk:PropertyGrid.EditorDefinitions>

                <xctk:EditorTemplateDefinition>

                    <xctk:EditorTemplateDefinition.TargetProperties>
                        <sys:String>Outline</sys:String>
                    </xctk:EditorTemplateDefinition.TargetProperties>

                    <xctk:EditorTemplateDefinition.EditingTemplate>
                        <DataTemplate>
                            <xctk:CollectionControl ItemsSource="{Binding Value, Mode=TwoWay}"
                                                    NewItemTypes="{Binding Source={StaticResource myListOfTypes}, Path=Types}"
                                                    ItemAdded="CollectionControl_ItemAdded"
                                                    ItemDeleted="CollectionControl_ItemDeleted"/>
                        </DataTemplate>
                    </xctk:EditorTemplateDefinition.EditingTemplate>
                </xctk:EditorTemplateDefinition>
            </xctk:PropertyGrid.EditorDefinitions>
        </xctk:PropertyGrid>


Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>