Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

DataGrid: Different Cell Types in Same Column

$
0
0

I have a ViewModel that has among others the following properties (not showing any MVVM related code):

class MyVM {
   string Name { get; set; }
   Type Type { get; set; }
   object Value { get; set; }
}

Basically, it's like the "Properties" window in Visual Studio. I have the name or the property, the type it can accept (either int, float, string or list) and the actual value. I want to show those in a DataGrid. The Value column should create cells based on the Type property, i.e. a text field if the type is string, a text field only accepting int if the type is int, etc. I only see solutions where the type is changed for an entire column but not on a cell-by-cell basis. How do I do this?


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>