Search code examples
wpftabcontrolitemscontrol

Itemscontrol in tabcontrol?


i have the following code to be implemented into my xaml file.

<ItemsControl ItemsSource="{Binding Source={StaticResource xDoc}, XPath=targets/target/antcall/@target}">
        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <CheckBox Content="{Binding Path=Value, Converter={StaticResource UnderscoresConverter}}"/>
            </DataTemplate>
        </ItemsControl.ItemTemplate>
    </ItemsControl>

i already have a tab control under my window1. where and how should i implement this itemscontrol? sorry i am a beginner in wpf.

EDIT: I have a grid control under my tab control too


Solution

  • I didn't quite get what you are trying to do.If you are trying to add your itemscontrol to the tabcontrol,see the below code

     <TabControl>
                <TabItem Header="Page 1">
                    <Grid>
                    <ItemsControl ItemsSource="{Binding Source={StaticResource xDoc}, XPath=targets/target/antcall/@target}">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <CheckBox Content="{Binding Path=Value, Converter={StaticResource UnderscoresConverter}}"/>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </Grid>
                </TabItem>
                <TabItem Header="Page 2">
                </TabItem>
            </TabControl>