c# - WPF Button content to Textbox -
i'm trying create calculator , first time coding using gui
i'm using visual studio 2012 wpf using c# application
how button content calculator textbox (screen) ?
xaml:
<button x:name="one" style="{staticresource {x:static toolbar.buttonstylekey}}" foreground="white" fontsize="20" fontweight="bold" width="50" height="41" content="1" margin="31,350,491,64" click="button_click" horizontalalignment="left" verticalalignment="bottom"/>
c#:
private void button_click(object sender, eventargs e) { button b = (button)sender; screen.text = screen.text + b.text; }
it underlines text next b.
error 1 'system.windows.controls.button' not contain definition 'text' , no extension method 'text' accepting first argument of type 'system.windows.controls.button' found (are missing using directive or assembly reference?)
time larn msdn! here page button
class. notice there no text
property, there content
property. have cast string
content
of type object
.
screen.text = screen.text + b.content.tostring();
note simplify code to:
screen.text += b.content.tostring();
c# wpf xaml button textbox
No comments:
Post a Comment