Hi,
I am writing a custom legend control in silverlight to get the legend information from the SOAP endpoints using SL3, ESRI SL API 1.2. I could not get a dependency property change event to fire off when the property is changed.
In the legend xmal, I have an ActiveLayersLegends dependency properties, which is an observable collection of LegendRequestor, that contains two public properties: soap url and active layer arryalist.
public ObservableCollection<LegendRequestor> ActiveLayersLegends
{
get { return (ObservableCollection<LegendRequestor>)GetValue(ActiveLayersLegendsProperty); }
set { SetValue(ActiveLayersLegendsProperty, value); }
}
/// <summary>
/// Identifies the <see cref="LegendService"/> dependency property.
/// </summary>
public static readonly DependencyProperty ActiveLayersLegendsProperty =
DependencyProperty.Register("ActiveLayersLegends", typeof(ObservableCollection<LegendRequestor>),
typeof(Legend), new PropertyMetadata(OnActiveLayersLegendsPropertyChanged));
I consume this legend control in my main page xmal and wrap this up in a tab control. Whenever someone clicks on the legend tab, I will generate an observable collection of LegendRequestor. Supposedly, when the observable collection of LegendRequestor has changed, it should fire off the OnActiveLayersLegendsPropertyChanged event in the legend xmal, but the event is not fired off. So instead of creating an observablecollection list, I tried the same test using a string dependency property, which fires off the event when the string is modified. Did I do something wrong here or does SL3 not support observablecollection dependency property?
<controls:TabItem Width="75" Height="21" Header="Legend">
<Border Grid.Column="0" Style="{StaticResource CommonBorder}" Background="#b2b564">
<userControls:Legend x:Name="legendControl" ActiveLayersLegends="{Binding LegendRequestors, Mode=TwoWay}" />
</Border>
</controls:TabItem>
Thanks much in advance,
yin