How to set MAXHEIGHT to a Percentage of the parent container

Hi..
I have a treeview in a border how can I set the MAXHEIGHT property to be 75% the height of the border... regardless of the resolution or window size...
LVL 1
JElsterAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
JElsterConnect With a Mentor Author Commented:
I was able to do it like this

  WinControls.TreeView tv = sender as WinControls.TreeView;

            if (tv != null)
            {
                FrameworkElement element = tv.Parent as FrameworkElement;

                tv.MaxHeight = (element.ActualHeight / 100) * 85;
            }
0
 
Bob LearnedCommented:
I am not sure that I understand just what you need, but you might be able to use a GridLength parameter with GridUnitType.Star and a weighted value to set the value to be a percentage.  That would only apply where a GridLength value is allowed.
0
 
JElsterAuthor Commented:
Found the solution via Google
0
All Courses

From novice to tech pro — start learning today.