Event Trigger Problem

Event Trigger Problem

Old forum URL: forums.lhotka.net/forums/t/8917.aspx


ambreshgaur posted on Wednesday, May 12, 2010

Sample 1 ...

<

 

custom:CDataGrid x:Name="dgWhseContainer" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" SelectionMode="Single" AutoGenerateColumns="False" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Visible" ItemsSource="{Binding Path=ContainerInfo}" csla:InvokeMethod.TriggerEvent="SelectionChanged" csla:InvokeMethod.MethodName="KeepInfoForSelectedRow" csla:InvokeMethod.MethodParameter="{Binding RelativeSource={RelativeSource Self}, Path=SelectedItem}">

 

Sample 2 .....

<

 

custom:CDataGrid x:Name="dgWhseContainer" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" SelectionMode="Single" AutoGenerateColumns="False" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Visible" ItemsSource="{Binding Path=ContainerInfo}" csla:InvokeMethod.TriggerEvent="SelectRowClicked" csla:InvokeMethod.MethodName="KeepInfoForSelectedRow" csla:InvokeMethod.MethodParameter="{Binding RelativeSource={RelativeSource Self}, Path=SelectedItem}">

 

 

Sample 1 ...has TriggerEvent = "SelectionChanged"

Sample 2 has TriggerEvent = "SelectRowClicked"

Sample 1 works but Sample2 gives error ...

Please Help

Ambresh

ambreshgaur replied on Wednesday, May 12, 2010

Error is ..........AG_E_PARSER_BAD_PROPERTY_VALUE [Line: 163 Position: 59]

Looks like it doesnt accept "SelectRowClicked"   event ..... but why?

RockfordLhotka replied on Wednesday, May 12, 2010

I don't know. That's a XAML parse error, so I don't believe it is coming from CSLA at all - that would occur before CSLA ever gets involved...

ambreshgaur replied on Wednesday, May 12, 2010

This is the line included in at top ...

xmlns

 

:csla="clr-namespace:Csla.Silverlight;assembly=Csla"

And the error is at the following line ...

csla

 

:InvokeMethod.TriggerEvent="SelectRowClcked"

Do you still say that it has got nothing to do with CSLA? ..........If I remove the Top line .....I could not even use the InvokeMenthod

Ambresh

RockfordLhotka replied on Wednesday, May 12, 2010

I said the problem is a XAML parsing problem, not that it had nothing to do with CSLA Smile

Though depending on which version of CSLA you are using, it is possible that InvokeMethod is trying to resolve the event immediately as the XAML is parsed. If that event isn't there, then CSLA would throw an exception, which would be swallowed by the XAML parser and turned into the ugly/useless message you are seeing.

So that's probably the most likely issue - that event just doesn't exist, or at least is not an event InvokeMethod can handle. InvokeMethod can only handle events that follow the standard EventHandler or RoutedEventHandler signatures, otherwise it doesn't know what to do with them.

Copyright (c) Marimer LLC