How can you populate a listbox with parameter from the list of objects that is bound to the...

  • Thread starter Thread starter seckley
  • Start date Start date
S

seckley

Guest
Hi All;

I have a view that has a listbox on it. The listbox is bound to a list of scenarios called ScenarioList.

<ListBox MaxHeight="300" Grid.Column="1" ItemsSource="{Binding ScenarioList}"

ScenarioList is an observable collection. Each scenario contains a name and id. I want the name and ID to display in the list box. As it is when the listbox is populated I just see the explicit class name of the scenario. I have tried the following code:

<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Content="{Binding Name}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>

but this just gets me a blank list box. The list is coming from a background service so I only care about whether items have been removed or added. Any ideas?


Shawn

Continue reading...
 
Back
Top