With SDK version 2.2, I have a View with a tabcontrol where its itemssource is bound to an ObserveableCollection of GraphicsLayers on a ViewModel. <TabControl ItemsSource="{Binding Layers}" Grid.Row="3" Grid.ColumnSpan="3">
<TabControl.ItemTemplate>
<DataTemplate>
<TabItem >
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding ID}"></TextBlock>
<Button Content="x" Margin="3" Command="{Binding ElementName=LayoutRoot,Path=DataContext.Delete}" CommandParameter="{Binding}"></Button>
</StackPanel>
</TabItem.Header>
</TabItem>
</DataTemplate>
</TabControl.ItemTemplate>
<TabControl.ContentTemplate>
<DataTemplate>
<Grid>
<toolkit:FeatureDataGrid Map="{Binding ElementName=LayoutRoot, Path=DataContext.Map}" GraphicsLayer="{Binding}"></toolkit:FeatureDataGrid>
</Grid>
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
Here's the ViewModel:public ObservableCollection<GraphicsLayer> Layers
{
get { return m_Layers; }
set
{
m_Layers = value;
RaisePropertyChange("Layers");
}
}
The first time I add a graphicslayer to the viewmodel, it works fine. But I do see these errors:System.Windows.Data Error: 1 : Cannot create default converter to perform 'one-way' conversions between types 'System.Windows.Controls.DataGridHeadersVisibility' and 'System.Windows.Visibility'. Consider using Converter property of Binding. BindingExpression:Path=HeadersVisibility; DataItem='FeatureDataGrid' (Name=''); target element is 'Button' (Name=''); target property is 'Visibility' (type 'Visibility')
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='Column' BindingExpression:Path=HeadersVisibility; DataItem='FeatureDataGrid' (Name=''); target element is 'Button' (Name=''); target property is 'Visibility' (type 'Visibility')
System.Windows.Data Error: 1 : Cannot create default converter to perform 'one-way' conversions between types 'System.Windows.Controls.DataGridHeadersVisibility' and 'System.Windows.Visibility'. Consider using Converter property of Binding. BindingExpression:Path=HeadersVisibility; DataItem='FeatureDataGrid' (Name=''); target element is 'DataGridColumnHeadersPresenter' (Name='PART_ColumnHeadersPresenter'); target property is 'Visibility' (type 'Visibility')
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='Column' BindingExpression:Path=HeadersVisibility; DataItem='FeatureDataGrid' (Name=''); target element is 'DataGridColumnHeadersPresenter' (Name='PART_ColumnHeadersPresenter'); target property is 'Visibility' (type 'Visibility')
After I clear the collection then add a layer to the collection, I get a tab item, but no FeatureDataGrid. When I have multiple tabs showing (with featuredatagrids) and switch between them I get a unhandled exception crash.Is this a bug, or am I doing something wrong?Thanks!