This is a migrated thread and some comments may be shown as answers.

Formatting not applied the first time the window is displayed

1 Answer 51 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 17 Apr 2012, 01:29 PM
My application is built in WPF.  I have a class called "MyWindow" that descends from the WPF Window class.  I have another class called "MyDialog" that also descends from the WPF Window class.  These two classes have a uniform look and functionality so it made sense to create my own base classes for the applicaiton.  The application is to be used on touch screen equipped laptops in police cars, so I've made everything bigger, to make it easier for people with large fingers to interact with the application.

My application has a login dialog that descends from the MyDialog class.  During program startup, the application performs a number of steps, including loading a resource dictionary that contains brushes that are used to draw the application's controls.  Again, part of the whole unified look.

The login dialog has a RadComboBox on it.  The app.xaml has a custom template for RadComboBoxes that increases the width of   the drop down button on the control.  The first time the login dialog is displayed, however, this template is not applied; the drop down button is the normal width.  However, if you enter a wrong password & click login, the dialog is redrawn and this time the drop down button is the right width.

Why is the width of the RadComboBox wrong the first time but right the second time, even though every other aspect of the dialog is drawn right the first time?  I don't even know what code to include to help you guys help me on this.  Any ideas?

Tony

1 Answer, 1 is accepted

Sort by
0
Dani
Telerik team
answered on 20 Apr 2012, 10:47 AM
Hi Tony,

I believe you custom style for RadComboBox does not get applied in the right time. If you render a RadComboBox and only then merge resources in your application resources, the RadComboBox will not pick up its style because it does not support dynamic theme switch. Instead, it will keep its default look. It will apply its new style only after the layout has been redrawn, i.e. refreshed. Which is why is picks up the style the second time. I suggest you try mergind resources on the application level before your layout in the dialog is rendered.

Greetings,
Dani
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
ComboBox
Asked by
Tony
Top achievements
Rank 1
Answers by
Dani
Telerik team
Share this question
or