c# - How to put textblock inside scrollviewer by coding behide ? (wpf) -
i have xaml code
<grid> <... grid row , column definitions .../> <scrollviewer grid.column="1" verticalscrollbarvisibility="auto"> <textblock "some attribute" /> </scrollviewer> </grid>
i don't know how tie textblock
scrollviewer
in c#
. want use textblock
scrollviewer
. if have idea, please tell me.
many help. :d
just use content property
var myscrollviewer = new scrollviewer(); myscrollviewer.content= new textblock();
edit
or in combination xaml
xaml
<scrollviewer name="myscrollviewer " grid.column="1" verticalscrollbarvisibility="auto"/>
code behind
myscrollviewer.content= new textblock(); // or ever want add :-)