Multiple RadTileViewItem with differents themes??

6 posts, 1 answers
  1. xavendano
    xavendano avatar
    35 posts
    Member since:
    Feb 2012

    Posted 07 Jul 2012 Link to this post

    Hi all

    Is it possible to have multiple RadTileViewItem with different skins in the same RadTileView?

    Note: The application is "submitted" to a large Metro Skin type through the instructions in VB.NET:

             StyleManager.ApplicationTheme = New MetroTheme
             RadSpellChecker.WindowSettings.Theme = StyleManager.ApplicationTheme

    In advance, thanks for the help you can give me ...
  2. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 11 Jul 2012 Link to this post

    Hello Romell,
    Could you please specify what exactly do you mean by different skins? Do you mean different Themes or different styles? You can't set different themes to the tileViewItems in one tileView but you can set them different styles.
    I've attached a very simple project which shows how you can change the header background of the items so could you please examine it and if you have further questions feel free to ask.

    Regards,
    Zarko
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. xavendano
    xavendano avatar
    35 posts
    Member since:
    Feb 2012

    Posted 11 Jul 2012 Link to this post

    Thank you for your prompt response,

    I've certainly chosen the wrong words to explain.

    The application is subject to a large MetroTheme through lines of code :

             StyleManager.ApplicationTheme = New MetroTheme
              RadSpellChecker.WindowSettings.Theme = StyleManager.ApplicationTheme

    And it requires the application still using this theme, allow the colors to change RadTileViewItem but keeping the same style.

    The example works fine, thanks ... but the elements are created at runtime, how I can perform this through code???

    In advance, thank Zarko
  5. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 12 Jul 2012 Link to this post

    Hi Romell,
    If you're using business objects in your RadTileView you could use the ItemContainerStyleSelector.
    I've updated the attached project so you should check it out and if you need further assistance feel free to ask.

    Greetings,
    Zarko
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. xavendano
    xavendano avatar
    35 posts
    Member since:
    Feb 2012

    Posted 12 Jul 2012 Link to this post

    Hi Zarko,

    Let me explain.....what steps have made

    - I created the class "MyStyleSelector" in my project and took it to VB.NET (which is the default)
    - The class was included in the proyect
    - I omitted the section in the XML: ItemsSource = "{Binding Items}" because the application generates at runtime TileViewItems.
    - I omitted the class "MainViewModel" For the same reason as above.

    Furthermore,

    - I included in the main form as indicated between the tags: <Grid.Resources>

    And here I am presented with the following error:

    Error 1 The type 'local:MyStyleSelector' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. C:\Users\......\Visual Studio 2010\DemoWPF\DemoWPF\DemoWPF 
    \Main.xaml 131 38 DemoWPF


    I have several questions regarding the behavior of WPF controls ... or ...

    1- If I can change the colors or style of an issue at runtime, why should I preset values ​​Tagged <Grid.Resources> and <Style among others? Is this necessary?

    2- What should the lines indicated above error if the class is included in the project and the names match?


    Additional data,
    -WPF Web Browser
    -VB.NET
    -Framework 3.5


    In advance, thanks for the support you can give me ....
  7. Answer
    Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 17 Jul 2012 Link to this post

    Hello Romell,
    From your description I guess that you may have forgot to include the "local" namespace:
    xmlns:local="clr-namespace:TestWPF"
    (instead of TestWPF you should place your project's name)
    As for the styles - what exactly do you mean by "application generates at runtime TileViewItems"? Does this mean that you don't use business items and manually create containers (RadTileViewItems) in code-behind and add them to the RadTileView's Items collection? If this is the case then you'd have to change the styleSelector or you could not use it at all, because you can manually set the desired style:
    Dim newItem As New RadTileViewItem()
    newItem.Content = "Put some content"
    newItem.Header = "Item " & Convert.ToString(Me.tileView.Items.Count)
    Select Case Me.tileView.Items.Count Mod 4
        Case 0
            newItem.Style = TryCast(Me.Resources("redHeader"), Style)
            Exit Select
        Case 1
            newItem.Style = TryCast(Me.Resources("blueHeader"), Style)
            Exit Select
        Case 2
            newItem.Style = TryCast(Me.Resources("greenHeader"), Style)
            Exit Select
        Case 3
            newItem.Style = TryCast(Me.Resources("purpleHeader"), Style)
            Exit Select
    End Select
     
    Me.tileView.Items.Add(newItem)
    End Sub
    I've update the attached project so could you please examine it and if you have further questions feel free to ask.

    All the best,
    Zarko
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
UI for WPF is Visual Studio 2017 Ready