Sample using WPF
Button newbutton = new Button();
bool a = true;
newbutton.Visibility = a ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed;
newbutton.Visibility = !String.IsNullEmpty(newbutton.Text) ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed;
Anything that evaluates to bool. If True do the command after the ? else do the command after the :
0 comments:
Post a Comment