Good day peeps!!!
I had an UltraGrid as shown with "Cell Size" & "Beam Width" columns both with the Style "IntegerPositivewithSpin" but i wonder is there a way to limit the range of the "Spin"?....... Like i only want the users being able to increase or decrease the integers in column "Cell Size" in the range of "5 to 75"
Another question is, can i append a "column" to an UltraGrid whereby the "column" has different no. of rows with the table in the UltraGrid?..... For example, i want to append a new "column" to an UltraGrid (figure 1) so that the outcome would be like (figure 2)
Last question is related to UltraExplorerBar with the style "Explorer Bar"...... Can I disable the expansion function for the "Header Button"?..... as i found that I can only hide the "Indicator" of the "Header Button"....
Thank you!!!
Ok, I figured it out. However, I just used a regular ValueList in stead of a BindableValueList
For anyone who's interested in my code:
private void SetColumnImageLookupInternal(UltraGridColumn column, DataTable table, string dataValueColumnName, string dataTextColumnName, string dataPictureColumnName){ ValueList ValueList; ValueListItem Item; ValueList = new ValueList(); ValueList.DisplayStyle = ValueListDisplayStyle.DisplayTextAndPicture; foreach (DataRow Row in table.Rows) { Item = ValueList.ValueListItems.Add(Row[dataValueColumnName]); if (dataTextColumnName != null && Row[dataTextColumnName] != DBNull.Value) { Item.DisplayText = Row[dataTextColumnName].ToString(); } if (Row[dataPictureColumnName] != DBNull.Value) { Item.Appearance.Image = ConvertToBitmap((byte[)Row[dataPictureColumnName]); } } column.EditorControl = null; column.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; column.ValueList = ValueList;}
Thx Mike
Okay, tha's not going to work. The grid will be able to match up the PictureId in the customer table with the PictureId in the Picture table. But specifying an image field as the DisplayMember of a DropDown won't work correctly, because it only supports strings.
There are a couple of ways you can go with this. What I would probably do is use a ValueList, instead of an UltraDropDown and apply the image to the ValueListItem.Oddly enough, I just posted some sample code demonstrating how to do this: Sorting, icons and valuebasedappearance - Infragistics Forums
Now.. the sample code adds the items to the ValueList manually, and you probably want to bind your list. So you can do this with a BindableValueList (instead of a regular ValueList), and then just loop through the items on the list and assign the item.Appearance.Image to the value of the Photo column.
I'm doing this code in the form_load event.I set the entire layout of the grid there
Let's assume I have the following situation, where I want to show tblCustomer in a grid, with the customer's photo
tblCustomer
CustomerId (int)PictureId (int)
tblPicture
PictureId (int)Photo (Image)
So the DisplayMember of the dropdown is 'Photo'The ValueMember of the dropdown is 'PictureId'The DataSource of the DropDown is set to tblPicture
What event is this code in?
What are the actual data values you are using in your dropdown's ValueMember column? What data type are these values?
What's the DataType of the column in the grid?
I'm having the same question
I want to show a table in the grid. One of the columns is an ID that links to another table with images. So basically I want to show the Image in the grid, with a dropdown to choose another image.
The dropdown with the images is working, but it won't show the image in the grid itself. It only displays 'System.Byte['
Here's what I got so far (I simplified the code a bit, so it's possible it won't compile)
DropDown = new UltraDropDown(); DropDown.DataSource = dataTable;
DropDown.DisplayMember = lookupColumnDefinition.DisplayColumnName; DropDown.ValueMember = lookupColumnDefinition.ValueColumnName;
Column = dropDown.DisplayLayout.Bands["tableName"].Columns["ColumnContainingTheActualImage"]; if (Column.DataType.ToString() == "System.Byte[") { Column.Editor = new Infragistics.Win.EmbeddableImageRenderer(); }
ultraGridColumn.ValueList = DropDown;