I want to DataBind between those two controls in xaml how I do so ?
<MenuItem Header="_Log" IsCheckable="True"/>
<TextBox Name="_commandsRichTextBox" ,Visibility="Collapsed"/>
And I wrote a converter:
class BoolToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (targetType != typeof(Visibility))
throw new InvalidOperationException("The target must be a Visibility");
return (bool)value ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
And I now have an issue to connect everything.
Thanks for helper .
There already is a converter for that:
BooleanToVisibilityConverterI would only recommend binding from control to control if you can be sure that the data stays in the view, otherwise create a bindable property and just bind both controls to that, the MenuItem will change the value and the TextBox will react.