why cannot i dot this?:
<telerikNavigation:RadTreeView x:Name="radTreeView"
BorderThickness="1"
BorderBrush="Black"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
ItemsSource="{Binding OrgStructList}"
ItemTemplate="{StaticResource RootItem}"
Width="300"
/>
<!--SelectionChanged="radTreeView_SelectionChanged"-->
<csla:TriggerAction Height="0" Name="SetGridTrigger" Width="0"
TargetControl="{Binding SelectionChanged, ElementName=radTreeView}" MethodName="SetGrid_SelectionChanged" />
The Trigger Action do not work for this in my ViewModel, normal buttton events always work:
public void SetGrid_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
{
}
Mission is not to use Code Behind.
The TargetControl binding is wrong. That needs to point directly to the control, and you need to use the TriggerEvent property to indicate the name of the event for which you want to listen.
TargetControl="{Binding ElementName=radTreeView}" TriggerEvent="SelectionChanged"
xaml
<StackPanel Orientation="Vertical" Margin="5"
DataContext="{Binding Source={StaticResource WorkRuleViewModelViewSource}}"
>
<telerikNavigation:RadTreeView x:Name="radTreeView_"
BorderThickness="1"
BorderBrush="Black"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
ItemsSource="{Binding OrgStructList}"
ItemTemplate="{StaticResource RootItem}"
Width="300"
>
</telerikNavigation:RadTreeView>
<!--SelectionChanged="radTreeView_SelectionChanged"-->
<csla:TriggerAction Height="0" Name="SetTreeTrigger" Width="0"
TargetControl="{Binding ElementName=radTreeView_}" TriggerEvent="SelectionChanged" MethodName="SetTree_SelectionChanged"
/>
</stackpanel>
error: child is already a child of another element.
eish what?
</stackpanel>
should be
</StackPanel>
I typed in my questions only a spelling error - my code is </StackPanel> still same error.
Hmmm... I pasted the code and corrected the references (I am using Telerik as well) and it did not complain. You may have a problem in a different part of the code that you didn't show?
Another option: Bind the SelectedItem from the RadTreeView to a Property in your view model then handle the property changed event to process the selection changing.
Copyright (c) Marimer LLC