Solved

How to set MAXHEIGHT to a Percentage of the parent container

Posted on 2010-11-29
3
1,551 Views
Last Modified: 2013-11-12
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...
0
Comment
Question by:JElster
  • 2
3 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 34234557
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
 
LVL 1

Accepted Solution

by:
JElster earned 0 total points
ID: 34234766
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
 
LVL 1

Author Closing Comment

by:JElster
ID: 34272832
Found the solution via Google
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SignTool Error with Windows 10 5 122
Delphi Mdi application Child forms get behind control 7 162
Convert GUI app into console app for Win32 Env 5 81
Question to Pivot table 1 36
This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now