【发布时间】:2011-08-16 16:31:57
【问题描述】:
我的 MainPage.xaml 中有这段代码:
<phone:PhoneApplicationPage.Resources>
<Style x:Key="ListBoxStyle" TargetType="ListBox">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Padding" Value="0"/>
<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/>
<Button x:Name="LoadMoreButton" Content="Load more data..." Background="{StaticResource PhoneAccentBrush}" Click="LoadMoreData_Click" Visibility="Collapsed" />
</StackPanel>
</ScrollViewer>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</phone:PhoneApplicationPage.Resources>
我的问题是如何访问 MainPage.xaml.cs 中的 LoadMoreButton.Visibility 属性?
如果我尝试使用 LoadMoreButton.Visibility intelisense 不会返回任何内容。我想你不能使用这样的资源元素,但我希望你们中的一些人知道这个“问题”的解决方案。提前谢谢!
【问题讨论】:
-
我知道这不是您要找的,但这里有一个很好的示例和代码,用于在您处于底部时自动加载更多的列表。效果很好,您只需放置一个 TextBlock 和一个显示“正在加载更多...”的不确定进度条,用户将在他们到达底部时看到它们。 blog.slimcode.com/2010/09/11/…
-
谢谢.. 实现加载更多行为的有趣方式.. 我会检查它:)
标签: windows-phone-7 resourcedictionary