c# - Quick access to elements of user control -


i have user control (e.g.):

<usercontrol x:class="tester.uc" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:tester" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d" d:designheight="300" d:designwidth="400">  <grid>     <textblock name="name" horizontalalignment="left" margin="10,10,0,0" textwrapping="wrap" text="textblock" verticalalignment="top" height="79" width="380" fontsize="50" textalignment="center"/>     <button content="button" horizontalalignment="left" margin="152,179,0,0" verticalalignment="top"/>     <textbox name="lastname" horizontalalignment="left" margin="0,109,0,0" textwrapping="wrap" text="textbox" verticalalignment="top" width="390" height="65" textalignment="center" fontsize="40"/>  </grid> 

to access control have use name , property. liike this.

uc uc = new uc(); uc.lastname.text = "text"; 

is there way access quicker? mean...

uc.lastname = "text"

you can declare property in code-behind wrap lastname.text. example

public string lastnametext {     { return lastname.text; }     set { lastname.text = value; } }  <textbox name="lastname" x:fieldmodifier="private"/> 

does worth it? doubt it.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -