Hello dnizkoyuncu, do you have a question related Microsoft Open Specifications? please provide detailed description of your issue.
Regards,
Sreekanth Nadendla
Microsoft Windows Open Specifications
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
same as title smh
Hello dnizkoyuncu, do you have a question related Microsoft Open Specifications? please provide detailed description of your issue.
Regards,
Sreekanth Nadendla
Microsoft Windows Open Specifications
Here is an example of binding the visibility of a Button to a Border. (The visibility of child controls in Border is consistent with Border.)
MainWindow.xaml:
<Window.Resources>
<local:BooleanToVisibilityConverter x:Key="BoolToVisConv"/>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border x:Name="border" Grid.Column="1" Grid.Row="1" BorderBrush="Black" BorderThickness="1"
Visibility="{Binding IsChecked, ElementName=toggleButton, Converter={StaticResource BoolToVisConv}}" >
<Button x:Name="btn" Content="button1" Width="200" Height="100" />
</Border>
<ToggleButton x:Name="toggleButton" Grid.Column="1" Content="visibility" Width="200" Height="100" />
<Button Width="100" Height="100" Content="button" Visibility="{Binding IsVisible, ElementName=border, Converter={StaticResource BoolToVisConv}}"/>
</Grid>
MainWindow.xaml.cs:
using System.Windows;
using System.Windows.Data;
namespace BorderAndButtonVisibility
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
public class BooleanToVisibilityConverter : IValueConverter
{
private object GetVisibility(object value)
{
if (!(value is bool))
return Visibility.Hidden;
bool objValue = (bool)value;
if (objValue)
{
return Visibility.Visible;
}
else
{
return Visibility.Hidden;
}
}
public object Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return GetVisibility(value);
}
public object ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new System.NotImplementedException();
}
}
}
The result:
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our [documentation][5] to enable e-mail notifications if you want to receive the related email notification for this thread.
[5]: https://learn.microsoft.com/en-us/answers/articles/67444/email-notifications.html
Hi,@deniz koyuncu . Is there an update to your question? Did my answer solve your problem? If so, you can accept it as the answer. It's helpful for community members with similar questions. I'd be happy to help if there are still questions.