Solved

How to set MAXHEIGHT to a Percentage of the parent container

Posted on 2010-11-29
3
1,556 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows 10 Scheduled Tasks 11 103
WPF issue with Trigger 2 129
Using MS Code on my Mac 6 72
How do ASP.NET and MVC work together? 4 70
This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

740 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