mardi 12 juin 2018

C#-Accessing .xaml created checkbox/listbox

Is there a way to verify if checkbox and a specific item in a listbox has been selected, when it was created in .xaml?

I want to be able to do something as follows;

if (First_CheckBox.checked && LocationBox.SelectedItem == "FirstValue")
{
   do something;
}
else
{
   do something else;
}

.XAML Code:

'CheckBox x:Name="First_CheckBox" IsChecked="{Binding Check, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" Content="Integral "/>

'ListBox x:Name="LocationBox" ItemsSource="{Binding LocationList}" SelectionMode="Single" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" Margin="0,5" Width="100" HorizontalAlignment="Left" BorderThickness="1" Background="#FFF0ECEC">




Aucun commentaire:

Enregistrer un commentaire