Multiple Expander have to collapse if ONE is expanded

前端 未结 7 1016
南笙
南笙 2020-12-08 22:42

Having 4 Expander controls. When one expander is expanded how can I make all others collapse/close?

7条回答
  •  醉酒成梦
    2020-12-08 23:31

    @wassim-azirar asked to the accepted answer:

    How can I expand 'Expander 1' at the application Startup ?

    I added in the ViewModel:

    SelectedExpander = "1";
    

    Because of the fact, that the "1" is not the same object as the "1" in XAML this will not work, so I changed decyclone's answer like this:

    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        return (string)value == (string)parameter;
    }
    

    The answer of decyclone was very helpful for me - Thanks.
    So I would like to share my experience if someone needs it.

提交回复
热议问题