c# - Combo box causes app to crash when accessed using a touch interface, but works with a mouse -


i have combo box displays list of repositories on database, , event have dropdownopened event, during access database list of items display.

everything works great using mouse open combo box , select item, when use touch screen (either on windows 8 or surface) there problems.

the first time open combo box , select there no issues, after i've selected item, if try open list again, app crashes.

here xaml combo box:

    <combobox x:name="repositorycombobox" grid.row="3" grid.column="1"  selecteditem="{binding selectedrepository, mode=twoway}" itemssource="{binding repositorylist, mode=twoway}"                     style="{staticresource comboboxstyle}"  isenabled="true" dropdownopened="reposdrop"/> 

and code drop down opened event:

    private async void reposdrop(object sender, object e)     {          viewmodel.repositorylist = null;             try             {                 await viewmodel.getrepositories(); //accesses database through wcf service             }             catch (exception)             {                 return;             }      } 

any ideas on causing issue?

edit error i'm getting

    exception   {"error hresult e_fail has been returned call com component."} 

it's possible viewmodel.getrepositories() call updates list contents on background thread. check if still crashes if don't call it. can try delaying call, e.g. await task.delay(100) in case combobox doesn't contents updating while it's opening.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -