c# - How do I use a textblock for navigation? -


i new windows dev't , c#, how make texts posted in code navigate xaml page?

thanks

<stackpanel>         <textblock text="contact us"                textwrapping="wrap"                 style="{staticresource phonetextextralargestyle}"                fontsize="{staticresource phonefontsizeextralarge}"/>     <textblock text="help"                 textwrapping="wrap"                style="{staticresource phonetextextralargestyle}"                fontsize="{staticresource phonefontsizeextralarge}"/> </stackpanel> 

there several ways this. based on you've described, 1 way link an event window.show() method, show window. see links i've provided here examples , thoughts, insert textblock cause method happen when mouse-click on it:

<textblock text="contact us"            textwrapping="wrap"             style="{staticresource phonetextextralargestyle}"            fontsize="{staticresource phonefontsizeextralarge}"            mouseup="methodtocallnamehere"/> 

when write in xaml, highlight "methodtocallnamehere" , press f12, , automatically insert method in window's code-behind. can put in new window's class there .show().

for example, if wanted show new window aboutwindow class (i.e., when created xaml window, named "aboutwindow"), highlight "methodtocallnamehere" , press f12.

then, in created method in code-behind, make this, open "aboutwindow" window when textblock clicked:

    private void methodtocallnamehere(object sender, system.windows.input.mousebuttoneventargs e)     {         // instantiate new window's class         aboutwindow aboutwindow = new aboutwindow();         // call .show() method show new window         aboutwindow.show();     } 

i'd recommend looking through ms's online (and free) documentation on wpf applications here. it's been helpful me i've been learning.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -