Is there a way to load the style at design time (in visual studio)?
No, there's no way to load an ApplicationStyle at Design-time. You can create your style using AppStylist or you can style you live application using the AppStylistRunTime component.
Well, to be honest it is quite handy and I do not know why you don't include the functionality. But still, it is quite simple, here is a control that can load a style at design time. It will also load it at runtime, so you don't have to bother putting something to load it in your app main. This is edited for brevity.
Hi Jaimi,
I have created a control as you proposed but the control always return an error on the form.
Do you have any complete demo about it?!? Or more code, and how to do whit it?
Thanks in advance.
Gilles
what sort of problem are you seeing? What compiler are you using? I originally used that on vs 2005. Are you sure it can find the style?
well, I think I don't know how to use your code to apply style at design time.
if you got a small demo or more explanations about how to use the code you proposed it will be perfect, otherwise it doesn't mother. I will see the style at runtime.
Thanks
Hi Gilles,
There is no way to apply a style library at design-time. It can only be done at run-time.
Ok, thank you sir.
Hi again,
not sure if this is the best solution but I get it working like this:
If String.IsNullOrEmpty(Infragistics.Win.AppStyling.StyleManager.DefaultStyleSetName) Then
Infragistics.Win.AppStyling.StyleManager.Load(myStyle)
End If
KurtJulius
Hi ,
I transfered this into a component and it works really fine at design time. Now I want the component to load the style only if there isn't a style loaded yet.
That means:
1. Design Time: Style should be changed by the component.
2.Run Time: Style should only be changed by the component if there isn't another style loaded.
Like:
If <no other style loaded> Then
Infragistics.Win.AppStyling.StyleManager.Load(m_style)
Regards,
jaimi said:But - honestly - has it really never occurred to you that we want to see what things look like while designing?
No, that's not what I said. I said it never occurred to me that you could show the AppStylistRun-time at design-time by deriving your own form. In fact, this approach is not completely new - it came up when we were designing the feature.
There are a couple of caveats to doing this, however. For one thing, if you are going to do this, you should make sure that only one form does it - or at least that only one form is open at a time. Otherwise, you will have two conflicting AppStylist libraries running at once and one could affect the other.
Another pitfall is that loading the AppStylist Runtime at design-time may affect the control designers.
Also, I don't think it will work on InBox control, since those controls require an InboxControlStyler and this component will not exist on the Form Designer itself at run-time.
These issues may not matter to you if you are writing a relatively simple application with a single form (or at least a single main form), but in a complex application where you are loading more than one form, or you have more than one project, or reference other assemblies that are not in the same solution, it can get very complex, vrey quickly.
The AppStylistRunTime was designed to let you run your application and style it while it is actually running and this allows you to style the Inbox controls, the Infragistics controls, save the library, load a library and everything else you would need to do to style your application. So it was not considered a high priority to allow styling at Design-time.
The first post control works also, and doesn't require special forms.
But - honestly - has it really never occurred to you that we want to see what things look like while designing?
It's simple enough for some of us to write our own controls, or create our own forms, but for some people it's not that intuitive. Personally, I have used other controls from other vendors that had this functionality. I wasted half a day looking through documentation trying to figure out the "official and correct way" to get it done. It took 5 minutes to write the control above (and then an additional 2 hours to create a better one that would pull from the application dir or a central repository). I still wonder why this sort of thing isn't done in your control library itself.
Very clever solution. :)
gone2mars said:God knows why Infragistics have never put this in
Note sure what you mean by that, exactly. Since this requires deriving your own special Form class, there's not much we can do there.
But if by "put this in" you mean put it into the docs or provide examples of this, it simply never occurred to me, personally.