在c#中使用radiobutton的内容 [英] Use content of radiobutton in c#

查看:226
本文介绍了在c#中使用radiobutton的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个radiobuttons,我正在尝试在c#中设置一个变量,它是radiobutton的两个值之一。


我怎样才能实现这个目标?我需要使用事件处理程序吗?

< Canvas Name =" myDialog" 
Height =" 438"
Width =" 380"
Horizo​​ntalAlignment =" Center"
VerticalAlignment =" Center"
背景="黑色"
可见性="折叠">

< RadioButton
Name =" rb1"
GroupName =" myGroup"
Content =" 1"
Horizo​​ntalAlignment =" Left"
VerticalAlignment =" Top"
保证金=" 20,40"
/>
< RadioButton
Name =" rb2"
GroupName =" myGroup"
内容=" 2"
Horizo​​ntalAlignment =" Left"
VerticalAlignment =" Top"
Margin =" 20,90"
/>
< / Canvas>



解决方案

你有很多样品可以看看:
http://code.msdn.microsoft.com/wpapps/site/search?query=RadioButton&f%5B0%5D.Value=RadioButton&f%5B0%5D.Type=SearchText&ac=4


或者如果您查看文档,它将告诉您如何使用它们:


http://msdn.microsoft.com/en-us /library/windowsphone/develop/system.windows.controls.radiobutton(v=vs.105).aspx



I have two radiobuttons, and i'm trying to set a variable in c# that is one of the two values of the radiobutton.

How can i achieve this? Do i need to work with event handler?

            <Canvas Name="myDialog"
                    Height="438"
                    Width="380"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    Background="Black"
                    Visibility="Collapsed">
           
                <RadioButton
                    Name="rb1"
                    GroupName="myGroup"
                    Content="1"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Top"
                    Margin="20,40"
                />
                <RadioButton
                    Name="rb2"
                    GroupName="myGroup"
                    Content="2"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Top"
                    Margin="20,90"
                />
            </Canvas>


解决方案

There are lots of samples you can look at: http://code.msdn.microsoft.com/wpapps/site/search?query=RadioButton&f%5B0%5D.Value=RadioButton&f%5B0%5D.Type=SearchText&ac=4

Or if you look at the documentation, that will tell you how to use them as well:

http://msdn.microsoft.com/en-us/library/windowsphone/develop/system.windows.controls.radiobutton(v=vs.105).aspx


这篇关于在c#中使用radiobutton的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆