本文介绍了在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>



解决方案

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>


解决方案


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

10-28 17:15