c# - Adding EventTrigger on a ListView inside DataTemplate results in XamlParseException -


i'm creating wpf app using mvvmlight. defined listview inside tabcontrol datatemplate, so:

<tabcontrol.contenttemplate>     <datatemplate>         <listview itemssource="{binding builds}"             scrollviewer.horizontalscrollbarvisibility="disabled"             selecteditem="{binding selectedbuild,                                     mode=twoway}"             selectionmode="single">             <i:interaction.triggers>                 <i:eventtrigger eventname="mousedoubleclick">                     <i:invokecommandaction command="{binding buildselectedcommand}"/>                 </i:eventtrigger>             </i:interaction.triggers>         </listview>     </datatemplate> </tabcontrol.contenttemplate> 

but xaml designer returns error (preventing load of designer preview):

xamlobjectwriterexception: collection property 'system.windows.controls.listview'.'triggers' null. @ system.xaml.xamlobjectwriter.writegetobject() @ system.xaml.xamlwriter.writenode(xamlreader reader) @ system.windows.frameworktemplate.loadtemplatexaml(xamlreader templatereader, xamlobjectwriter currentwriter) 

my command defined in viewmodel:

 private relaycommand _buildselectedcommand;  public relaycommand buildselectedcommand => _buildselectedcommand ??         (_buildselectedcommand = new relaycommand(buildselectedaction)); 

this first time i'm seeing error, , it's happening @ design time, building , runtime it's fine. removing i:interaction.triggers fix problem, need doubleclick event on list.

if ask why didn't add trigger @ listitem level, it's because have set property on viewmodel binding tabcontrol datatemplate, not listitem viewmodel.

thanks lot help!

i verified visual studio 2015 bug, doesn't repro in visual studio 2017 rc.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -