WPF Expanders Triggers

倾然丶 夕夏残阳落幕 提交于 2019-12-04 19:39:26

OK I think that's not possible. I provide a solution in that case:

<!--Add this to the resources dictionary-->
<conv:BoolInverterConverter x:Key="boolInvertorConverter" />

...

<Expander x:Name="MenuOverView" ExpandDirection="Left" 
                      IsExpanded="{Binding ElementName=MenuDetailed, Converter={StaticResource boolInvertorConverter}, Path=IsExpanded}"                      
                      VerticalContentAlignment="Center"  >  

...

and I provide the Converter code:

public class BoolInverterConverter : System.Windows.Data.IValueConverter
        {
            #region IValueConverter Members

            public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                bool i;
                if (bool.TryParse(value.ToString(), out i) == false) return null;            

                return !i;
            }

            public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                bool i;
                if (bool.TryParse(value.ToString(), out i) == false) return null;

                return !i;
            }

            #endregion
        }

Enjoy!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!