简体   繁体   English

C#复选框,仅选中该复选框而不是文本

[英]C# Check box, only check the box not the text

Okay i swear i looked for this on google before posting. 好吧,我发誓我在发布之前在Google上寻找了它。

I tried: 我试过了:

C# check box active area C# check box check box not text C#复选框活动区域C#复选框复选框不是文本

and a few others. 和其他一些。

But i have a check box on top of a button. 但是我在按钮上方有一个复选框。 I want to be able to click the button even when the mouse is over top the check box text area. 我希望即使在鼠标悬停在复选框文本区域上方时也可以单击按钮。 I want the use to only be able to click the actual box. 我希望使用只能单击实际的框。 But when the mouse is over the check box's text, it should click the button. 但是,当鼠标悬停在复选框的文本上方时,应单击该按钮。

Thanks all! 谢谢大家!

I'm assuming this is in WPF / XAML. 我假设这是在WPF / XAML中。

Simply add the checkbox to the button without text. 只需将复选框添加到没有文本的按钮即可。 Add the text to the button not the checkbox. 将文本添加到按钮而不是复选框。

That said, I cannot for the world think why this would be a pleasant user experience and would suggest trying to use a different means of getting the information. 就是说,我无法为全世界所想,为什么这将是一种令人愉悦的用户体验,并建议尝试使用其他方式来获取信息。

So instead of having the checkboxes over top the button, i just created a seperate window that will show with the three options to choose from upon clicking that button. 因此,我没有创建按钮上方的复选框,而是创建了一个单独的窗口,单击该按钮后将显示三个选项供您选择。

But i still think it would be cool/neat to have them on top of the button. 但是我仍然认为将它们放在按钮顶部会很酷/很整洁。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM