• C# 向PivotItem中添加子控件


    xaml语言:

    <controls:PivotItem Name="SecondPivotItem" Header="Second">                

      <ListBox x:Name="SecondListBox" Margin="0,0,-12,0" ItemsSource="{Binding Items}">                    

        <ListBox.ItemTemplate>                        

          <DataTemplate>                          

            <StackPanel Margin="0,0,0,17" Width="432" Height="78">                              

              <TextBlock Text="{Binding LineOne}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>                              

              <TextBlock Text="{Binding LineTwo}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>                          

            </StackPanel>                        

           </DataTemplate>                    

        </ListBox.ItemTemplate>                

          </ListBox>            

    </controls:PivotItem>

    C# :

    ListBox listbox=new ListBox();

    listbox.Background=new SolidColorBrush(Colors.Red);

    listbox.Width=300;

    listbox.height=400;

    ListBoxItem item =new ListBoxItem();

    item="this is first time i‘m apperear here";

    listbox.items.add(item);

    SecondPivotItem.Content=listbox;//pivotitem的content属性可以设置子控件

  • 相关阅读:
    HDU
    HYSBZ
    HDU
    POJ
    HDU
    HDU
    HDU
    「luogu2680」[NOIp2015] 运输计划
    「luogu1417」烹调方案
    网络(最大)流初步+二分图初步 (浅谈EK,Dinic, Hungarian method:]
  • 原文地址:https://www.cnblogs.com/mokey/p/2248399.html
Copyright © 2020-2023  润新知