RadDiagramShape Style & DataTemplate

2 posts, 1 answers
  1. Fabrizio
    Fabrizio avatar
    9 posts
    Member since:
    Nov 2012

    Posted 27 Nov 2012 Link to this post

    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" />
  2. Answer
    Tina Stancheva
    Tina Stancheva avatar
    3298 posts

    Posted 30 Nov 2012 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top