如何在C#中隐藏单选按钮。

huangapple go评论156阅读模式
英文:

How to hide radio buttons in c#

问题

I want to hide some radio buttons based on a value.
How to do that?

I was trying this.

if (ArbeitsplatzId == 400)
{
    //RbAmWartungRbRüstenRbRPMWartungRbSchichtwechsel
    RbAmWartung.Visibility = false;
    RbAmWartung.Visibility = "Hidden";
}

in xaml code it's working with this: Visibility="Hidden"

英文:

I want to hide some radio buttons based on a value.
How to do that?

I was trying this.

if(ArbeitsplatzId==400)
            {
                //RbAmWartungRbRüstenRbRPMWartungRbSchichtwechsel
                RbAmWartung.Visibility = false;
                RbAmWartung.Visibility = "Hidden";            
            }

in xaml code it's wotking with this: Visibility="Hidden"

答案1

得分: 1

你应该尝试以下内容:

if (ArbeitsplatzId == 400)
{
    RbAmWartung.Visibility = Visibility.Hidden;
}

这里使用了 Visibility 属性。可以在这里了解更多信息。

英文:

You should Try the following:

if (ArbeitsplatzId == 400)
{
    RbAmWartung.Visibility = Visibility.Hidden;
}

The Visibilty property is used here. Learn more about it here.

答案2

得分: -1

if (ArbeitsplatzId >= 400 && ArbeitsplatzId <= 499)
            {
                //btnSap.Visibility = lib.Visibility.Hidden;                               
                RbAmWartung.Visibility = lib.Visibility.Hidden;
                RbRüsten.Visibility = lib.Visibility.Hidden;
                RbRPMWartung.Visibility = lib.Visibility.Hidden;
                RbSchichtwechsel.Visibility = lib.Visibility.Hidden;
            }
英文:
if (ArbeitsplatzId >= 400 && ArbeitsplatzId <= 499)
            {
                //btnSap.Visibility = lib.Visibility.Hidden;                               
                RbAmWartung.Visibility = lib.Visibility.Hidden;
                RbRüsten.Visibility = lib.Visibility.Hidden;
                RbRPMWartung.Visibility = lib.Visibility.Hidden;
                RbSchichtwechsel.Visibility = lib.Visibility.Hidden;
            }

huangapple
  • 本文由 发表于 2023年7月3日 17:03:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/76603319.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定