Hello,
Using Prism, I have implemented a View, Model and Presenter much like the StockTraderRI project. My issue is that I am trying to databind a stackpanel to an ObservableCollection object but no strings are being displayed.
Here’s my code:
PresentationModel code:
public InfoBarPresentationModel(IInfoBarView view, IEventAggregator eventAggregator)
{
this.View = view;
this.View.Model = this;
InfoBarItems = new ObservableCollection<string>();
InfoBarItems.Add("Test 1");
InfoBarItems.Add("Test 2");
}
public IInfoBarView View { get; set; }
public ObservableCollection<string> InfoBarItems { get; set; }
XAML code:
<ItemsControl x:Name="list" ItemsSource="{Binding InfoBarItems}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding}"/>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
I have tried numerous combinations of bindings but have yet to figure out why my strings never show up. What am I doing wrong?
Rick