c# - RTB now showing everyhting -


i have wpf richtextbox associated flowdocument. supposing number lines in flowdocument 1..60 richtextbox not tall enough show numbers. enter image description here

but that's fine since can scroll through mouse wheel. problem procedure doesn't scroll enough can see in following picture:

enter image description here

you may see here merely gets line 50 instead line 60. it's not problem of overlapping other elements.

thank in advance help. patrick

---add--- here's xaml

    <grid name="grdreport_rtf" visibility="hidden">         <richtextbox x:name="rtbreport_rtf" margin="10"  borderbrush="gray" background="white" foreground="black" isenabled="true" padding="10" style="{dynamicresource rtbstyledoclocal}" />     </grid> 

with

<style x:key="rtbstyledoclocal" targettype="{x:type richtextbox}">         <style.resources>             <style x:key="{x:type flowdocument}" targettype="{x:type flowdocument}">                 <setter property="overridesdefaultstyle" value="true"/>             </style>             <style x:key="{x:type hyperlink}" basedon="{staticresource {x:type hyperlink}}" targettype="{x:type hyperlink}">                 <style.triggers>                     <trigger property="ismouseover" value="true">                         <setter property="foreground" value="blue"/>                     </trigger>                     <trigger property="isenabled" value="true">                         <setter property="foreground" value="black"/>                     </trigger>                 </style.triggers>             </style>         </style.resources>         <setter property="minwidth" value="10"/>         <style.basedon>             <staticresource resourcekey="{x:type textboxbase}"/>         </style.basedon>     </style> 

--add2---

i populate flowdoc with

application.current.dispatcher.invoke(new action(() => fdocrtb.blocks.clear())); if (file.exists(strcompletefilename)) {     using (var sr = new streamreader(strcompletefilename))     {         string line = sr.readtoend();         application.current.dispatcher.invoke((action)(() => fdocrtb = addlinetortb(fdocrtb_beretta, line, false, rtb_lineheight, rtb_fontsize)));     } } 

and

    private flowdocument addlinetortb(flowdocument fdoc, string str, bool istitle, double lineheight, double fontsize)     {         paragraph par;         var run = new run(str);         run.foreground = brushes.black;         if (!istitle)             run.fontweight = fontweights.normal;         else             run.fontweight = fontweights.black;         run.fontsize = fontsize;         run.fontfamily = ffrtb;         par = new paragraph() { lineheight = lineheight, fontsize = fontsize };         par.inlines.add(run);         application.current.dispatcher.invoke((action)(() => fdoc.blocks.add(par)));         return fdoc;     } 

--add 3-- more clues solution: if read file contains numbers 1..60 scrolling down max effect is:

[![enter code here][3]][3] 

instead if add more lines letter a...z scrolling down max effect is:

enter image description here

so beyond 60!!!! not z

have confirmed it's not stretching rtb outside visible area? easiest way check set height="200" on rtb , see how scrolling works.

in fact, in screenshots, think see 1px lighter gray border down side, not across bottom -- suggest actual bottom of control has been pushed down out of sight. effect easier sure of if give borderbrush="red", testing.

default xaml dwim (actually "do would mean, if meant wrong") layout common cause of scrolling issues in wpf.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -