We are currently testing AppStylist for Windows Forms to determine if we can allow users to change the look of our application and then, using a Table Layout Panel in Windows Forms resize the application to accomodate the new look.
Using the C# Dynamic Styling sample application as a basis, we created a Table Layout Panel on the sample application form, added some Infragistics Labels and Text Editors, and started the application.
Launching the AppStylist with the already included button (cmdStylethisApp_Click), and changing the Font and/or Size on the Label, I would expect the PropertyChanged event of the AppStylist to fire, as the form is updated with the new settings. The event, however, does not fire. This means that the Table Layout Panel is not aware of the new "Sizes" of the controls, and cannot redraw itself. The individual labels become wider than the table cell they are currently in, overlapping the cell next to them.
Under what conditions does this event fire, and how can we intercept an update to the interface using the ShowRuntimeApplicationStylingEditor to be able to pass the events to the form for resizing?
Hi,
Can you be a little more specific about what event you are actually trapping? It sounds like you are trapping the PropertyChanged event on the AppStylistRuntime component. This event isn't what you think it is. This event fires when an actual property on the component or one of it's sub-objects changes. It actually has nothing to do with changes in the applicaiton style itself.
If you want to trap for style changes, then I think what you need to do is hook the StyleChanged event on the StyleManager. I could be wrong, but I'm pretty sure this is a static event and so you will need to check InvokeRequired on any controls that you want to change from inside this event and then use a BeginInvoke to marshal across to the UI thread.
It would still be nice to know what events cause this to fire.
However, in the meantime, we have found a workaround. Putting an ultraGridGabLayoutManager on the form, and then setting the container control to the Table Layout Panel object, any changes to the font and/or size now immediately and accurately reposition the items on the form to accomodate the new size.
Hope this helps anyone else looking to make use of this tool.