I have a WPF ComboBox created in XAML:
<ComboBox DockPanel.Dock="Top" Background="{DynamicResource Esri_BackgroundPressedBrush}" DataContext="DockpaneData"
Foreground="{DynamicResource Esri_TextMenuBrush}" HorizontalAlignment="Stretch" FontSize="14" VerticalAlignment="Center" Margin="5,0,5,0" IsEditable="True" Text="Jump To"
ItemsSource="{Binding FeatureEditUpdates}">
</ComboBox>
I set the DataContext of the ComboBox "DockpaneData", which in this case is an internal class called "DockpaneData" within another file called DockpaneViewModel.cs.
Why Can't I bind to the public class property "FeatureEditUpdates"?
It will work if I put it in the class with the same name as the file, and DON'T set the datacontext in the ComboBox. Why?
The error I'm getting in the output window is:
System.Windows.Data Error: 40 : BindingExpression path error: 'FeatureEditUpdates' property not found on 'object' ''String' (HashCode=-1567065443)'. BindingExpression:Path=FeatureEditUpdates; DataItem='String' (HashCode=-1567065443); target element is 'ComboBox' (Name=''); target property is 'ItemsSource' (type 'IEnumerable')
Where I see it thinks the datacontext is a string, which doesn't make sense to me.
Thank you!