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

RadTabItem template

3 Answers 170 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
ravenger
Top achievements
Rank 1
ravenger asked on 05 Aug 2011, 04:02 PM
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


3 Answers, 1 is accepted

Sort by
0
Accepted
Petar Mladenov
Telerik team
answered on 10 Aug 2011, 04:39 PM
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 >>

0
ravenger
Top achievements
Rank 1
answered on 10 Aug 2011, 09:50 PM
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?
0
Petar Mladenov
Telerik team
answered on 15 Aug 2011, 04:18 PM
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 >>

Tags
TabControl
Asked by
ravenger
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
ravenger
Top achievements
Rank 1
Share this question
or