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

RadDiagramShape Style & DataTemplate

1 Answer 164 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Fabrizio asked on 27 Nov 2012, 02:32 PM
hi all, can u help me to understand what's wrong in this style?

PocVertex is a ViewModel object representing the diagram Node.

<Style x:Key="PocNodeStyle" TargetType="telerik:RadDiagramShape">
        <Setter Property="Position" Value="{Binding Position, Mode=TwoWay}" />
        <Setter Property="Width" Value="200" />
        <Setter Property="Height" Value="50" />
        <Setter Property="IsConnectorsManipulationEnabled" Value="False" />
        <Setter Property="IsRotationEnabled" Value="False" />
        <Setter Property="Template">
                <DataTemplate DataType="{x:Type local:PocVertex}">
                        <Border Name="bd" Background="#FFE3E3E3"
                                BorderBrush="{Binding Path=.,Converter={StaticResource nodeBorderColorConverter}}"
                                <ContextMenu    >
                                    <MenuItem x:Name="miCollega"                              Header="collega con" />
                                    <MenuItem x:Name="miCollega_Opzione"                      Header="collega con opzione" />
                                    <MenuItem x:Name="miElimina"                              Header="elimina" />
                                    <MenuItem x:Name="miElimina_Collegamenti"                 Header="elimina collegamenti" />
                                    <MenuItem x:Name="miRadice"                               Header="Imposta come radice" />
                                    <MenuItem x:Name="miDuplica"                              Header="duplica nodo" />
                                    <MenuItem x:Name="miCopiaNodo"                            Header="copia nodo" />
                                    <MenuItem x:Name="miEmail"                                Header="invia email"           />
                                    <!--ItemsSource="{Binding Source={x:Static s:Settings.Default}, Path=Emails, Mode=TwoWay}"-->
                                    <MenuItem x:Name="miNuovo"                                    Header="nuovo nodo"  >
                                        <MenuItem x:Name="miNuovo_Diretto"                        Header="diretto" />
                                        <MenuItem x:Name="miNuovo_Opzione"                        Header="opzione" />
                                    <MenuItem x:Name="miIsolaNodo"                                Header="isola nodo" />
                            <TextBlock Name="txtCaption" Text="{Binding Caption}"  ToolTip="{Binding Text}"/>
                        <DataTrigger Binding="{Binding Path=IsRoot}" Value="True">
                                <Setter Property="TextDecorations" Value="Underline" TargetName="txtCaption" />
                        <DataTrigger Binding="{Binding Path=IsHighlighted}" Value="True">
                                <Setter Property="BorderBrush" Value="Red" TargetName="bd" />
                        <DataTrigger Binding="{Binding Path=IsSelected}" Value="True">
                                <Setter Property="Background" Value="Yellow" TargetName="bd" />

1 Answer, 1 is accepted

Sort by
Tina Stancheva
Telerik team
answered on 30 Nov 2012, 11:31 AM
Hi Fabrizio,

In the solution you posted in your other thread, I noticed that you've fixed the issue. However, just in case anyone else encounters the same, I want to note that the Template property of the RadDiagramShape is of type ControlTemplate. So you need to apply a custom ControlTemplate rather than DataTemplate.

Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Asked by
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Share this question