With a control inheriting from an ultragrid I'd like to place another control on the design surface and have it draw itself over the ultragrid. When I try this though, the control isn't visible. Checking its properties I can see that it is visible, has a sensible, non-zero size, and a location that should be visible. I've also tried calling its BringToFront method. Is there any way I can do this?
We're trying to add functionality to all our grids (which use a class inheriting from the ultragrid) to be able to display an indicator that data is being fetched, along with a cancel button to abort the fetch. I've created a usercontrol to implement this, but am getting the behaviour described. I've tried using a simple standard control as well, but that isn't displayed either
Hi Kevin,
Thank you for posting to our forums.
One reason for why you can’t see your control is if you are fetching the data on the UI thread. That will lead to the UI thread being blocked until it is done with the fetching the data, so your controls can’t be drawn. What you could do is to fetch the data on another thread, and display your controls on the main thread. There are a few ways to implement this. I have attached a sample demonstrating how to do this with the Task class. It displays an activity indicator over the control while a long loading of data is simulated.
Please let me know if you have any additional questions.
Hi, thanks for the reply. We are in fact using the TPL to load the data on a background thread, then apply it to the grid on the UI thread when it has been fetched, so that in itself isn't the problem. I've downloaded the sample you provided, but it's not quite what I'm looking for. You are dropping a grid on to the form, then dropping the progress bar on to the form as well. This works (and is in fact the workaround I'm using at the moment) bit I want to encapsulate all of this in our control that inherits from the ultragrid. I've dropped my progress bar on to this user control's design surface, not on to the form itself. I'm presuming it's something to do with the grid not being a container, and am wondering if there's a way to work around this.
Thanks Hristo, that does exactly what I need
Kevin
Hello,This is expected since activity indicator is not added to the control collection of the OurGrid (UltraGrid), you will get same result if you apply same approach to DataGridView for example. So solution for you is to add UltraActivityIndicator to the controls collection of OurGrid (UltraGrid) in the ctor of the component, (also you might add it in the designer file of the component, but it won't be clear if you add another control why it is not visible).Please let me know if you have any further questions.
Hi Dimitar,
I'm not at my computer at the moment, so can't check comprehensively, however from what you've said I think we are still doing different things. You are creating a user control and adding a grid and an activity indicator to it. I am subclassing the grid. Ie, my user control is defined in a class like :
Public Class OurGrid
Inherits Infragistics.Win.UltraWinGrid.UltraGrid
' various properties, methods, etc here
End Class
If you create a usercontrol like this, then try to add an activity indicator to its design surface you should see what I mean.
Hopefully that will make it clear, but if not I will upload a small sample when I am next at my computer (hopefully later today)
Thank you for the clarification.
I have tested this in a user control and everything works fine for me. What I changed is adding a user control and adding a grid and an activity indicator to it. After that I moved the code from the load event of the form to a public method of the UserControl, which I call from the load event of the form. This way everything works as expected.
I have attached my sample for your reference. Plese send me a sample which demonstrates the issue. I will be glad to investigate this further for you once I have the modified sample.
Thank you for your collaboration.
I am looking forward to your reply.