Windows Phone 7 problem?

Jul 18, 2011 at 8:19 PM

HI,

 

I'm writing now WP7 app and I have problem with parameters in ExecuteCommandAction.

When code in XAML is like this:

<ListBox Grid.Row="1" x:Name="NewsList" BorderThickness="0" Padding="0" ItemsSource="{Binding Listing}" SelectionMode="Single"
		         ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Auto">
			<i:Interaction.Triggers>
				<i:EventTrigger EventName="SelectionChanged">
					<nBehaviors:ExecuteCommandAction 
						CommandBinding="{Binding SelectNewsCommand}" />
				</i:EventTrigger>
			</i:Interaction.Triggers>
It is working, but when I add Parameter:

		<ListBox Grid.Row="1" x:Name="NewsList" BorderThickness="0" Padding="0" ItemsSource="{Binding Listing}" SelectionMode="Single"
		         ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Auto">
			<i:Interaction.Triggers>
				<i:EventTrigger EventName="SelectionChanged">
					<nBehaviors:ExecuteCommandAction 
						CommandBinding="{Binding SelectNewsCommand}"
						Parameter="{Binding ElementName=NewsList, Path=SelectedItem}" />
				</i:EventTrigger>
			</i:Interaction.Triggers>

I'm getting this error:

System.Windows.Markup.XamlParseException occurred  Message=AG_E_PARSER_BAD_PROPERTY_VALUE [Line: 56 Position: 7]  LineNumber=56  LinePosition=7  StackTrace:       at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)       at PolskieRadio.Views.Listen.InitializeComponent()       at PolskieRadio.Views.Listen..ctor()       at System.Reflection.RuntimeConstructorInfo.InternalInvoke(RuntimeConstructorInfo rtci, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)       at System.Reflection.RuntimeConstructorInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)       at System.Reflection.ConstructorInfo.Invoke(Object[] parameters)       at nRoute.Components.Composition.TypeBuilder.<>c__DisplayClass7.<CreateReflectedDescriptorBuilder>b__1(List`1 p)       at nRoute.Components.Composition.TypeBuilder.<>c__DisplayClass7.<CreateReflectedDescriptorBuilder>b__5()       at nRoute.Components.Composition.TypeBuilder.BuildType(Type type, Boolean useReflection)       at nRoute.Components.Composition.TypeBuilder.BuildType(Type type)       at nRoute.Navigation.Mapping.DefaultNavigationContentLocator.CreateNavigationTypeInstance(ParametersCollection parameters)       at nRoute.Navigation.Mapping.NavigationContentHandler.<>c__DisplayClass1.<GetResponse>b__0(LazyRelayObservable`1 o)       at nRoute.Components.LazyRelayObservable`1.Subscribe(IObserver`1 observer)       at nRoute.Components.RelayExtensions.Subscribe[T](IObservable`1 source, Action`1 onNext, Action`1 onError, Action onCompleted)       at nRoute.Components.RelayExtensions.Subscribe[T](IObservable`1 source, Action`1 onNext, Action`1 onError)       at nRoute.Components.Routing.RoutingService.OnResolveResponse(IRoutingContext context, Boolean throwException, Action`1 responseCallback)       at nRoute.Components.Routing.RoutingService.<>c__DisplayClass1.<Resolve>b__0(IRoutingContext c, ResponseStatus s)       at nRoute.Components.Routing.RoutingService.OnResolveRequest(IUrlRequest request, Boolean throwException, Action`2 requestCallback)       at nRoute.Components.Routing.RoutingService.Resolve(IUrlRequest request, Action`1 responseCallback)       at nRoute.Navigation.NavigationService.Resolve(NavigationRequest navigationRequest, Action`1 responseCallback)       at nRoute.Navigation.NavigationService.<>c__DisplayClass9.<Navigate>b__7(Boolean b)       at nRoute.Controls.NavigationContentControl.OnProcessRequest(NavigationRequest request, Action`1 requestCallback)       at nRoute.Controls.NavigationContainer.OnProcessRequest(NavigationRequest request, Action`1 requestCallback)       at nRoute.Controls.NavigationContentControl.nRoute.Navigation.INavigationHandler.ProcessRequest(NavigationRequest request, Action`1 requestCallback)       at nRoute.Navigation.NavigationService.Navigate(NavigationRequest navigationRequest, INavigationHandler navigationHandler, Action`1 statusCallback)       at nRoute.Navigation.NavigationService.Navigate(NavigationRequest navigationRequest, INavigationHandler navigationHandler)       at nRoute.Controls.NavigationContentControl.OnNavigate(NavigationRequest request)       at nRoute.Controls.NavigationContentControl.Navigate(String url, ParametersCollection requestParameters)       at nRoute.Controls.NavigationContentControl.Navigate(String url)       at nRoute.Controls.NavigationContentControl.OnUrlChanged(String oldUrl, String newUrl)       at nRoute.Controls.NavigationContentControl.OnUrlPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)       at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)       at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)       at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)       at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value)       at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)       at nRoute.Controls.NavigationContentControl.set_Url(String value)       at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)       at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)       at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)       at MS.Internal.FrameworkCallbacks.SetPropertyOrAddItem(Object target, PropertyInfo propertyInfo, Object value, Int32 typeIndex, String propertyName)       at MS.Internal.FrameworkCallbacks.SetNonAttachedProperty(Object target, String propertyName, Object propertyValue, Int32 typeIndex)       at MS.Internal.FrameworkCallbacks.SetValueToProperty(Object target, String propertyName, Object propertyValue, Int32 typeIndex, String attachedDPOwnerNamespace, String attachedDPOwnerAssembly)       at MS.Internal.FrameworkCallbacks.SetPropertyAttribute(IntPtr nativeTarget, String attrName, String attrValue, String attachedDPOwnerNamespace, String attachedDPOwnerAssembly)       at MS.Internal.XcpImports.Application_LoadComponentNative(IntPtr pContext, IntPtr pComponent, UInt32 cUriStringLength, String uriString, UInt32 cXamlStrLength, Byte* pXamlStr, UInt32 cAssemblyStrLength, String assemblyStr)       at MS.Internal.XcpImports.Application_LoadComponent(IManagedPeerBase componentAsDO, String resourceLocator, UnmanagedMemoryStream stream, UInt32 numBytesToRead, String assemblyString)       at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)       at PolskieRadio.MainPage.InitializeComponent()       at PolskieRadio.MainPage..ctor()       at System.Reflection.RuntimeConstructorInfo.InternalInvoke(RuntimeConstructorInfo rtci, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)       at System.Reflection.RuntimeConstructorInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)       at System.Activator.InternalCreateInstance(Type type, Boolean nonPublic, StackCrawlMark& stackMark)       at System.Activator.CreateInstance(Type type)       at System.Windows.Navigation.PageResourceContentLoader.BeginLoad_OnUIThread(AsyncCallback userCallback, PageResourceContentLoaderAsyncResult result)       at System.Windows.Navigation.PageResourceContentLoader.<>c__DisplayClass4.<BeginLoad>b__0(Object args)       at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)       at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)       at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)       at System.Delegate.DynamicInvokeOne(Object[] args)       at System.MulticastDelegate.DynamicInvokeImpl(Object[] args)       at System.Delegate.DynamicInvoke(Object[] args)       at System.Windows.Threading.DispatcherOperation.Invoke()       at System.Windows.Threading.Dispatcher.Dispatch(DispatcherPriority priority)       at System.Windows.Threading.Dispatcher.OnInvoke(Object context)       at System.Windows.Hosting.CallbackCookie.Invoke(Object[] args)       at System.Windows.Hosting.DelegateWrapper.InternalInvoke(Object[] args)       at System.Windows.RuntimeHost.ManagedHost.InvokeDelegate(IntPtr pHandle, Int32 nParamCount, ScriptParam[] pParams, ScriptParam& pResult)

Jul 18, 2011 at 8:24 PM

ok.. this was easy - why it take me 1h? ;) ParameterBinding instead Parameter...