When I click on any node. The blue color get appeared around the borders of the node. I want to display the color according to my theme. How can I change the blue color ?
Thanks in advance.
Look at the DataTemplate defining the appearance and behavior of the Node. You should find there the styling used when the Node is selected.
I didn’t define this behavior anywhere in my data template. please have a look
<go:NodePanel Grid.Column="1" Grid.Row="1" Sizing="Auto" go:SpotPanel.Main="True" MouseEnter="NodePanel_MouseEnter" MouseLeave="NodePanel_MouseLeave">
<Path x:Name="myShape" Style="{StaticResource NodeShapeStyle}"/>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="15"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{Binding Path=Data.Name}" Style="{StaticResource NodeNameStyle}"></TextBlock>
<ContentControl Grid.Row="1" Content="{Binding Path=Data.DynamicContent}"
VerticalAlignment="Center"
VerticalContentAlignment="Stretch"
HorizontalContentAlignment="Stretch"
HorizontalAlignment="Center"
go:Part.TextEditable="True"/>
</Grid>
</go:NodePanel>
<local:InertListBox Grid.Column="1" Grid.Row="0"
Style="{StaticResource InertListBoxStyle}"
ItemsPanel="{StaticResource HorizontalItemsPanel}"
ItemsSource="{Binding Path=Data.InputTags}">
<ListBox.ItemTemplate>
<DataTemplate>
<Rectangle Style="{StaticResource InputPortStyle}" go:LinkPanel.Index="{Binding Index}"
go:Node.PortId="{Binding TagKey}" go:Node.LinkableFrom="False" go:Node.LinkableMaximum="1"
go:Node.LinkableTo="True" go:Node.ToSpot="MiddleTop"
go:Node.ToEndSegmentLength="{Binding Segment}">
<ToolTipService.ToolTip>
<TextBlock Text="{Binding TagKey}" Style="{StaticResource GroupBoxTextBlockStyle}"/>
</ToolTipService.ToolTip>
</Rectangle>
</DataTemplate>
</ListBox.ItemTemplate>
</local:InertListBox>
<local:InertListBox Grid.Column="1" Grid.Row="2"
Style="{StaticResource InertListBoxStyle}"
ItemsPanel="{StaticResource HorizontalItemsPanel}"
ItemsSource="{Binding Path=Data.OutputTags}">
<ListBox.ItemTemplate>
<DataTemplate>
<Rectangle Style="{StaticResource OutputPortStyle}" go:LinkPanel.Index="{Binding Index}"
go:Node.PortId="{Binding TagKey}" go:Node.LinkableTo="False"
go:Node.LinkableFrom="True" go:Node.FromSpot="MiddleBottom"
go:Node.FromEndSegmentLength="{Binding Segment}">
<ToolTipService.ToolTip>
<TextBlock Text="{Binding TagKey}" Style="{StaticResource GroupBoxTextBlockStyle}"/>
</ToolTipService.ToolTip>
</Rectangle>
</DataTemplate>
</ListBox.ItemTemplate>
</local:InertListBox>
</Grid>
</go:SpotPanel>
</DataTemplate>
Here are the styles that I am using
<!-- For the primary shape of each node except the Start and End Node -->
<Style TargetType="Path" x:Key="NodeShapeStyle">
<Setter Property="Stroke" Value="{StaticResource StrongBrush}" />
<Setter Property="StrokeThickness" Value="1" />
<Setter Property="go:NodePanel.Figure" Value="Rectangle"/>
</Style>
<Style x:Key="OutputPortStyle" TargetType="Rectangle">
<Setter Property="Fill" Value="{StaticResource InverseAccentBrush}" />
<Setter Property="Height" Value="8"/>
<Setter Property="Width" Value="8"/>
<Setter Property="Margin" Value="1 0 1 0"/>
</Style>
Please help how to get ride this selected color. thanks
Because you have set go:Part.SelectionAdorned=“True”, the selected Node is getting a selection Adornment. Because you have set go:Part.SelectionElementName to the name of a Shape within the visual tree of the Node, that is what gets the selection adornment, with the same shape.
You can override the default selection Adornment by setting go:Part.SelectionAdornmentTemplate. There are several examples in the GoWpfDemo app. For example, the Draggable Link sample uses:
<DataTemplate x:Key="NodeSelectionAdornmentTemplate">
<go:SelectionHandle go:Part.Selectable="False"
Stroke="DeepSkyBlue" StrokeThickness="1" StrokeDashArray="2 2" />
</DataTemplate>
By the way, you can see the definitions of all of the default templates and styles by looking at the GenericWPF.xaml file in the docs directory.
That’s exactly what I was looking for.
Thanks so much for your in time help. :)