Part.IsSelected XAML

Hello,

is there a way to set the Part.Selected via WPF/XAML in the MVVM way ?

I try that :

                <DataTrigger Binding="{Binding Data.IsSelected, Mode=TwoWay}" Value="false">
                    <Setter TargetName="Link" Property="go:Part.IsSelected" Value="false"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding Data.IsSelected, Mode=TwoWay}" Value="true">
                    <Setter TargetName="Link" Property="go:Part.IsSelected" Value="true"/>
                </DataTrigger>

I tried the obvious, and it worked just fine:
<Style . . .>

. . .

Am I missing something in what you are trying to do?

Well, I’m trying to highlight(select) all the link connected to a node, when we focus on a node. I’m able to get all the LinkType of our system. Then in the DataTemplate of the LinkType, we defined the GoXam Link. I just don’t know on which type I should set the Part.IsSelected. Is it on the LinkPanel, the Link.Route, etc. ?

I tried your approach :

                <go:LinkPanel.Style>
                    <Setter Property="go:Part.IsSelected" Value="{Binding Path=Data.IsSelected}"></Setter>
                </go:LinkPanel.Style>

And it doesn’t seems to work !

Why are you going through data binding for doing this highlighting of Links connected with a Node?
Do you really want to implement highlighting via selection?
And neither highlighting nor selection is something that belongs in the model, normally.

I’m not saying that you can’t have it that way, but it’s surprising to do both.

I’m sorry – I didn’t answer your actual issue, in that Part.IsSelected is not an attached property that you can easily data bind in a DataTemplate – it’s just a regular DependencyProperty.

I had thought you were asking about using a data Binding as the Value of a Style Setter.

So there’s no easy solution that I can think of at the moment, although I think what you want to do has been done before. I suppose you could add an attached property that you keep synchronized with Part.IsSelected.

Ok I’ll will work on that.

Thanks a lot again Walter!