Solved

How to set MAXHEIGHT to a Percentage of the parent container

Posted on 2010-11-29
3
1,546 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
Comment Utility
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
Comment Utility
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
Comment Utility
Found the solution via Google
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

772 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

12 Experts available now in Live!

Get 1:1 Help Now