Questions tagged [datagridtextcolumn]

Represents a DataGrid column that hosts textual content in its cells.

Represents a DataGrid column that hosts textual content in its cells. This column hosts TextBlock elements for cells that are not in editing mode and a TextBox control for a cell that is in editing mode.

By default, the DataGrid control generates columns automatically when you set the ItemsSource property. The generated columns are of type DataGridCheckBoxColumn for bound Boolean (and nullable Boolean) properties, and of type DataGridTextColumn for all other properties. If a property does not have a String or numeric value type, the generated text box columns are read-only and display the data object's ToString value.

112 questions
3
votes
2 answers

How to restyle TextBox of DataGridTextColumn?

I am working with a Wpf application. I have created a custom style for wpf DataGrid (provided in Wpf Toolkit). It all works fine except that I am unable to apply a Style on the TextBox that comes on double clicking the cell(editable mode) in…
viky
  • 17,275
  • 13
  • 71
  • 90
3
votes
1 answer

Adding an event or command to DataGridTextColumn

I am adding a Custom DataGridTextColumn that will allow me to fire an event when when ever the content is changed in this cell. Please note: I do not want to use a DataGridTemplateColumn with this as I know that. I want to create my own text column…
JamTay317
  • 1,017
  • 3
  • 18
  • 37
3
votes
2 answers

WPF, create Custom DataGridTextColumn to Prevent unwanted Character

i newbie to WPF, i want to prevent user to input character, eg. character "-", so i created custom DataGridTextColumn with following code : public class DataGridNumericColumn : DataGridTextColumn { protected override object…
Chandra Arifin
  • 43
  • 1
  • 11
3
votes
1 answer
3
votes
2 answers

Is there a way to change the binding of a DataGridTextColumn when that column goes into edit mode?

All I really want to do is change the StringFormat for a particular binding on a DataGridTextColumn, but since that is defined by the binding, I suppose that I need to change the entire binding somehow. The reason that I want to avoid using a…
Jon Erickson
  • 112,242
  • 44
  • 136
  • 174
2
votes
0 answers

Datagrid column width (not autogenerated) don't change if datacontext changes

i have a wpf datagrid with several defined DataGridTextColumns. When i bind long strings (100 characters) the bounded column grows correctly depending on content. When the datacontext change and the bounded strings gets shorter (10 characters) the…
Jana Hehr
  • 21
  • 1
2
votes
1 answer

WPF/DataGrid: Binding to different properties for displaying and editing

I have an object that contains eg a string property like "10; 20; 30". I have also a get property that splits the string, converts each part to a double and sums them up. Thus I have "10; 20; 30" and 60.0 (as double). Now the question is. Is there a…
be_mi
  • 529
  • 6
  • 21
2
votes
1 answer

C# DataGridTextColumn line break

There must be a simple solution for this, but I just can't find it. I have a DataGrid with DataGridTextColumns which contain data. This is working fine. I just seem to not get the String inside the Cells to make a line break, instead everything is…
Vitriol
  • 49
  • 1
  • 6
2
votes
1 answer

WPF datagridtextcolumn - always show textbox

By default the WPF datagridtext appears as a label and enters an edit state upon clicking. Is there a way to modify the column so that the textbox is always visible (instead of depending on the click event)? Thanks in advance, JP
JP.
  • 5,536
  • 7
  • 58
  • 100
1
vote
1 answer

WPF DataGridTextColumn - Use '-' instead of '0'

How can I get a DataGridTextColumn to display a '-' (hyphen) instead of 0. Here is how the data grid is currently setup:
BrianKE
  • 4,035
  • 13
  • 65
  • 115
1
vote
2 answers

How to Format a DataGrid column in code using a binding

I can't figure out how to add the format parameter to the following DataGrid column. I need to show the number with two decimal points. I have a silverlight DataGrid that I'm adding columns to dynamically. I create the column and apply a dynamic…
1
vote
1 answer

DataGridTextColumn namespace found in silverlight MainPage xaml code behind, but not found in silverlight library

I'm successfully using DataGridTextColumn in a silverlightapp main page code behind. This works: using System.Windows.Controls; namespace myNamespace { public partial class MainPage { private DataGridTextColumn…
Brad Boyce
  • 1,248
  • 1
  • 17
  • 34
1
vote
1 answer

Failed to assign to property 'Microsoft.Toolkit.Uwp.UI.Controls.DataGridTextColumn.Foreground

UWP file explorer app I am trying to use a ThemeResource in foreground for a DataGridTextColumn, but when opening the app it crashes, and I get this error: Failed to assign to property…
Rickxp
  • 13
  • 4
1
vote
1 answer

How to get text pixel size in DataGridTextColumn

I'm trying to find out the pixel size of the text (with the maximum length) in a DataGridTextColumn in WPF using the MVVM pattern so that I can set the minimum width of the DataGridTextColumn. Can anyone help me with this?
Gurdeep
  • 25
  • 3
1
vote
1 answer

WPF DataGridTextColumn and Tag

I have a datagrid with several DataGridTextColumn defined. I need to use the Textblock's Tag property. I can't find it on a DataGridTextColumn. I found a workaround which works, i.e a DataTemplateColumn in which I declare the textblock, in which…
Louitbol
  • 170
  • 1
  • 16