我有這樣一段代碼在我的MainPage.xaml中:WP7 - 如何在資源 - 訪問按鈕屬性>風格
<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>
我的問題是如何訪問例如LoadMoreButton.Visibility財產MainPage.xaml中的.cs?
如果我嘗試使用LoadMoreButton.Visibility,intelisense沒有返回任何東西。我想你不能使用這樣的資源元素,但我希望你們中的一些人知道解決這個「問題」。先謝謝你!
我知道這是不是你要找的東西,但這裏有一個列表一個很好的例子和代碼在底部時自動加載更多。它工作的很好,你可以放置一個TextBlock和一個不確定的進度條,說'加載更多...',用戶在底部時會看到它。 http://blog.slimcode.com/2010/09/11/detect-when-a-listbox-scrolls-to-its-end-wp7/ –
謝謝..有趣的方式來實現加載更多的行爲..我會檢查它:) – rjovic