Note that there are some explanatory texts on larger screens.

plurals
  1. POTextBox not getting focus
    primarykey
    data
    text
    <p>I am creating the DataGridTemplateColumn dynamically.</p> <pre><code> var binding = new Binding { Path = new PropertyPath("MyProperty"), UpdateSourceTrigger = UpdateSourceTrigger.LostFocus }; var converterParameter = new List&lt;object&gt; { header, rows, myGrid }; binding.Converter = new MyConverter(); binding.ConverterParameter = converterParameter; var textBoxValue = new FrameworkElementFactory(typeof(TextBox)); totalUnitsValue.SetBinding(TextBox.TextProperty, binding); totalUnitsValue.SetValue(TextBox.HorizontalContentAlignmentProperty, HorizontalAlignment.Right); totalUnitsValue.SetValue(TextBox.WidthProperty, 40.0); totalUnitsValue.SetValue(TextBox.MarginProperty, new Thickness(4, 0, 10, 0)); var factoryElement = new FrameworkElementFactory(typeof(StackPanel)); factoryElement.SetValue(StackPanel.OrientationProperty, Orientation.Horizontal); factoryElement.AppendChild(textBoxValue ); var column = new DataGridTemplateColumn { Header = header, CellTemplate = new DataTemplate { VisualTree = factoryElement } }; myGrid.Columns.Add(column); </code></pre> <p><strong>This works fine for few columns. But if i create 10 or more columns (80 -90) textBoxes then the last created TextBoxes do not allow me to change the value or do not allow me to put focus on the TextBox. It becomes like TextBlock.</strong></p> <p><strong>EDIT:</strong></p> <p>IF I REMOVE THE STACKPANEL, THEN THERE IS NO ISSUE WITH THE TEXTBOX BUT I NEED TO SHOW MORE THAN ONE ELEMENT, SO I NEED TO HAVE SOME SORT OF CONTAINER.ANY HELP ON THAT.</p> <p>Please guide what could be tghe</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload