i am using WPF and want to create a "Search"-Window (Window2), related to Window1.
The "Search"-Window has to each checkbox at least one textbox and at the end a "Search"-Button. I don´t want to use
namespace PokemonManager{
/// <summary>
/// Interaktionslogik für suchen.xaml
/// </summary>
public partial class suchen : Window
{
//Werte uebergeben
//Name
private string text_name = "";
public string textName
{
get { return text_name; }
}
privat void search_click(object sender, RoutedEventArgs e){
if(check_name.IsChecked == true){
//do this
}
for each checkbox, so I want to create a switch-case for each checkbox to say at the end "This checkboxes are checked, so just search with the Textbox.Text related to the checkboxes.
I´ve tried it with this lines
//Suchen-Button
public void search_Click(object sender, RoutedEventArgs e)
{
CheckBox sender_ch = sender as CheckBox;
if (sender_ch != null)
{
switch (sender_ch.Tag)
{
case "tag_name":
if (search_name.IsChecked == true)
{
MessageBox.Show("Hi");
text_name = txt_name.Text;
}
break;
}
}
}
I´ve tried it with this lines in
private void chechbox_checked(object sender, RoutedEventArgs e)
too, but there is the problem, that the checkbox take the textbox-Value before I entered a text.
Can I get anyhow the text after I checked a checkbox with a switch-case?
Sry, if I didn´t formated the text in the right way. I hope you can help me and you understand my question!
Aucun commentaire:
Enregistrer un commentaire