Possible to implement an IsViewPortVisible dependencyproperty for an item in an ItemsControl?
- by Matt H.
I need to enable/disable spell checking in a richtextbox in an ItemsControl, based on whether the RichTextBox is visible in the ItemsControl's Scrollviewer.
I think the route is to implement an IsViewPortVisible dependency property and wire an event handler for a changed event...
I found this article that describes the lengthy process for determining if an item is in the viewport:
http://social.msdn.microsoft.com/Forums/en/wpf/thread/e6ccfec3-3dc0-4702-9d0d-1cfa55ecfc90
Any ideas on where to start? I'm familiar with implementing my own dependency property for the sake of simple bindings (integers, strings, etc...). I have no idea how to undergo something like this though)
This is the end result I'm hoping for:
<DataTemplate>
<Grid>
...Stuff in the Grid
<local:CustomRichTextBox SpellCheck.IsEnabled={Binding RelativeSource={RelativeSource Self}, Path=IsViewPortVisible}/>
</Grid>
</DataTemplate>
Help will be EXTREMELY appreciated... you'll be saving me about 500MB in memory consumption while the program is running!!!! :)