Hello,
I'm having two particular problems with the WinGrid and a TrackBarControl
1) If the row is selected the TrackBar is covered by the blue foreground color, hence not showing that a TrackBar control is available (which is confusing for the users)
2) If the row is unselected the TrackBar column not shown.
Hi Fernando,
Which column in the screen shot has the Trackbar in it? I'm assuming is the UnitsInStock cell. Is that right?
How are you embedding the TrackBar into the grid?
And the screen shot you have here shows a selection color that is not the default color, so you are probably loading an ISL (Style Library File). That's going to be important in figuring our how to make this work.
Can you post a small sample project demonstrating the issue? If so, I'm sure I can figure it out and get it working for you.
HI Mike,
The trackbar is on the UnitsInStock column, as you can appreciate in both rows the track is not being shown.I created a sample project which has the following issues:
The only way to show the trackbar is to actually click on its column.
Thanks for the help!
Okay, I see the problem here. You are using the UltraControlContainerEditor to embed a control in the grid. This is fine, but if you are using the UltraControlContainerEditor, then you need to provide two controls - an editing control and a rendering control. You are only providing an editing control, which is why the trackbar only shows when you are in edit mode on the cell.
So you can fix this by creating a second trackbar and assigning the RenderingControl on the UltraControlContainerEditor.
private TrackBar trackBar = new TrackBar(); private TrackBar trackBar2 = new TrackBar(); public WinGrid() { InitializeComponent(); ultraGrid.DisplayLayout.Bands[0].Columns.Add("TestTracker"); var controlEditingControl = new UltraControlContainerEditor { EditingControl = trackBar, EditingControlPropertyName = "Value", RenderingControl = trackBar2, RenderingControlPropertyName = "Value" }; ultraGrid.DisplayLayout.Bands[0].Columns["TestTracker"].EditorComponent = controlEditingControl; }
The reason I didn't realize this immediately is that it's actually kind've unusual to embed a TrackBar control using UltraControlContainerEditor, because there's an Infragistics UltraTrackbar control which is an embeddable editor and can be embedded directly into the grid without the intermediary and I assumed that's what you are doing. So an alternative approach would be to use UltraTrackbar.
This makes the code simpler and it also has the advantage that the user can click and drag on the trackbar thumb immediately - as opposed to the Inbox Trackbar control where the user must first click the cell to go into edit mode before clicking and dragging.
private UltraTrackBar trackBar = new UltraTrackBar(); public WinGrid() { InitializeComponent(); UltraGridColumn column = ultraGrid.DisplayLayout.Bands[0].Columns.Add("TestTracker"); column.DataType = typeof(int); ultraGrid.DisplayLayout.Bands[0].Columns["TestTracker"].EditorComponent = this.trackBar; }
Hi Mike,
Thanks for the answer it works. However I'm still facing issues. I'm trying to set the min and max for the trackbar and it seems like is not working when setting the value. I'm wondering how I'm going to sync the trackbar and the settings on the textbox to match up, since there seems to be only an instance of the trackbar that is being shared among all rows, is this right?
Thanks!
Mike I also tried to add it via this line testTrackerColumn.EditorComponent = new UltraTrackBar() { MaxValue = 50, MinValue = 0, Value = 5 }; to no avail. The tracker is not set to the value it should nor is showing the tracker, please see attached screenshot.
Thanks for your help!
The Minimum, Maximum, and the value of the trackbar all come from the grid, not the UltraTrackbar control. It wouldn't make sense for the Value to come from the control, since it varies from row to row.
Anyway, what you need to do is set the MinValue and MaxValue on the column. The column's DataType needs to be Integer, BTW, since that's what the UltraTrackBar's value uses.
The DataType of the column has to be an integer, as I mentioned earlier. I think in the sample you have here, it's a string, so that's probably why it's not working. As long as the cell value is an Int and it's within the range of the MinValue and MaxValue (which should also be Ints), you don't have to do anything special. The Trackbar will show the value of the cell and moving the Trackbar will update the cell value automatically.
But if it's easier to create your own control, I will consider the issue closed.
I didn't found a way to link the value of a column with the value on the trackbar, not the min or max but the actual value selected and then change the value of the column accordingly if the trackbar is moved.
But it's ok, is going to be much easier to just create a user control with a textbox and a trackbar and then add it with a button to a form.
Kindest Regards,
Fernando, Bautista Quinteros.
Okay. I thought you pretty much had it working. What other obstacles remain that are prompting you to use another control?
If your min and max do not vary from row to row, then setting them is a simple matter of setting the MinValue and MaxValue on the grid column, as I mentioned.
Hi MIke,
What I meant is that each column (min and max) will have a trackbar to control its value. However this trivial task is proving to be too difficult with Infragistics controls, I'll remove the grid and do it manually on the form creating my own custom controls.
Thanks for your help anyway.
Sorry, you lost me. I didn't understand your last reply at all. I was asking you about the Trackbar in the UnitsInStock column. Is the MinValue and MaxValue of this trackbar always the same for every row? Or do you intend the minimum and maximum for this trackbar to vary based on the other fields in the row?
Having a variable min and max will be very tricky, especially if you intend for the user to be able to edit those values.