zoukankan      html  css  js  c++  java
  • wp7 加载更多信息

        public partial class RefreshMore : UserControl
        {
            model mymodel = new model() { SEX = true };
            private ObservableCollection<EmailObject> DemoData = new ObservableCollection<EmailObject>();
            public RefreshMore()
            {
                InitializeComponent();
                
                this.listBox1.ItemsSource = this.DemoData;
                this.DataContext = mymodel;
            }
     
            private void UserControl_Loaded(object sender, RoutedEventArgs e)
            {
                string buf = "Good night ! ";
                for (int i = 0; i < 10; i++)
                {
                    DemoData.Add(new EmailObject() { Body = buf + i ,Read="",Unread=false});
                }
            }

            private void Buton_Click(object sender, RoutedEventArgs e)
            {
                string buf = "Good night ! ";
                for (int i = 0; i < 15; i++)
                {
                    DemoData.Add(new EmailObject() { Body = buf + i, Read = "", Unread = false });
                }
                mymodel.SEX = false;

            }
        }

    uc

      <Converters:BooleanToVisibilityConverter x:Key="BoolToVisConverter" />

        <Grid x:Name="LayoutRoot">
            <ScrollViewer>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>

                    <TextBlock TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Height="30" Margin="0,-30,-3,0" Width="400" Visibility="Visible"/>

                    <ListBox Grid.Row="1" x:Name="listBox1" Margin="15,0" SelectionMode="Multiple" ItemsSource="{Binding LstModel}" ScrollViewer.VerticalScrollBarVisibility="Disabled">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal" Margin="0,0,0,20">
                                    <Rectangle Height="100" Width="100" Fill="#FFE5001b" Margin="0,0,9,0"/>
                                    <TextBlock Text="{Binding Body}" TextWrapping="Wrap" Style="{StaticResource PhoneTextLargeStyle}"/>
                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>

                    <Button Grid.Row="2" x:Name="Buton" Height="72" Content="加载更多" Visibility="{Binding SEX, Converter={StaticResource BoolToVisConverter}}" Click="Buton_Click"/>
                </Grid>
            </ScrollViewer>
        </Grid>

    在你的父控件上面 <my:RefreshMore x:Name="MyRefreshMore"/>

    大概思路是这样的。。牛人勿喷我啊。我还是初学者

  • 相关阅读:
    javaScript学习日记 1 数组
    总结css中单位px和em,rem的区别
    读书摘要
    读书摘要
    各种官方网站汇集
    js相关参考资料
    Node相关参考资料
    Angular【学习笔记】
    Node连接MySQL
    em 和 px相互转换
  • 原文地址:https://www.cnblogs.com/androllen/p/2954707.html
Copyright © 2011-2022 走看看