How to bind Stroke details like color, shape and thickness of go:LinkShape dynamically in WPF, MVVM using c#

I have created a LinkTemplate and in this I have go:LinkShape, I,m trying to bind the values of Stroke and Strokethickness from view model, but its not working, it will not read the values supplied from view model. Is there any way to achieve this? ’

Thanks

Yes, normal data Bindings should work, with or without converters, to either the Link.Data or on other elements.

For example, here’s one such example, from the Friend Wheel sample:

        <go:LinkShape x:Name="Path"
            Stroke="{Binding Path=Data.Color}"
            StrokeThickness="1" />

From the Flowgrammer sample:

        <go:LinkShape Stroke="{Binding Path=Data.Highlight, Converter={StaticResource theStrokeColorConverter}}"
                      StrokeThickness="{Binding Path=Data.Highlight, Converter={StaticResource theStrokeThicknessConverter}}" />

And in the Basic demo:

        <go:LinkShape Stroke="{Binding Path=Part.IsSelected, Converter={StaticResource theSelectionConverter}}"
                      StrokeThickness="6" />

Thank you for the response, I tried all the above options Data.Color works for me but by default it sets Balck color. I have created a separate variable LineColor of the type string and allowing user to set the color at run time, and trying to change the color at run time. f i assign Stroke=“Red” that works but its static. this is the variable
private string lineColor=“Black”;
public string LineColor
{
get { return lineColor; }
set { lineColor = value; RaisePropertyChanged(“LineColor”); }
}
and this is the Link Template
<go:LinkShape x:Name=“Path” go:LinkPanel.IsLinkShape=“True” Stroke="{Binding Path=LineColor, Mode=TwoWay}" StrokeThickness=“1” Cursor=“Hand”/>

I don’t see the link template.

In your property setter it is important not to call RaisePropertyChanged unless the new value is different from the old value.

Also, you need to pass the old value and the new value, so that undo and redo can work.

Ya it wont call unless the value is new

go:LinkShape x:Name=“Path” go:LinkPanel.IsLinkShape=“True” Stroke="{Binding LineColor, Mode=TwoWay}" StrokeThickness=“1” Cursor=“Hand”/

You need to say

Stroke="{Binding Path=Data.LineColor, Mode=TwoWay}"

just like in the examples I gave above, and that you can see throughout all of the working samples.

I tried that as well but that also not working.

Try modifying one of the working samples, such as the Basic Demo or the Minimal app. If that works, you’ll need to figure out what’s different between the two apps.

I have not found any similar samples. Every where Data.Color is useed which is working fine for me as well.