2017-01-16 58 views
0

怎麼我不能調用對象圖片和對象圖片backClickArrow nextClickArrow來自代碼隱藏?他們不能,因爲這些都在控制之內? 如何從代碼隱藏中調用,他們需要啓動一個事件?非常感謝。從代碼隱藏Xamarin表格中調用控件的對象

<control:CarouselView x:Name="carouselView"> 
      <control:CarouselView.ItemTemplate> 
       <DataTemplate> 
       <Grid Padding="10"> 
        <Grid.ColumnDefinitions> 
        <ColumnDefinition Width="*"></ColumnDefinition> 
        </Grid.ColumnDefinitions> 
        <Grid.RowDefinitions> 
        <RowDefinition Height="40*"></RowDefinition> 
        <RowDefinition Height="0.2*"></RowDefinition> 
        <RowDefinition Height="59.8*"></RowDefinition> 
        </Grid.RowDefinitions> 
        <Grid Grid.Row="0"> 
        <Grid.ColumnDefinitions> 
         <ColumnDefinition Width="5*"></ColumnDefinition> 
         <ColumnDefinition Width="40*"></ColumnDefinition> 
         <ColumnDefinition Width="50*"></ColumnDefinition> 
         <ColumnDefinition Width="5*"></ColumnDefinition> 
        </Grid.ColumnDefinitions> 
        <Grid.RowDefinitions> 
         <RowDefinition Height="*"></RowDefinition> 
        </Grid.RowDefinitions> 
        <Image Source="backBlueArrow.png" x:Name="backClickArrow" Aspect="AspectFit" Grid.Column="0"></Image> 
        <StackLayout Margin="0,0,10,0" VerticalOptions="Center" HorizontalOptions="End" Grid.Column="1"> 
         <Image HeightRequest="70" Source="clock.png" Aspect="AspectFit"></Image> 
        </StackLayout> 
        <Grid Grid.Row="0" Grid.Column="2"> 
         <Grid.ColumnDefinitions> 
         <ColumnDefinition Width="*"></ColumnDefinition> 
         </Grid.ColumnDefinitions> 
         <Grid.RowDefinitions> 
         <RowDefinition Height="40*"></RowDefinition> 
         <RowDefinition Height="60*"></RowDefinition> 
         </Grid.RowDefinitions> 
         <Label Text="Superficie totale" TextColor="#fff" FontSize="Small" VerticalTextAlignment="End" HorizontalTextAlignment="Start" Grid.Row="0"/> 
         <Label Text="890000m2" FontSize="Large" TextColor="#fff" VerticalTextAlignment="Start" HorizontalTextAlignment="Start" Grid.Row="1"/> 
        </Grid> 
        <Image Source="nextBlueArrow.png" x:Name="nextClickArrow" Aspect="AspectFit" Grid.Column="3"></Image> 
        </Grid> 
        <!-- griglia fare la riga bianca --> 
        <Grid Padding="0" BackgroundColor="White" Grid.Row="1"> 
        <Grid.ColumnDefinitions> 
         <ColumnDefinition Width="*"></ColumnDefinition> 
        </Grid.ColumnDefinitions> 
        <Grid.RowDefinitions> 
         <RowDefinition Height="*"></RowDefinition> 
        </Grid.RowDefinitions> 
        </Grid> 
        <Grid Padding="10" Grid.Row="2"> 
        <Grid.ColumnDefinitions> 
         <ColumnDefinition Width="*"></ColumnDefinition> 
        </Grid.ColumnDefinitions> 
        <Grid.RowDefinitions> 
         <RowDefinition Height="*"></RowDefinition> 
        </Grid.RowDefinitions> 
        </Grid> 

       </Grid> 
     <!--<Label Text="{Binding Testo}" />--> 
     </DataTemplate> 
     </control:CarouselView.ItemTemplate> 
     </control:CarouselView> 

,我想調用的對象:

<Image Source="backBlueArrow.png" x:Name="backClickArrow" Aspect="AspectFit" Grid.Column="0"></Image> 

<Image Source="nextBlueArrow.png" x:Name="nextClickArrow" Aspect="AspectFit" Grid.Column="3"></Image> 

回答

0

我已經解決了這樣的:

<Button Image="nextBlueArrow.png" Clicked="clickme" Grid.Column="3"></Button> 

使用按鈕,添加圖像屬性。