how to set mouse click event only on specific vertex in graphsharp?

1k Views Asked by At

I'm using graphsharp and to display different pictures in different kinds of vertex, however I couldn't find a way to set only on specific type of vertex that display specific pictures mouse click event. I need only specific vertex to handle the event. can anyone help me?

2

There are 2 best solutions below

0
On BEST ANSWER

Try use directly without trigger... I use this on vertex context menu

<Style TargetType="{x:Type GraphSharp_Controls:VertexControl}">
<Setter Property="ContextMenu">
    <Setter.Value>
        <ContextMenu>
            <ContextMenu.ItemContainerStyle>
                <Style TargetType="MenuItem">
                    <EventSetter Event="Click" Handler="ContextMenuClick"/>
                    ...
1
On

You can set an event handler using Style and bindings in WPF like this:

<Style>
   <Style.Triggers>
       <Trigger Property="[APropertyOfVertex]" Value="[YourValue]">
           <EventSetter Event="Click" Handler="Click_Handler" />
       </Trigger>
   </Style.Triggers>
</Style>

Hope this help