Click here to Skip to main content
15,921,548 members
Home / Discussions / WPF
   

WPF

 
QuestionHow can I determine if content fits control? Pin
fjparisIII31-Oct-09 16:01
fjparisIII31-Oct-09 16:01 
AnswerRe: How can I determine if content fits control? [modified] Pin
#realJSOP1-Nov-09 1:03
professional#realJSOP1-Nov-09 1:03 
GeneralRe: How can I determine if content fits control? Pin
fjparisIII1-Nov-09 4:40
fjparisIII1-Nov-09 4:40 
GeneralRe: How can I determine if content fits control? Pin
#realJSOP1-Nov-09 6:02
professional#realJSOP1-Nov-09 6:02 
GeneralRe: How can I determine if content fits control? Pin
fjparisIII1-Nov-09 6:40
fjparisIII1-Nov-09 6:40 
GeneralRe: How can I determine if content fits control? Pin
#realJSOP1-Nov-09 9:05
professional#realJSOP1-Nov-09 9:05 
GeneralRe: How can I determine if content fits control? Pin
fjparisIII1-Nov-09 9:57
fjparisIII1-Nov-09 9:57 
GeneralRe: How can I determine if content fits control? (Solved) Pin
fjparisIII1-Nov-09 10:41
fjparisIII1-Nov-09 10:41 
fjparisIII wrote:
Now I have to do two things:

1. See if I can find out from the ScrollViewer whether its content fits within the its vertical height. I'll report my success or failure at this attempt.


and I have been successful! I've found two ways of determining whether the content can fit into the RichTextBox, using the following code:

private void richTB_MouseEnter(object sender, MouseEventArgs e)
{
    ScrollViewer sv = (ScrollViewer)richTB.Template.FindName("PART_ContentHost", richTB);
    double height = sv.ActualHeight;
    double extentHeight = sv.ExtentHeight;
    double scrollableHeight = sv.ScrollableHeight;
}

If extentHeight > height, the content doesn't fit. Or, if scrollableHeight == 0, the content does fit!

Now I have to figure out if I actually want to use this information! Fortunately, I think it will be possible for me to use the information on top of the solution to the original problem I had, to make things even better!

Now if only we can find a dictionary up on MSDN for all these template parts (like ("PART_ContentHost"), the world would be ours! Like you, I failed to find it Googling. I searched for "PART_ContentHost" hoping to find the dictionary, and only came up with examples of using this particular part. There must be such a dictionary on MSDN. Otherwise how would anyone find out what these names are in the first place, inside information? Maybe there's a technique for getting them for any particular element through the System.Reflection namespace, something which, sad to say, I've never studied.
GeneralRe: How can I determine if content fits control? (Solved) Pin
#realJSOP1-Nov-09 23:09
professional#realJSOP1-Nov-09 23:09 
GeneralRe: How can I determine if content fits control? (Solved) Pin
#realJSOP2-Nov-09 0:04
professional#realJSOP2-Nov-09 0:04 
GeneralRe: How can I determine if content fits control? Pin
#realJSOP1-Nov-09 9:23
professional#realJSOP1-Nov-09 9:23 
QuestionMS RibbonBar Pin
#realJSOP30-Oct-09 12:48
professional#realJSOP30-Oct-09 12:48 
AnswerRe: MS RibbonBar Pin
Christian Graus30-Oct-09 14:07
protectorChristian Graus30-Oct-09 14:07 
GeneralRe: MS RibbonBar Pin
#realJSOP30-Oct-09 23:50
professional#realJSOP30-Oct-09 23:50 
AnswerRe: MS RibbonBar Pin
Mark Salsbery30-Oct-09 15:45
Mark Salsbery30-Oct-09 15:45 
GeneralRe: MS RibbonBar Pin
Christian Graus30-Oct-09 17:10
protectorChristian Graus30-Oct-09 17:10 
GeneralRe: MS RibbonBar Pin
Mark Salsbery30-Oct-09 17:33
Mark Salsbery30-Oct-09 17:33 
GeneralRe: MS RibbonBar Pin
#realJSOP30-Oct-09 23:55
professional#realJSOP30-Oct-09 23:55 
QuestionCalling property from silverlight page Pin
Deabdy2129-Oct-09 3:40
Deabdy2129-Oct-09 3:40 
AnswerRe: Calling property from silverlight page Pin
Mark Salsbery29-Oct-09 6:52
Mark Salsbery29-Oct-09 6:52 
QuestionProblem with silverlight data grid Pin
ravi.vellanky28-Oct-09 23:40
ravi.vellanky28-Oct-09 23:40 
AnswerRe: Problem with silverlight data grid Pin
Mark Salsbery29-Oct-09 6:55
Mark Salsbery29-Oct-09 6:55 
QuestionNew To silver light Pin
kKamel28-Oct-09 20:41
kKamel28-Oct-09 20:41 
AnswerRe: New To silver light Pin
Mark Salsbery29-Oct-09 7:03
Mark Salsbery29-Oct-09 7:03 
QuestionI am fresher in silver light, from where should i start ? Pin
koolprasad200328-Oct-09 20:09
professionalkoolprasad200328-Oct-09 20:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.