WPF MVVM之Visibility 属性绑定

不需要对Visibility 进行值转换器,直接按照普通属性方式绑定即可

XMAL代码

private Visibility _visibility;
public Visibility visibility
{
    get
    {
        return _visibility;
    }
    set
    {
        _visibility = value;
        RaisePropertyChanged("visibility");
    }
}

 然后在代码的某个地方来设置Visibility 属性的值即可

visibility = Visibility.Hidden;
//或者
visibility = Visibility.Visible;

 

posted @ 2021-07-03 22:10  microsoft-zhcn  阅读(1088)  评论(0编辑  收藏  举报