private void ButtonClickEvent(object sender, RoutedEventArgs e) { Button but = (Button)sender; UserInfo p = new UserInfo(Convert.ToInt32((XP_Custom_Id.GetMyProperty(but)))); this.NavigationService.Navigate(p); }
private void SetLabelAndTB(string L_Content, string TB_Text, int row, int coloumn, out Label Label, out Button Button, out TextBlock txtBlock, Grid DynamicGrid, int ID) { Label = new Label(); Label.Content = L_Content; Grid.SetRow(Label, row); Grid.SetColumn(Label, 0); txtBlock = new TextBlock(); txtBlock.Text = TB_Text; Grid.SetRow(txtBlock, row); Grid.SetColumn(txtBlock, coloumn); Button = new Button(); XP_Custom_Id.SetMyProperty(Button, ID.ToString()); Button.Click += new RoutedEventHandler(ButtonClickEvent); Button.Content = "More"; Grid.SetRow(Button, 6); Grid.SetColumn(Button, 4); Label line = new Label(); line.Content = "-------------------------------------"; Grid.SetRow(line, 7); Grid.SetColumn(line, 0); DynamicGrid.Children.Add(txtBlock); DynamicGrid.Children.Add(Label); DynamicGrid.Children.Add(Button); DynamicGrid.Children.Add(line); }