I think this is a bug in the setter for LayerItemViewModel.IsEnabled, I changed the demo code:<!--<CheckBox IsChecked="{Binding IsEnabled, Mode=TwoWay}" IsEnabled="{Binding IsInScaleRange}" VerticalAlignment="Center"/>-->
<!--<TextBlock Text="{Binding Label}" VerticalAlignment="Center" />-->
<Button VerticalAlignment="Center">
<TextBlock Text="{Binding Label}" />
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click" >
<local:ShowLayerInfoAction/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
And in the ShowLayerInfoAction, debug always prints true before and after:protected override void Invoke(object parameter)
{
try
{
var livm = this.AssociatedObject.DataContext as LayerItemViewModel;
var dynLayer = livm.Layer as ArcGISDynamicMapServiceLayer;
Debug.WriteLine("IsEnable before " + livm.IsEnabled.ToString());
livm.IsEnabled = !livm.IsEnabled;
Debug.WriteLine("IsEnable after " + livm.IsEnabled.ToString());
//string url = String.Format("{0}/{1}",dynLayer.Url,livm.SubLayerID);
//HtmlPage.Window.Navigate(new Uri(url), "_blank");
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
}