1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| TextBox tt = new TextBox();
tt.Name = "TxtRDV";
DataTemplate template = new DataTemplate();
FrameworkElementFactory factoryTextBox = new FrameworkElementFactory(typeof(TextBox), tt.Name);
if (((System.Collections.CollectionBase)(((System.Windows.Data.ListCollectionView)((System.Windows.Data.CollectionView)(dd.DataContext))).SourceCollection)).Count > 0)
{
Binding bb = new Binding ();
bb.Mode = BindingMode.TwoWay;
bb.Source = tt;
bb.Path = new PropertyPath("tache", ((PersistDATA.CollHeures)((view).CurrentItem)).tache);
tt.SetBinding(TextBox.BindingGroupProperty, bb);
factoryTextBox.SetBinding(TextBox.BindingGroupProperty, bb);
}
factoryTextBox.SetValue(TextBox.StyleProperty, tt.Style);
FrameworkElementFactory factoryTextGrid = new FrameworkElementFactory(typeof(Grid));
factoryTextGrid.AppendChild(factoryTextBox);
template.VisualTree = factoryTextBox;
colx.CellTemplate = template; |