My listbox is not displaying the items. The items are in a List<string>
.
Here is the xaml:
<DockPanel Margin="10,10,10,10">
<DockPanel.Resources>
<local:MyErrors x:Key="myErrors"/>
</DockPanel.Resources>
<ListBox DockPanel.Dock="Top" ItemsSource="{StaticResource myErrors}" Height="300" Width="250" Margin="0,5,0,10"
/>
<StackPanel DockPanel.Dock="Bottom" HorizontalAlignment="Center" VerticalAlignment="Bottom" Orientation="Horizontal">
<Button Height="28" Click="buttonOK_Click" Margin="10,10,10,10" IsDefault="True" Name="buttonOK" Width="75">OK</Button>
<Button Height="28" Click="buttonCancel_Click" Margin="10,10,10,10" IsCancel="True" Name="buttonCancel" Width="75">Cancel</Button>
</StackPanel>
</DockPanel>
I am setting the source like this:
DialogErrors dlg = new DialogErrors();
dlg.Owner = App.Current.MainWindow as Window;
dlg.MyErrors = myOtherClass.MyErrors;
Then I have an automatic property in the dialog. Which is the List<string>
derived class whose type and name are MyErrors.
public MyErrors MyErrors
{
get;
set;
}
enter code here