Solved

How to set MAXHEIGHT to a Percentage of the parent container

Posted on 2010-11-29
3
1,573 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

630 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