79345701

Date: 2025-01-10 12:28:35
Score: 2.5
Natty:
Report link

How can I do a similar operation in WPF?

    class BooleanToContentConverter : IValueConverter
{
    public string TrueContent { get; set; }
    public string FalseContent { get; set; }

    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        return (bool)value ? TrueContent : FalseContent;
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

    <Page.Resources>
    <conv:BooleanToContentConverter x:Key="StateContent" TrueContent="Pause" FalseContent="Play"/>
</Page.Resources>

I haven't tried it this way, but the contents of all objects change at the same time.

Reasons:
  • Blacklisted phrase (0.5): How can I
  • Blacklisted phrase (1): can I do
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Starts with a question (0.5): How can I
  • Low reputation (1):
Posted by: Ahmet AYDOĞAN