edit VertexControl style

Jun 7, 2012 at 9:05 AM

i all, in your sample application

i added 2 properties to the PocVertex class

SolidColorBrush _BorderColor = new SolidColorBrush(Colors.Red);

public Brush BorderColor
{
            get { return _BorderColor; }
}

   public bool IsRoot
        {
            get { return _IsRoot; }
            set { _IsRoot = value; OnPropertyChanged("IsRoot"); }
        }

and added the code in bold to the existing control style, but the binding is not working, nothing appears in out window and aslo i tried to debug the binding with a converter but the code is never called

<Style TargetType="{x:Type GraphSharp_Controls:VertexControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate  TargetType="{x:Type GraphSharp_Controls:VertexControl}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="10,10,10,10"
                            Padding="{TemplateBinding Padding}"
                            MouseLeftButtonDown="TextBlock_MouseLeftButtonDown"
                            >
                        <Border.ContextMenu>
                            <ContextMenu Opened="ContextMenu_Opened">
                                <MenuItem x:Name="miCollega"               Header="collega con" />
                                <MenuItem x:Name="miCollega_Opzione"               Header="collega con opzione" />
                                <MenuItem x:Name="miElimina" Click="DeleteVertex_Click" Header="elimina"/>
                                <MenuItem x:Name="miElimina_Collegamenti"  Header="elimina collegamenti"/>
                            </ContextMenu>
                        </Border.ContextMenu>
                        <ContentPresenter Content="{TemplateBinding Vertex}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="GraphSharp_Controls:GraphElementBehaviour.HighlightTrigger" Value="{Binding Path=IsMouseOver, RelativeSource={RelativeSource Self}}"/>
        <Setter Property="WPFExtensions_AttachedBehaviours:DragBehaviour.IsDragEnabled" Value="True"/>
        <Setter Property="WPFExtensions_AttachedBehaviours:DragBehaviour.X" Value="{Binding Path=(GraphSharp_Controls:GraphCanvas.X), Mode=TwoWay, RelativeSource={RelativeSource Self}}"/>
        <Setter Property="WPFExtensions_AttachedBehaviours:DragBehaviour.Y" Value="{Binding Path=(GraphSharp_Controls:GraphCanvas.Y), Mode=TwoWay, RelativeSource={RelativeSource Self}}"/>
        <!--<Setter Property="Background" Value="#FFE3E3E3"/>-->
        <Setter Property="Background" Value="{Binding Path=BorderColor}"/>
        <Setter Property="BorderThickness" Value="5,3,5,3"/>
        <Setter Property="Padding" Value="10,5,10,5"/>
        <Setter Property="BorderBrush" Value="#FF393939"/>
        <Style.Triggers>
            <Trigger Property="GraphSharp_Controls:GraphElementBehaviour.IsHighlighted" Value="True">
                <Setter Property="BorderBrush" Value="{StaticResource HighlightedVertexBorderBrush}"/>
                <Setter Property="Background" Value="{StaticResource HighlightedVertexBackgroundBrush}"/>
                <Setter Property="Foreground" Value="{StaticResource HighlightedVertexForegroundBrush}"/>
            </Trigger>
            <Trigger Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted" Value="True">
                <Setter Property="BorderBrush" Value="{StaticResource HighlightedVertexBorderBrush}"/>
                <Setter Property="Background" Value="{StaticResource HighlightedVertexBackgroundBrush}"/>
                <Setter Property="Foreground" Value="{StaticResource HighlightedVertexForegroundBrush}"/>
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted" Value="True"/>
                    <Condition Property="GraphSharp_Controls:GraphElementBehaviour.SemiHighlightInfo" Value="Source"/>
                </MultiTrigger.Conditions>
                <Setter Property="BorderBrush" Value="{StaticResource SemiHighlightedSourceVertexBorderBrush}"/>
                <Setter Property="Background" Value="{StaticResource SemiHighlightedSourceVertexBackgroundBrush}"/>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted" Value="True"/>
                    <Condition Property="GraphSharp_Controls:GraphElementBehaviour.SemiHighlightInfo" Value="Target"/>
                </MultiTrigger.Conditions>
                <Setter Property="BorderBrush" Value="{StaticResource SemiHighlightedTargetVertexBorderBrush}"/>
                <Setter Property="Background" Value="{StaticResource SemiHighlightedTargetVertexBackgroundBrush}"/>
            </MultiTrigger>

          

        </Style.Triggers>
    </Style>