I have a listbox with content (the numbers 1-2-3-4-5-6) How can I use a selected number in an if-statement?
Now I have something like that:
if (Listbox1.SelectedItem.ToString()=6)
{
...
}
The XAML for my listbox is:
<ListBox x:Name="lb_getallen"
HorizontalAlignment = "Center"
Height = "124"
Margin = "428,28,54,0"
VerticalAlignment = "Top"
Width = "35"
HorizontalContentAlignment = "Center">
<ListBoxItem Content = "1"/>
<ListBoxItem Content="2"/>
<ListBoxItem Content="3"/>
<ListBoxItem Content="4"/>
<ListBoxItem Content="5"/>
<ListBoxItem Content="6"/>
</ListBox>