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

Styling Combo Box

7 Answers 222 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
sinisa
Top achievements
Rank 1
sinisa asked on 13 Aug 2008, 09:15 AM
Hi,

When I'm trying to create a RadComboBox in Blend I get following error: "Error HRESULT E_FAIL has been returned from a call to COM component". I assume that this has something to do with blends incompability to handle third part components, but I would be more than grateful if you could provide me with an example when you style the different parts of the RadComboBox in XAML.

Regards,

/Sinisa

7 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 14 Aug 2008, 02:26 PM
Hi Sinisa,

Please, find attached a simple project with a page, containing a RadComboBox control, with applied custom theme. All theme styles are located in /Themes/ComboBox.xaml, which can be edited in Blend. Note that you may need to update the project references.

RadComboBox has a known bug, which prevents Blend from creating several instances of the control on the same page. It should be working fine in Blend when there is nothing else on the page. The problem does not affect the control in runtime.

Please, let me know if you have difficulties running the sample project or if you need additional information.

All the best,
Valeri Hristov (Silverlight Team)
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Nadeem
Top achievements
Rank 1
answered on 15 Aug 2008, 09:33 AM
Hello Valeri Hristov

I could not make your sample application to work, in Blend its throughing errors
"A DependencyProperty target is invalid: Telerik.Windows.Controls.Theme"

How can i create a complete new skin for the combobox? I am using  this component in a custom control. I want to to create a Control Template in its local resoruces. How can i create a ControlTemplate for it?


0
Valeri Hristov
Telerik team
answered on 15 Aug 2008, 10:40 AM
Hello Nadeem,

What version of Blend are you using? You need the latest June Preview, version number 2.1.1535.0. Please, check also the version of your Silverlight runtime - you need version 2.0.30523.8.

I strongly recommend using the default control template of RadComboBox as a start. It is located in /Themes/ComboBox.xaml. Note that the control has two templates - one for editable mode and one for non editable. The keys of those templates should be exactly the same as the keys in the default template. You could eventually customize only the one of the two templates, but I recommend using our theming mechanism (the RadControl.Theme attached property), which is demonstrated in the previously attached sample.

Best wishes,
Valeri Hristov (Silverlight Team)
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Nadeem
Top achievements
Rank 1
answered on 15 Aug 2008, 11:40 AM
Hello Valeri Hristov

I have tried you sample project again but it is not opening in Blend, i am using the latest June preview version of Blend and the Latest SL Runtime, as you suggested above.

1. I unzipped your sample project, opened it in VS 2008 and deleted the two Telerik references.

2. I added the both two dlls from my local system again

Note: i have the Telerik_RadControls_For_Silverlight_2_CTP2 package of Telerik component, is it the latest one or have to update it form somewhere?

3. If i run the project directly from VS it work fine, the only change i can see is the Combobox has Red colored Arrow? may that is what you have changed?

4. If i open it in Expression blend the same error shows up
A "DependencyProperty target is invalid: Telerik.Windows.Controls.Theme"
and there is an exception view in Design mode.  What am i missing?

Also if i need to use themes machanism of telerik how can i add those themes in my project? I could not underdstand the following line (i am very new to SL)
<core:Theme x:Name="CustomTheme" Source="/RadComboBoxTest;component/Theme/ComboBox.xaml" />

I have the theme folder in my project in following position

SnapFlow.UI.UserControls [Project Name]
       WorkFlowStudio[Folder]
                Manager[Folder]
                         Theme [Folder]

What will be the Soruce path for above folder/project structure?

0
Valeri Hristov
Telerik team
answered on 15 Aug 2008, 12:20 PM
Hi Nadeem,

There is a newer version of RadControls for Silverlight - Beta 1. You can download it from MyTrials page in MyClientNet section of the site:
 http://www.telerik.com/client.net/my-licenses/my-free-trials.aspx
I suppose that this will resolve the problem with Blend.

Indeed, the only change in the custom skin is the red arrow.

The theming mechanism works by specifying a XAML file with a ResourceDictionary, containing all needed resources for the control. In the case of RadComboBox those resources are a default Style (with TargetType=RadComboBox and no key) and two control templates. The other resources in the custom control template are exposed to ease the modifications. It is very important to set the build action of that XAML file to be Resource (see the attached screenshot).

The theme declaration:
<core:Theme x:Name="CustomTheme" Source="/RadComboBoxTest;component/Theme/ComboBox.xaml" />

is just an instantiation of an object, which holds the Uri to the theme XAML file. The first part of that Uri is the assembly name, the second starts with component (required keyword) and then the path to the XAML file in your project. In your case it should be (if the assembly of the SnapFlow.UI.UserControls project is named after the project):
<core:Theme x:Name="CustomTheme" Source="/SnapFlow.UI.UserControls;component/WorkFlowStudio/Manager/Theme/ComboBox.xaml" />

Then on each control you want to specify a theme you have to set the RadControl.Theme attached property:
<telerik:RadComboBox core:RadControl.Theme={StaticResource CustomTheme} ... />

Let me know if this helps (or it doesn't).

Kind regards,
Valeri Hristov (Silverlight Team)
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Nadeem
Top achievements
Rank 1
answered on 18 Aug 2008, 10:47 AM
Hello Valeri Hristov

 I have checked and tried all the things but the error is still there, please check your attached sample project and test it again may be it had some bug Or may be i dont have telerik framework properly installed i mean is there any kind of installation required? I have just downloaded the zip package 22 July release and using Dlls as reference.

I wanted to send you the screen shots but i am not allowed to upload a file.

I need to use several Telerik components in my application with custom skining and styling.
0
Valeri Hristov
Telerik team
answered on 18 Aug 2008, 12:15 PM
Hello Nadeem,

You can open a new support ticket from the page below:
http://www.telerik.com/client.net/my-support-tickets/new-support-ticket.aspx

There you can upload screenshots or other files.

Kind regards,
Valeri Hristov (Silverlight Team)
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
sinisa
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Nadeem
Top achievements
Rank 1
Share this question
or