简体   繁体   English

2个按钮,但在wpf窗口中只有一个按钮

[英]2 Buttons but just one work in wpf window

I want to insert 2 Buttons in my C# Project. 我想在我的C#项目中插入2个按钮。 But just one of them works. 但是其中只有一个有效。 I Tried different things, and i noticed in the second button script BorderBrush="{x:Null}" /> is a /> i think this is the problem. 我尝试不同的东西,并且i的第二个按钮脚本注意到BorderBrush="{x:Null}" />是一个/>我认为这就是问题所在。 But at the time i remove it / convert it to a > it gives me an error out. 但当时我将其删除/将其转换为>这给了我一个错误。

But heres the code, maybe you can help: 但是下面的代码,也许您可​​以提供帮助:

*Edit: Code is to long so heres a Link: http://pastebin.com/MysA7Dh1 **Edit: First a big Thanks for the Help :)! *编辑:代码太长了,因此这里是一个链接: http : //pastebin.com/MysA7Dh1 **编辑:首先非常感谢您的帮助:)! And i dont want you to do the work for me but i dont find an solution. 而且我不希望您为我做这项工作,但是我没有找到解决方案。 The first button just looks like the second on the xaml code for me. 对我来说,第一个按钮就像xaml代码上的第二个按钮一样。 But now i can click the button but this time i dont see the image. 但是现在我可以单击按钮,但是这次我看不到图像。 I see it on the first button but not on the second. 我在第一个按钮上看到它,但在第二个按钮上看不到。

Updated code: http://pastebin.com/PZhtssSy 更新的代码: http : //pastebin.com/PZhtssSy

nvm i set the Margin wrong. NVM我设置保证金错误。 :/ :/

Are you trying to include that image inside the button code? 您是否要在按钮代码中包含该图像? Or is the image supposed to be separate? 还是应该将图像分开?

If you're trying to include the image inside the button, your code should look like this (code overly simplified for clarity): 如果您尝试将图像包含在按钮内,则代码应如下所示(为清楚起见,代码过于简化):

<Button>
    <Image/>
</Button>

If they are supposed to be separate: 如果应该将它们分开:

<Button />
<Image />

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

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