Salut, je suis débutante, je fais ma première app c# wpf
voici ce que j'ai fais :
Dans textbox il faudrait écrire son nom, et en en faisant un click sur le bouton, dans textblock, on aurait le texte 'Hello' + le nom rentré dans la textbox.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 namespace MyApp { public partial class MainPage : PhoneApplicationPage { public MainPage() { InitializeComponent(); Title = "Page1"; Height = 500; Width = 500; TextBox NameTxtBox = new TextBox(); NameTxtBox.Width = 300; Button Button1 = new Button(); Button1.Content = "ok"; TextBlock TxtBlock = new TextBlock(); TxtBlock.Width = 300; StackPanel MyStackPanel = new StackPanel(); MyStackPanel.Margin = new Thickness(10); MyStackPanel.Height = 500; MyStackPanel.Width = 500; MyStackPanel.Children.Add(NameTxtBox); MyStackPanel.Children.Add(ValidateButton); MyStackPanel.Children.Add(TxtBlock); Content = MyStackPanel; } } }
J'ai pas encore les notions, je dois faire un bouton_click en dehors de public mainpage(), mais comment accèder a textblock ?
Partager