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

Tab headers close button image and content

3 Answers 70 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mario
Top achievements
Rank 1
Mario asked on 25 Jan 2012, 12:27 PM
I have tested the sample "How to Add Close Button to the Tab Headers" and all is ok but i have 2 questions:
1) how can i change the image of the header
2) how can i call to a Page from the tabitems added. I've tried with:

...
            TabItemModel x = new TabItemModel();
            x.Title = "TITLE";
            x.Content = new Page1();
            tabItemsModel.Add(x);
...

    public class TabItemModel
    {
        public String Title
        {
            get;
            set;
        }
        public Object Content
        {
            get;
            set;
        }
    }

no success

3 Answers, 1 is accepted

Sort by
0
Mario
Top achievements
Rank 1
answered on 25 Jan 2012, 01:26 PM
Ok, It goes on with:

            <Setter Property="ContentTemplate">
                <Setter.Value>
                    <DataTemplate>
                            <ContentControl Content="{Binding Content, Mode=TwoWay}" />
                    </DataTemplate>
                </Setter.Value>
            </Setter>

But now the problems are:

- The the Page don't full the tabitem. How can I make  the content width=auto and height=auto
- When I select 2 times the same tabitem i got the message : The element is already the child of another element 
 
0
Mario
Top achievements
Rank 1
answered on 25 Jan 2012, 05:21 PM
<ContentControl VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" Content="{Binding Content, Mode=TwoWay}" />

ONLY ONE PROBLEM:

- When I select 2 times the same tabitem i got the message : "The element is already the child of another element"  
Is this a bug?

Thanks
0
Mario
Top achievements
Rank 1
answered on 25 Jan 2012, 06:28 PM
That's all: ContentPresenter 

Thanks to everybody for the help

:)
Tags
TabControl
Asked by
Mario
Top achievements
Rank 1
Answers by
Mario
Top achievements
Rank 1
Share this question
or