RadTabItem template

4 posts, 1 answers
  1. ravenger
    ravenger avatar
    7 posts
    Member since:
    Oct 2010

    Posted 05 Aug 2011 Link to this post

    In my application I use TabControl for UI and set few DataTemplates. But i don't know, how to set DataTemplate for change IsEnabled and Margin properties for each item (RadTabItem)
    <DataTemplate x:Key="ItemTemplate">
        <StackPanel Orientation="Horizontal">
            <Image Height="16" Width="16" Source="{Binding ImagePath}" />
            <TextBlock Text="{Binding Header}" Margin="3,0,0,0" />
        </StackPanel>
    </DataTemplate>
      
    <DataTemplate x:Key="ContentTemplate">
        <Grid>
            <navigation:Frame Source="{Binding XamlPath}" Margin="0 30 0 0"  />
        </Grid>
    </DataTemplate>
    Here is my class
    public class RadItemsList
    {
        public string ImagePath { get; set; }
        public string Header { get; set; }
        public Uri XamlPath { get; set; }
    }
    2nd question. XamlPath property sets only one time, when i click on tabitem later, nothing happens, page remains the same


  2. Answer
    Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 10 Aug 2011 Link to this post

    Hello Ravenger,

     For the second issue you can use the SupressSelectedContentTemplateReapplying property set to "True". You can find more info on this here.
    The IsEnabled (bool) and Margin (Thickness) properties could be bound to properties in your ViewModel via ContainerBindings. You can find this realized in the attached solution. Please let us know if this satisfies you.

    Greetings,
    Petar Mladenov
    the Telerik team

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

  3. DevCraft banner
  4. ravenger
    ravenger avatar
    7 posts
    Member since:
    Oct 2010

    Posted 10 Aug 2011 Link to this post

    Thanks so much, it works!!!

    I have another question
    How can I load the second page (RadTabItem content) from the first page, and also execute the function with param from the second page?
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 15 Aug 2011 Link to this post

    Hello Ravenger,

     You can have Button or RadButton in the Templates and use their Command property to bind to a  custom Command in your ViewModel. Please let us know if you need assistance on this. 

    All the best,
    Petar Mladenov
    the Telerik team

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

Back to Top