views:

50

answers:

1

Hello.

I am creating a SL App that has a TabControl with dynamically created TabItems which are added via code behind. I'd like said TabItems to size proportionally to the TabControls full width, much like what is described here.

Now Silverlight does not have IMultiValueConverter, and not knowing how many tab I will have, I am a bit stuck. Any ways around this?

Thanks for the help.

A: 

I haven't done this myself, but I believe you could just implement your own TabPanel and substitute that in via the appropriate template part. See this page for a list of template parts.

public class MyTabPanel : TabPanel
{
    // custom layout logic as per your requirements
}

And in styles:

<Style TargetType="TabControl">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="TabControl">
                <!-- copy standard template from Blend, but substitute in your MyTabPanel instead -->
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

HTH,
Kent

Kent Boogaart