We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Image in cell

Thread ID:

Created:

Updated:

Platform:

Replies:

98118 Feb 8,2011 09:33 AM UTC Feb 23,2011 07:44 AM UTC WPF 2
loading
Tags: GridControl
Benny Filtenborg
Asked On February 8, 2011 09:33 AM UTC

I have a problem with ImageList in a Column (GridDataVisibleColumn).

I've made a UserControl containing a GridDataControl (from Essential Studio v.8.4.0.10). I would like to add an ImageList to one of the columns (GridDataVisibleColumn) that has an Integer value. This value is equal to the index of the Image in the ImageList. If the Integer value changes, the Image should also change automatic. So if the Integer value changes to 3, the it shows the Image on index 3 from the ImageList.

How is this done? - please send an example in C-Sharp.

Here is the mainpart of my code (in UserControl_Loaded):

ObservableCollection myImageList = new ObservableCollection();
string[] mySymbols = new string[] { "MessageTypeNone.ico", "MessageTypeInformation.ico", "MessageTypeWarning.ico", "MessageTypeCritical.ico", "MessageTypeCritical.ico", "MessageTypeRegistration.ico", "MessageTypeCrediting.ico" };foreach (string Symbol in mySymbols)
{
Image myImage = new Image();
myImage.Source = new BitmapImage(new Uri("Images/" + Symbol, UriKind.Relative));
myImageList.Add(myImage);
}

Syncfusion.Windows.Controls.Grid.GridDataVisibleColumn myColumn = dgrdLog.VisibleColumns["Level"];
Syncfusion.Windows.Controls.Grid.GridDataControlLength myTypeWidth = new Syncfusion.Windows.Controls.Grid.GridDataControlLength(48);
myColumn.Width = myTypeWidth;
Syncfusion.Windows.Controls.Grid.GridDataColumnStyle myTypeStyle = new Syncfusion.Windows.Controls.Grid.GridDataColumnStyle();
myTypeStyle.CellType = "Image";
myTypeStyle.ImageList = myImageList;
myColumn.ColumnStyle = myTypeStyle;

Thanks in advance...



Benny Filtenborg
Replied On February 8, 2011 02:01 PM UTC

I forgot to tell that I'm using a DataTable as SourceItem. The valuechanges will only be made in the DataTable, not in the GridDataControl.

Another question: How do I make the Grid refresh when changes are made in the DataTable? - is the an automatic way- or a manually way to do this?

Thanks in advance...


Manikandan [Syncfusion]
Replied On February 23, 2011 07:44 AM UTC

Hi Benny,

Thanks for using Syncfusion Products.

We have created a sample for your requirement. To list the Image in a column based on the index value in cell. Please find the sample in the following location.
By default when we change the value in the DataTable, it will get update into the GridDataControl it is one of the general behavior.By setting the NotifyPropertyChange property as true Grid will automatically listen to the changes in the source and get update itself. We don’t to force the Grid to refresh.

Sample Location:
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=ImageColumnSample-1294091235.zip

Please let us know if you need more information.

Regards,
Manikandan J R.



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;