在WP7中,我有一个列表框,在列表框样式模板中定义了一个分页器。从代码访问我的寻呼机控制的最佳方式是什么?我需要根据datacontext中的记录数来显示/隐藏ListPagerPanel。WP7:如何以编程方式更改列表框样式模板?
<ListBox x:Name="StreamListBox" ItemsSource="{Binding Mode=OneWay}">
<ListBox.Resources>
<Style x:Key="ListBoxStyle1" TargetType="ListBox">
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<ScrollViewer x:Name="ScrollViewer" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Foreground="{TemplateBinding Foreground}" Padding="{TemplateBinding Padding}">
<StackPanel>
<ItemsPresenter/>
<StackPanel x:Name="ListPagerPanel" HorizontalAlignment="Right" Orientation="Horizontal">
....等。由于
什么是DataContext的类吗? – 2012-03-30 12:00:48
嗨Ritch,它是一个Linq IQueryable <...>对象。 – lekso 2012-03-30 12:27:55