and in xmal we are write binding code
<TextBox Name="txtComments1" MaxLength="100" Width="213" Text="{Binding PurchaseOrder.Comments, Mode=TwoWay}" HorizontalAlignment="Left" VerticalAlignment="Top" Canvas.Left="204" Canvas.Top="375" TabIndex="10" Height="39" MinHeight="15" />
How write in c#
private void button_Click(object sender, RoutedEventArgs e)
{
txtSource = new TextBox();
txtSource.MinHeight = 15;
txtSource.Width = 100;
txtSource.Height = 25;
txtSource.Name = "txtSource";
txtSource.HorizontalAlignment = HorizontalAlignment.Left;
Binding txtBinding = new Binding("PurchaseOrder.PickupSrcCodeName"); /*txtBinding.Mode = BindingMode.OneWay;*/
txtSource.SetBinding(TextBox.TextProperty, txtBinding);
ColumnDefinition colDef1;
colDef1 = new ColumnDefinition();
mymy.ColumnDefinitions.Add(colDef1);
RowDefinition rowDef1;
rowDef1 = new RowDefinition();
mymy.RowDefinitions.Add(rowDef1);
++count;
abc.Children.Add(txtSource);
Grid.SetColumn(txtSource, count);
Grid.SetRow(txtSource, 0);
txtSource.GotFocus += t_GotFocus;
//txtSource.TextChanged += this.t_TextChanged;
txtSource.KeyDown += t_KeyDown;
}
Can you answer this question?
Answer
0 Answers