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

CustomControl based on RadComboBox

5 Answers 173 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 12 Dec 2012, 08:17 AM
Hi,

we would like to create a CustomControl that derives from a RadComboBox with a special ItemTemplate. On our first approach we tried it with a usual combox by adding to following lines to the Generic.xaml file of the project:
<Style TargetType="{x:Type local:ComboBoxLookupDataMaterialMainGroups}" BasedOn="{StaticResource {x:Type ComboBox}}">
    <Setter Property="ItemTemplate">
        <Setter.Value>
            <DataTemplate >
                 Individual Template Definition
            </DataTemplate>
        </Setter.Value>
    </Setter>
</Style>

It worked as expected so we changed the baseclass of the custom control to a RadComboBox, searched for the correct "BasedOn" content and changed it to:
<Style TargetType="{x:Type local:ComboBoxLookupDataMaterialMainGroups}" BasedOn="{StaticResource RadComboBoxStyle}">

Because the RadComboBoxStyle was unknown, we also added the implicit theme XAMLs
  • Telerik.Windows.Controls.XAML and
  • Telerik.Windows.Controls.Input.XAML

to the project's theme folder and added the following includes to the Generic.XAML:
<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="Telerik.Windows.Controls.xaml" />
    <ResourceDictionary Source="Telerik.Windows.Controls.Input.xaml" />
</ResourceDictionary.MergedDictionaries>

The whole project is just a WPF control assembly that is used by another WPF application project, so it doesn't contain an App.xaml file.

After starting the application it hangs with a XAMLObjectWriterException: Zeilennummer "7" und Zeilenposition "10" von "Beim Festlegen der Eigenschaft "System.Windows.ResourceDictionary.Source" wurde eine Ausnahme ausgelöst.".

Maybe it's just a small missing piece but it also might be a fundamental lack of knowledge since we are new to WPF. Could you please help us out?

Thanks!
David

5 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 14 Dec 2012, 03:49 PM
Hi David,

Please check this help article which explain in details how you could use implicit styles and merge the Telerik xaml files in order to achieve the needed approach.

Hope this helps.

Greetings,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
David
Top achievements
Rank 1
answered on 17 Dec 2012, 11:30 AM
Hi Yana,

thanks for your support. The help article you mentioned was in fact the major ressource we used for our researches.

Well we started from scratch now and created a fresh new project (vb) just to find a solution for this special purpose. We followed the "Setting Implicit Styles for RadComboBox" example but after adding the merged directory entries, our errorlists contains two "Die Zeichenfolge "0,0,-1,0" kann nicht in "Length" konvertiert werden." errors (from Telerik.Windows.Controls.xaml).

We used the Windows 7 implicit theme XAMLs.

Thanks!
David

0
Yana
Telerik team
answered on 19 Dec 2012, 02:16 PM
Hello David,

I have tried to reproduce the described errors, but without much success. I have attached my test project based on your description, can you download it and give it a try? What is different in your case?

Kind regards,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
David
Top achievements
Rank 1
answered on 24 Dec 2012, 10:37 AM
Hello Yana,

unfortunately I can't even build the sample project you attached. I just opened it and started building. 

Something seems to be missing in the Windows 7 Theme files. I attached a screenshot that shows my error list.

Thanks for your support!
David
0
Yana
Telerik team
answered on 27 Dec 2012, 10:54 AM
Hello David,

I have checked the project and there was no problem when building it. Could you please confirm that you're using the latest Q3 SP1 version of the controls? Also make sure that you're using NoXaml assemblies.

Regards,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
ComboBox
Asked by
David
Top achievements
Rank 1
Answers by
Yana
Telerik team
David
Top achievements
Rank 1
Share this question
or