Hello
I have a ultradropdownbutton user control that pops a ultrapanel containing 2 buttons --- (OK and Cancel). This user control is in a separate DLL and is embedded into a ultrawingrid cell. Here are my questions covering a variety of areas. Please advise on each question with details of how to accomplish.
Thanks in advance
Clay Seifert
Hi Clay,
ClaySeifert said:Can I specify that the cell containing the user control is always in edit mode so I don't have to double click the cell to enter edit mode and then expand the dropdown?
I assume you are embedding your control in the grid using the UltraControlContainerEditor? If that is the case, then the answer is no, you cannot tell the cell to always be in edit mode. That's not possible, since it would mean using a separate EditingControl for every cell and the UltraControlContainerEditor only allows you to use one control.
However, you can achieve what you want by setting EnterEditModeMouseBehavior on the UltraControlContainerEditor to EnterEditModeAndClick. This tells the editor to forward the mouse message on to the EditingControl after the cell enters edit mode. So a single click will both enter edit mode and drop it down.
ClaySeifert said:When I click on the cell containing the usercontrol, the user control is populated correctly ONLY for the first row selected. After that, no matter what row I click on, the data from the first row is what is passed to the usercontrol. What am I missing that's preventing the current cells data from being used by the usercontrol?
When a cell enters edit mode, the UltraControlContainerEditor sets the Value of your EditingControl to the Value of the cell. So something must not be set up correctly in your control or the UltraControlContainerEditor. I'm afraid I can't guess what that is, but if you can post a small sample project demonstrating this behavior, I would be happy to take a look.
Maybe you need to specify the EditingControlPropertyName? Or maybe the control you are using is simply not responding the second time it's value is set?
ClaySeifert said:Since the usercontrol contains 2 buttons, I'm confussed on what I need to do to have the following behavior: When I Select "Cancel" I just want to close the usercontrol and leave the passed value as it was initially, When I Select "OK" I want to place the new value into the cells value and then close the usercontrol.
I'm not sure I understand. What new value are you referring to?
If the user changes the value in a cell and leaves that cell, the new value will be committed to the cell in the underlying data source. You might be able to change that using the UpdateMode property of the grid, but even then, once the user moves to another row, the BindingManager does an implicit update on the previously active row and there is no way around that.
I suppose you might be able to do something by returning a different value from your UserControl depending on which button was pressed, but there is just not enough information in your post here to understand what exactly you are trying to do.
ClaySeifert said:Finally, if the value of the usercontrol cell changes, I want to identify the grid as dirty so I can prompt the user to update if they try to exit without saving the changes
It depends what kind of changes you are trying to track here. The grid only tracks changes in the current cell or row. Once you leave the cell/row (depending on the UpdateMode), the changes are written to the grid's DataSource. Once that happens, the grid is no longer a part of the update process and does not track those changes any more.
After that, it's up to the DataSource you are using to track changes that need to be written to the back end. A DataSet/DataTable, for example, keeps track of all changes until you call AcceptChanges.
To ensure that all updates from the grid are written to the data source, you can use the grid's UpdateData method.
Hi Mike
I've been able to resolve the last two (2) questions and it is reflected in the attached sample. I've also implemented your suggestion for the first question but it didn't work. I still have to click on the column two (2) times to expose the dropdown. Regarding the second question, the attached sample will show what I'm experiencing. As a side not, I was able to correct the inclusion of the dropdowm inside of the cell be setting the margins and paddings to 0. However, the lenght of the dropdown still does not fill to the end of the cell area when the cell area is larger.
You'll have to make one change to the test application by placing the complete path to the sample data that's included in a .csv file. This is marked by the string
<Change Path>\Scheduler\ScheduleData.csv
Thanks for your help
I took a look at your sample and there are a couple of things wrong here that are preventing this from working correctly.
First off, your Schedule control, which you are using as the EditingControl has a MinimumSize applied to it.Not only does the control itself have a MinimumSize, but the instance of that control on the form has both a MinimumSize and a MaximumSize.
So the UltraControlContainerEditor cannot make the control any smaller to fit the cell.
If you remove all of that, it still won't work quite right, because the UltraDropDownButton inside your control is not set up to resize itself to the size of the control. The UltraControlContainerEditor cannot manipulate the controls inside your control. It doesn't know what control shows the text or how to arrange those controls, so you have to create a control that is resizable.
If you remove the MinimumSize and then set the UltraDropDownButton to Dock Fill so it fills the whole control, the sizing works fine.
You might want to try placing your UserControl on a form and docking or anchoring it to the form to test it's resizing behavior to make sure it works how you want it.
Regarding the clicking on the cell not working, the reason for this is that you have not set a RenderingControl. The UltraControlContainerEditor is expecting that you would not want clicks to apply to the editor unless the appearance of the cell is the same when in edit mode as when not in edit mode.
For example, suppose your EditingControl had 3 buttons on it and you did not specify a RenderingControl. When the user clicked the cell in that case, you would not want the button click to fire, because the user would not be able to see the buttons and he would not know which button he was clicking on.
Obviously, that kind of example does not apply in this case where you have a single control filling the whole area of the cell. So it looks like this is just a bad assumption in the code. I'm going to forward this thread over to Infragistics Developer Support so they can check it out and create a case for you.
In the mean time, you can get it to work very easily by adding a new Schedule control to the form and setting the RenderingControl property of the UltraControlContainerEditor to it. You might want to do this, anyway, since then you will see a dropdown arrow in the cell when it is not in edit mode.
Hi Mike Thank you -- the suggestions you made worked perfectly, However, I'm still having a problem with this issue earlier in this post: ClaySeifert: When I click on the cell containing the usercontrol, the user control is populated correctly ONLY for the first row selected. After that, no matter what row I click on, the data from the first row is what is passed to the usercontrol. What am I missing that's preventing the current cells data from being used by the usercontrol? When a cell enters edit mode, the UltraControlContainerEditor sets the Value of your EditingControl to the Value of the cell. So something must not be set up correctly in your control or the UltraControlContainerEditor. I'm afraid I can't guess what that is, but if you can post a small sample project demonstrating this behavior, I would be happy to take a look. Maybe you need to specify the EditingControlPropertyName? Or maybe the control you are using is simply not responding the second time it's value is set? Thanks and please advise. Clay
Thank you -- the suggestions you made worked perfectly, However, I'm still having a problem with this issue earlier in this post:
ClaySeifert: When I click on the cell containing the usercontrol, the user control is populated correctly ONLY for the first row selected. After that, no matter what row I click on, the data from the first row is what is passed to the usercontrol. What am I missing that's preventing the current cells data from being used by the usercontrol?
Thanks and please advise.
Clay
Again, there are several things wrong here.
The EditingControl property is set to "Value". That's fine. The editor will set the Value property of your control to the value of the cell when it goes into edit mode. But your value property setter does not do anything to update the UI. You are not updating the display.
Also, you are implementing INotifyPropertyChange, which is good. And your implementation only fires a notification when you click the OK button. That's fine, too. but you are firing the notification and passing in "ScheduleText". No such property exists on your UserControl, and even if it did, that's not the property that the editor is using - it's using Value, which is what you specified as the EditingControlPropertyName.
Hello Clay,
This issue has been resolved in the latest Service Release as of the date of this post.
I have submitted a development issue for the issue Mike mentioned above.
Hey Mike.
Got it! Thank you very much for your help. If our paths ever cross -- I'll buy you beer.