WPF datagrid - enable selecting, disabling text input?

One possibility is probably be to use a DataGridTemplateColumn: DataGridTemplateColumn.

One possibility is probably be to use a DataGridTemplateColumn: This works also with Checkboxes, add a CheckBox, Bind its IsChecked and use as the content a TextBox that is set to IsReadOnly. If you want to have the checkbox readonly, set its Enabled-property to false. However in this case, you have to declare the TextBox not as a child but as a sibling of the CheckBox (use a grid or a StackPanel) for this.

If you want to make data readonly for the whole DataGrid, use: Ts is also possible for columns: If you want to define it per row, you have to use DataGridTemplateColumns and bind the IsReadOnly-proeprty of the edit-control.

My DataGrid is bound to a DataTable, I create the DataTable and the columns in the code, since the number of columns is known only in runtime. Is there a way to define new datagridtemplatecolumns this way, but dynamically? – Yoni Apr 30 at 1:04 @Yoni: One possibility is to use XamlReader to build your DataGridTemplateColumns on the fly (by string concatenation) and add them then to the columns collection.It looks not very nice but I remember that I have done this also in a similar situation and it worked fine: msdn.microsoft.

Com/en-us/library/cc663033. Aspx – HCL Apr 30 at 9:32.

I'm fairly sure that if you set the DataGridTextBoxColumn's IsReadOnly property to true, you'll still be able to select and copy the contents.

Unfortunately, this is not true. – Kugel Aug 10 at 16:59.

If your users usually copy an entire cell at once you can set the DataGrid's SelectionUnit to Cell If they copy sections of a cell you're better off overwriting the CellTemplate to display a Label as HCL recommended.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions