Quantcast
Channel: Caliburn.Micro: Xaml Made Easy
Viewing all articles
Browse latest Browse all 1760

Commented Issue: ActionMessage throws NRE when using PropertyChangedTrigger on ScrollViewer's VerticalOffset [290]

$
0
0
I know this is a pretty specific issue, but nonetheless I've reduced it down to the action message implementation.

Here's the use case: call a method on my VM when a scroller viewer reaches the end of a list. This can be done by listening to the VerticalOffset dependency property change. Unfortunately, SV does not expose a "VerticalOffsetChanged" event otherwise I'd just use the regular event binding.

So, I tried this:

```
<ScrollViewer x:Name="ScrollViewer" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Foreground="{TemplateBinding Foreground}"
Padding="{TemplateBinding Padding}">
<i:Interaction.Triggers>
<ec:PropertyChangedTrigger Binding="{Binding Path=VerticalOffset, ElementName=ScrollViewer}">
<!--<ec:CallMethodAction MethodName="ScrollOffsetChanged" TargetObject="{Binding Path=DataContext, ElementName=MyUserControl}"/>-->
<cal:ActionMessage MethodName="ScrollOffsetChanged" />
</ec:PropertyChangedTrigger>
</i:Interaction.Triggers>
<ItemsPresenter/>
</ScrollViewer>
```

The commented out code works... but unfortunately, there doesn't seem to be a way to pass in parameters using the Blend CallMethodAction which is all I need (the VerticalOffset parameter).

The funny thing is, this works if I switch to some other property, like DataContext. VerticalOffset seems to be an issue with this specifically.
Comments: What is with the sample project? I'm sorry to say, but if there is no new input, I have to close this issue.

Viewing all articles
Browse latest Browse all 1760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>