lundi 23 janvier 2017

c# wpf disable checkbox unchecking when - or + is typed

Okay my problem is simple: I have a checkbox with a textbox like that:

<CheckBox>
    <TextBox x:Name="FilterTextBox">Custom-Filter</TextBox>
</CheckBox>

Now I just want to type in a string with a "-" symbol in it. But unluckily there is something like a KeyPress event in the standard checkbox class from wpf. I didn't even know that function, but if you press "-" it will uncheck the checkbox and if u press "+" it will check it. So I can't type a string with a "-" in it. But I need to do that!

How can i disable that keypress event or override it to do nothing?

I found one similar question here: How do I disable dash + equals on a check box object in xaml?

But it doesnt helped me, cause none of these answers seems to work for me.




Aucun commentaire:

Enregistrer un commentaire