xaml - Why MVVM/WPF ComboBox SelectedItem is null in multibinding to other control's Visibility? -


edit: bound same property (searchtype) combobox binds -> works fine. still know why first solution described here not work.

i have

public enum searchtype {     networkobjects,     customers } 

in viewmodel contructor:

public  searchviewmodel() {     searchtype = panels.searchtype.networkobjects; 

in xaml:

<usercontrol.resources>     <xpui:convertsearchtypetovisibility x:key="searchtypetovisibilityconverter" /> </usercontrol.resources>  <combobox             name="searchtypecombobox"             itemssource="{binding path=searchtypes}"             selecteditem="{binding path=searchtype, mode=twoway}"> ... <datagrid.visibility>    <multibinding converter="{staticresource searchtypetovisibilityconverter}">        <binding relativesource="{relativesource self}" path="name"/>            <binding elementname="searchtypecombobox" path="selecteditem" />    </multibinding> </datagrid.visibility> 

converter:

public object convert(object[] values, type targettype, object parameter, system.globalization.cultureinfo culture) {     string gridname = (string)values[0];     searchtype searchtype = (searchtype)values[1]; 

in convert-method values have 2 items , values[1]==null. if take away binding selecteditem searchtype.networkobjects set in viewmodel constructor. do wrong?

i expect there going wrong in code haven't posted. wrote solution similar behavior using provided code , there no case values[1] == null unless removed combobox.selecteditem binding.

here working sample.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -