I have a Tree View
<TreeView HorizontalAlignment="Stretch" Name="tvLocations" VerticalAlignment="Stretch" />
And a button
<Button Name="cmdUpdateLocation" Grid.Row="1" Content="Update" Width="80" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,88,0">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=tvLocations, Path=SelectedItem}" Value="{x:Null}">
<Setter Property="IsEnabled" Value="False"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
This will enable the button no matter what level of the tree they click on. I want to enable the button when an item in the tree view is selected but only if it is the root node or disable the button if it is not the root. Can I detect in XAML if the node they have selected is the root node?