wpf bind to visibility code example
Example: wpf binding visibility to property
<Grid x:Name="ShowError" Visibility="{Binding VisibleState}">
public Visibility VisibleState
{
get { return _VisibleState; }
set
{
if (_VisibleState != value)
{
_VisibleState = value;
OnPropertyChanged( "VisibleState" );
}
}
}
private Visibility _VisibleState = Visibility.Hidden;
public void SetVisibility( bool visible )
{
if (visible)
VisibleState = System.Windows.Visibility.Visible;
else
VisibleState = System.Windows.Visibility.Collapsed;
}