This is a migrated thread and some comments may be shown as answers.

Custom Toolbox shapes

1 Answer 85 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Zickige
Top achievements
Rank 1
Zickige asked on 28 Sep 2018, 10:13 AM

     Hi there,

I want to be able to show symbol shapes in the toolbox but create the actual shapes when it is dropped on the diagram. right now gallery items accept a shape but cant change the appearance of it. style templates didnt work either. any idea how to do this ?

1 Answer, 1 is accepted

Sort by
0
Zickige
Top achievements
Rank 1
answered on 28 Sep 2018, 10:24 AM
I have the following template but If I remove the content presenter or the view box i cant create any shapes on the diagram. Currently used template:
<DataTemplate x:Key="ToolboxItemTemplate">
        <Grid Margin="0 1 1 0" Width="72" Height="auto">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
 
            <Viewbox VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="5 5 5 0">
                <ContentPresenter Content="{Binding Shape}" Margin="5" IsHitTestVisible="False"  />
            </Viewbox>
 
            <TextBlock Grid.Row="1" Text="{Binding Header}" TextWrapping="Wrap" Margin="5" FontSize="12"
                    TextAlignment="Center" FontFamily="Segoe UI Semibold" HorizontalAlignment="Center" VerticalAlignment="Top"/>
        </Grid>
    </DataTemplate>
Tags
Diagram
Asked by
Zickige
Top achievements
Rank 1
Answers by
Zickige
Top achievements
Rank 1
Share this question
or