CustomControl based on RadComboBox

6 posts, 0 answers
  1. David
    David avatar
    1 posts
    Member since:
    Nov 2012

    Posted 12 Dec 2012 Link to this post

    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
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 14 Dec 2012 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. David
    David avatar
    8 posts
    Member since:
    Mar 2011

    Posted 17 Dec 2012 Link to this post

    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

  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 19 Dec 2012 Link to this post

    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.

  6. David
    David avatar
    8 posts
    Member since:
    Mar 2011

    Posted 24 Dec 2012 Link to this post

    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
  7. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 27 Dec 2012 Link to this post

    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.

Back to Top
UI for WPF is Visual Studio 2017 Ready