Possible to implement an IsViewPortVisible dependencyproperty for an item in an ItemsControl?

Posted by Matt H. on Stack Overflow See other posts from Stack Overflow or by Matt H.
Published on 2010-05-19T20:08:30Z Indexed on 2010/05/19 20:10 UTC
Read the original article Hit count: 185

Filed under:
|
|
|

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!!!! :)

© Stack Overflow or respective owner

Related posts about wpf

Related posts about .net-4.0