none
What' is System.Windows.Controls.TextBoxView ?

    Question

  • I have a simple scene: There are some TextBox controls and TextBlock controls in canvas.
      I want to use "HitTest" to  determine which control i selected when i click mouse on the contorls.

    But i only capture the TextBlock and can't capture TextBox
    I add a breakpoint  and find that: the type is "System.Windows.Controls.TextBoxView" which the "htr.VisualHit" return....

    But I can't find the System.Windows.Controls.TextBoxView in c#
    These are my code
     void canvas1_PreviewMouseDown(object sender, MouseButtonEventArgs e)
            {
               VisualTreeHelper.HitTest((UIElement)sender, null, resultCallback, new PointHitTestParameters(e.GetPosition((UIElement)sender)));
            }
            HitTestResultBehavior resultCallback(HitTestResult htr)
            {
                MessageBox.Show(htr.VisualHit.GetType().ToString());
                return HitTestResultBehavior.Stop;
            }

    any suggestion would be appreciated...
    Tuesday, December 05, 2006 10:19 AM

Answers

All replies

  • it is an internal lightweight class handling the rendering of content in the textbox.
    Tuesday, December 05, 2006 3:51 PM
    Moderator
  • Hi, LesterLobo
        Can I manipulate or reference it?
    Wednesday, December 06, 2006 12:59 AM
  • this is an internal class and hence not available for manipulation
    Thursday, December 07, 2006 4:56 AM
    Moderator
  • thanks LesterLobo
    Thursday, December 07, 2006 7:36 AM
  • ...I was implementing something similar to this and it took me a while to figure out how to get from a TextBoxView to a TextBox so thought I'd document that calling "VisualTreeHelper.GetParent" a few times did the trick!
    Thursday, June 12, 2008 12:38 PM