We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Tab Control not working

I am using your following  code to create a tab control but not able to see any out put., Please send me a demo project for the Tab control implementation.


Note: Following code i am using 

 

public class Employee

  {

        public string Name { getset; }

 

        public string Description { getset; }

  }



   private List<Employee> employees;

 

     public List<Employee> Employees

     {

         get { return employees; }

 

         set { employees = value; }

     }



 

Employees = new List<Employee>();

 

Employees.Add(new Employee() { Name = "James",Description = "Description about James" });

 

 


 

Employees.Add(new Employee() { Name = "Linda",Description = "Description about Linda" });

 

Employees.Add(new Employee() { Name = "Carl",Description = "Description about Carl" });

Employees.Add(new Employee() { Name = "Niko",Description = "Description about Niko" });




<navigation:SfTabControl

            ItemsSource="{Binding Employees}" >

            <navigation:SfTabControl.ItemTemplate>

                <DataTemplate>

                    <Grid>

                        <Grid.ColumnDefinitions>

                            <ColumnDefinition Width="30"/>

                            <ColumnDefinition Width="Auto"/>

                        </Grid.ColumnDefinitions>

             <Image Source="people_small.png" Margin="2 2 6 2"/>

             <TextBlock Text="{Binding Name}" Grid.Column="1"                                                        FontStyle="Italic"/>

                    </Grid>

                </DataTemplate>

            </navigation:SfTabControl.ItemTemplate>

</navigation:SfTabControl>






3 Replies

VV Vignesh V Syncfusion Team October 4, 2013 06:34 AM UTC

Hi Khurram,

We are unable to reproduce the problem 'TabControl not working'. We have prepared a sample similar to your code snippet that could meet your requirement.

Please find the sample in below link,


Please let us know if you need further assistance.

Regards,
Vignesh V


KB Khurram Bhatti October 4, 2013 09:03 AM UTC

Thanks for your valuable reply.. 

I am having a tab control with 6 tab. Each tab have its own information/Functionality.

Ex. On click of first tab a grid should bind in <DataTemplate>, 
On click of second tab another list will populate. Same things happen with all tabs.

As per the following code its binding only text  description on click of tab 
<TextBlock  Text="{Binding Description}"/>




Please suggest me or send any sample code so that i can bind controls/usercontrol for each tab in side the datatamplate. I have attached the screenshot of my apps


 <Navigation:SfTabControl 
            ItemsSource="{Binding Screens}" Grid.Row="2" Grid.Column="1" >
                
                            <Navigation:SfTabControl.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="30"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Text="{Binding Name}" Foreground="Black" FontSize="18" FontWeight="ExtraBlack" Grid.Column="1" FontStyle="Italic"/>
                                </Grid>
                            </DataTemplate>
                        </Navigation:SfTabControl.ItemTemplate>
                            <Navigation:SfTabControl.ContentTemplate>
                                <DataTemplate>
                                <Border Background="{Binding Color}" Height="500">
                                    <TextBlock  Text="{Binding Description}"/>
                                </Border>
                            </DataTemplate>
                        </Navigation:SfTabControl.ContentTemplate>
                    </Navigation:SfTabControl>




screenshot_1074b7b4.zip


VV Vignesh V Syncfusion Team October 7, 2013 06:04 PM UTC

Hi Khurram,

We have prepared a sample that could meet your requirement of 'Binding each tab with different functionality'. In this Sample we have created UserControl for each Tab with different functionality and binded with a property of object type.

Please find the sample in below link,


Please let us know if you have any queries.

Regards,
Vignesh V

Loader.
Live Chat Icon For mobile
Up arrow icon