Thursday, 15 July 2010

silverlight textbox scrollbarvisibility -


I have a text box with a vertical scrollbar set to Auto, I want to test it to know Is the scrollbar actually appearing during the runtime? I have tried this statement:

If (text box 1. VerticalScrollBarbility == Scolarburbibility. Visual)

But that does not work. Any ideas?

Firstly enter the following extension method in the static category (either place the class in the same namespace as you Code or Namespace contains your code file using statement ): -

  public static IEnumerable & lt; DependencyObject & gt; Dynasty (this dependency object root) {int count = VisualTreeHelper.GetChildrenCount (root); (Int i = 0; i & lt; count; i ++) for {var child = VisualTreeHelper.GetChild (root, i); Yield returns child; Along with this extension method you can open ScrollViewer inside the scroll bar, which is responsible for the scroll bar and its code  

> Tested> ComputedVerticalScrollBarVisibility . >

  if (textbox1.Descendents (.) OfType & lt; ScrollViewer & gt; (). FirstOfDefault (). ComputedVerticalScrollBarVisibility == Visibility Visible )  

No comments:

Post a Comment