i want to display a string and three bools in a listbox, therefor i made an ItemTemplate:
<ListBox x:Name="lstVars" Margin="10,41" Grid.ColumnSpan="4" Grid.Column="1">
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel Height="30">
<TextBlock Text="{Binding description}" VerticalAlignment="Center" HorizontalAlignment="Left" Width="200"/>
<CheckBox Margin="3" Content="a" IsChecked="{Binding save}" Width="200"/>
<CheckBox Margin="3" Content="b" IsChecked="{Binding displayBoard}" Width="200"/>
<CheckBox Margin="3" Content="c" IsChecked="{Binding displayGraph}" Width="200"/>
</WrapPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
i made a testclass because with my original class it doesnt work (but the same "error" occurs with the testclass):
public class test
{
public String description;
public bool save { get; set; }
public bool displayBoard { get; set; }
public bool displayGraph { get; set; }
public test(String description, bool save, bool displayBoard, bool displayGraph)
{
this.description = description;
this.save = save;
this.displayBoard = displayBoard;
this.displayGraph = displayGraph;
}
}
when i add some values to the listbox, the string is not displayed
lstVars.Items.Add(new test("teststring", true, false, true));

i first thought the text would just be in a not visible row but when i write Text="123test" instead of Text="{Binding description}" it displays 123test like it should.