c# - i want my second combobox not show the selecteditem from the first one -


hallo have 1 combo box , fill database, combo box showing me ofc values db. have 1 more combo box after 1 , want not showing me selected item first one. how can archive one?

view:

  <combobox verticalalignment="center"              grid.column="1" grid.row="0" iseditable="false"             issynchronizedwithcurrentitem="false"              itemssource="{binding combo}"              selecteditem="{binding selectedteam}"              itemtemplate="{staticresource datatemp}" /> 

i tried second 1 bind in same observer able collection , use converter returns value.visibility.hidden; , did not worked.

////////////// update 1 ///////////////////////

hallo , lot answer, have tried method cannot see on 2 comboboxes not selecteditem...

<combobox itemssource="{binding}" datacontext="{binding combofiltercollection}" itemtemplate="{staticresource datatemp}" /> 

myviewmodel:

public testclassvm selecteditem { get{ return _selecteditem; } set { _selecteditem = value; onpropertychanged("selecteditem");  if ( _selecteditem != null ) { icollectionview combofiltercollection = collectionviewsource.getdefaultview(combo); combofiltercollection.filter = (i) => != selecteditem; combofiltercollection.refresh(); } else ... }  public icollectionview combofiltercollection { { return _combofiltercollection;}   set { _combofiltercollection = value; onpropertychanged("combofiltercollection");}} 

now when select on first combo box cannot see selected value on 2 combo boxes... how can possible? tried different methods did not worked out...

someone can have further idea of happening appreciated, in advance guys!

icollectionview choice

here example you

i added property combo2 of type icollectionview , added onselectedteamchange selectedteam, assuming combo has data.

   public icollectionview combo2     {         { return (icollectionview)getvalue(combo2property); }         set { setvalue(combo2property, value); }     }      // using dependencyproperty backing store combo2.  enables animation, styling, binding, etc...     public static readonly dependencyproperty combo2property =         dependencyproperty.register("combo2", typeof(icollectionview), typeof(view), new propertymetadata(null));       public object selectedteam     {         { return (object)getvalue(selectedteamproperty); }         set { setvalue(selectedteamproperty, value); }     }      // using dependencyproperty backing store selectedteam.  enables animation, styling, binding, etc...     public static readonly dependencyproperty selectedteamproperty =         dependencyproperty.register("selectedteam", typeof(object), typeof(view), new propertymetadata(null, onselectedteamchange)); 

initialized collection view , added filter filter out selectedteam source

    public void initview()     {         combo2 = collectionviewsource.getdefaultview(combo);         combo2.filter = (i) => != selectedteam;     } 

added onselectedteamchange method refresh collection view when selectedteam changes

    public static void onselectedteamchange(dependencyobject d, dependencypropertychangedeventargs e)     {         (d view).combo2.refresh();     } 

now can bind combo2 second combo have items selectedteam


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -