2012-01-24 45 views
0

我從後端綁定了一個Pivot。 我樞紐的XAML是:在wp7中從後端獲取控制權

<controls:Pivot Name="MainPivot" Visibility="Collapsed"> 
      <controls:Pivot.Background> 
       <ImageBrush ImageSource="Images/ItemBrowse.png"></ImageBrush> 
      </controls:Pivot.Background> 

      <controls:Pivot.HeaderTemplate> 
       <DataTemplate> 
        <TextBlock FontSize="38" Text="{Binding title}" Foreground="White"/> 
       </DataTemplate> 
      </controls:Pivot.HeaderTemplate> 

      <controls:Pivot.ItemTemplate> 
       <DataTemplate> 
        <ScrollViewer Name="scroll" Margin="-12" Background="LightGray" VerticalScrollBarVisibility="Auto"> 
         <StackPanel> 

          <controls:PivotItem Name="pvtItemPrice" > 

           <StackPanel Orientation="Vertical"> 
            <TextBlock Text="Price" Foreground="Black" FontWeight="Bold" FontSize="28" /> 
            <TextBlock Text="{Binding price}" FontSize="22" Foreground="DarkCyan"/> 
           </StackPanel> 

          </controls:PivotItem> 
          <Border BorderThickness="2" BorderBrush="White" Height="3" Width="470"/> 

          <controls:PivotItem Name="pvtItemDescription" > 


           <StackPanel Orientation="Vertical"> 
            <TextBlock Text="Description" Foreground="Black" FontWeight="Bold" FontSize="28" /> 
            <TextBlock Text="{Binding description}" Foreground="Gray" FontSize="22" Width="460" TextWrapping="Wrap"/> 
           </StackPanel> 
          </controls:PivotItem> 
          <Border BorderThickness="2" BorderBrush="White" Height="3" Width="470"/> 




          <controls:PivotItem Name="pvtItemLocation" > 
           <StackPanel Orientation="Vertical"> 
            <TextBlock Text="Location:" Foreground="Black" Padding="5" FontWeight="Bold" FontSize="28" /> 
            <Grid > 
             <StackPanel> 
              <TextBlock Text="{Binding location}" FontSize="22" Foreground="Brown" Width="460" TextWrapping="Wrap" /> 
              <Button BorderBrush="Transparent" Foreground="Yellow" Name="btnShowMap" Width="370" Content="View in Map" Click="btnShowMap_Click" Height="100"> 
               <Button.Background> 
                <ImageBrush ImageSource="Images/ImgBtns.png" /> 
               </Button.Background> 
              </Button> 
             </StackPanel> 
            </Grid> 
           </StackPanel> 
          </controls:PivotItem> 

         </StackPanel> 
        </ScrollViewer> 
       </DataTemplate> 
      </controls:Pivot.ItemTemplate> 

     </controls:Pivot> 

但我要顯示或根據用戶價值隱藏btnShowMap。但是我無法從後端獲得控制權。無論如何,我可以得到解決方案。

回答

1

如果您在頁面中有上述標記,您應該發現Visual Studio將爲您生成一個btnShowMap字段。只需導航到此文件的代碼隱藏,您就可以找到它。