Hello,
I have a xamDataGrid on my window, like this
<igDP:XamDataGrid Margin="2" Name="TechList" VerticalAlignment="Top" Background="{x:Null}" RecordActivated="TechList_RecordActivated" Theme="Office2k7Blue" GroupByAreaLocation="None" MinWidth="120" > <igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout> <igDP:Field Name="TECHID" Width="Auto" Label="Tech ID" /> <igDP:Field Name="TECHNAME" Width="Auto" Label="Name" /> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> </igDP:XamDataGrid>
And in the code, I am adding a new column to the xamDataGrid as below:
UnboundField imageField = new UnboundField(); imageField.Name = "Special Truck"; imageField.Label = "Special Truck"; imageField.DataType = typeof(BitmapImage); this.TechList.FieldLayouts[0].Fields.Add(imageField);
I am defining the image as below:
Image img = new Image();
BitmapImage logo = new BitmapImage(); logo.UriSource = new Uri("//Images/SpecialTruck.png",UriKind.Relative); img.Source = logo;
I have a datatable that I am generating in the code behind and assigning it to the XamDataGrid.
Before I assign it to the XamDataGrid, I am adding a image column to the datatable as below
DataTable.Columns.Add("Special Truck",typeof(Image));
then I fill the datable with the above defined image. I see the datatable contains the image, but when I assign XamDataGrid.DataSource = DataTable.DefualtView();
all other contents are displaying except the Image.
Could you please provide us with a sample project demonstrating this issue so that we can look into it?
Hi everyone I have an issue displaying image programatically,can some one help me..i looked upon infragistic feature browser and set my cellvaluepresenter as defined there but when i tried to insert image through code image is not displayed
You cannot set the DataType of the field to Image. The fields does not natively support Image types. You have to retemplate the CellValuePresenter and put an Image control inside the cell. You can see an example of this in the XamFeatureBrowser.