2017-06-27 13 views
0

カルーセルビュー内に設定リストビューがありますが、選択したアイテムをアーカイブする方法は選択できません。その色を削除する必要があります。何か考えてみてください。前もって感謝します。リストビューの選択項目をカルーセルビューでヌルに設定する

サンプルコード:

<cv:CarouselView VerticalOptions = "FillAndExpand" HorizontalOptions = "FillAndExpand" Position = "{Binding DishCategory}" ItemSelected = "OnSwipeDishesHandler" ItemsSource = "{Binding RestaurantDishesList}" x:Name = "RestaurantDishesList"> 
        <cv:CarouselView.HeightRequest> 
         <OnIdiom x:TypeArguments ="x:Double" Phone ="230" Tablet ="630"/> 
        </cv:CarouselView.HeightRequest>     
        <cv:CarouselView.ItemTemplate> 
         <DataTemplate> 
          <StackLayout Padding = "10,5,10,5" Orientation = "Vertical"> 
           <ListView x:Name="RestaurantMenuListView" BackgroundColor="Transparent" ItemsSource="{Binding CategoryWiseDishes}" HasUnevenRows="true" SeparatorColor="#eeeeee"> 
            <ListView.ItemTemplate> 
             <DataTemplate> 
              <ViewCell> 
               <StackLayout Padding="7"> 
                <Grid Padding="2"> 
                 <Grid.ColumnDefinitions> 
                  <ColumnDefinition Width="*"/> 
                  <ColumnDefinition Width="Auto"/> 
                 </Grid.ColumnDefinitions> 
                 <StackLayout Grid.Column="0" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"> 
                  <StackLayout.GestureRecognizers> 
                   <TapGestureRecognizer Tapped="OnMenuItemSelected"/> 
                  </StackLayout.GestureRecognizers> 
                  <Label Text="{Binding Name}" TextColor="Black"> 
                   <Label.FontSize> 
                    <OnIdiom x:TypeArguments ="x:Double" Phone ="15" Tablet ="20"/> 
                   </Label.FontSize> 
                  </Label> 
                  <Label Text="{Binding Description}" TextColor="#323232"> 
                   <Label.FontSize> 
                    <OnIdiom x:TypeArguments ="x:Double" Phone ="11" Tablet ="16"/> 
                   </Label.FontSize> 
                  </Label> 
                  <StackLayout Orientation="Horizontal"> 
                   <Label Text="£" TextColor="Black"> 
                    <Label.FontSize> 
                     <OnIdiom x:TypeArguments ="x:Double" Phone ="14" Tablet ="19"/> 
                    </Label.FontSize> 
                   </Label> 
                   <Label Text="{Binding Cost}" TextColor="Black"> 
                    <Label.FontSize> 
                     <OnIdiom x:TypeArguments ="x:Double" Phone ="14" Tablet ="19"/> 
                    </Label.FontSize> 
                   </Label> 
                  </StackLayout> 
                 </StackLayout> 
                 <StackLayout Grid.Column="1" Orientation="Horizontal" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"> 
                  <Image Source="minus.png"> 
                   <Image.WidthRequest> 
                    <OnIdiom x:TypeArguments ="x:Double" Phone ="25" Tablet ="35"/> 
                   </Image.WidthRequest> 
                   <Image.HeightRequest> 
                    <OnIdiom x:TypeArguments ="x:Double" Phone ="25" Tablet ="35"/> 
                   </Image.HeightRequest> 
                   <Image.GestureRecognizers> 
                    <TapGestureRecognizer Tapped="RemoveItemBtnClicked"/> 
                   </Image.GestureRecognizers> 
                  </Image> 
                  <Label Text="{Binding TotalQuantity}" HorizontalOptions="Center" VerticalOptions="Center" TextColor="Black"> 
                  <Label.FontSize> 
                   <OnIdiom x:TypeArguments="x:Double"> 
                   <OnIdiom.Phone> 
                    <OnPlatform x:TypeArguments="x:Double" iOS="13" Android="13" WinPhone="13" /> 
                   </OnIdiom.Phone> 
                   <OnIdiom.Tablet> 
                    <OnPlatform x:TypeArguments="x:Double" iOS="15" Android="15" WinPhone="15" /> 
                   </OnIdiom.Tablet> 
                   </OnIdiom> 
                  </Label.FontSize> 
                  </Label> 
                  <Image Source="add.png"> 
                   <Image.WidthRequest> 
                    <OnIdiom x:TypeArguments ="x:Double" Phone ="25" Tablet ="35"/> 
                   </Image.WidthRequest> 
                   <Image.HeightRequest> 
                    <OnIdiom x:TypeArguments ="x:Double" Phone ="25" Tablet ="35"/> 
                   </Image.HeightRequest> 
                   <Image.GestureRecognizers> 
                    <TapGestureRecognizer Tapped="AddItemBtnClicked"/> 
                   </Image.GestureRecognizers> 
                  </Image> 
                 </StackLayout> 
                </Grid> 
               </StackLayout> 
              </ViewCell> 
             </DataTemplate> 
            </ListView.ItemTemplate> 
           </ListView> 
          </StackLayout> 
         </DataTemplate> 
        </cv:CarouselView.ItemTemplate> 
       </cv:CarouselView>  

行の合計数量ラベルそれショーのデフォルトの色にIをクリックします。その色を削除する必要があります。あなたがこれまでに試してみました何あなたのxaml.csファイルで次に、あなたのXAMLファイルで

+0

?何が効いていないのですか? – spaceplane

+0

私の質問にお時間をいただきありがとうございます。リストビューで選択したイベントをnullに設定しようとしましたが、リストビュー内のカルーセルビューはxaml.csファイルで検出されません。次に、選択したイベントを、リストビュー内のカルーセルビューでnullに設定する方法 – Deepak

+0

xamlを表示してください –

答えて

1

....

<ListView x:Name="RestaurantMenuListView" BackgroundColor="Transparent" ItemsSource="{Binding CategoryWiseDishes}" HasUnevenRows="true" SeparatorColor="#eeeeee" ItemTapped="OnItemTapped"> 

....

public void OnItemTapped(object sender, ItemTappedEventArgs e) 
    { 
     ((ListView)sender).SelectedItem = null; 
    } 
+0

それは素晴らしいプラベンです。 – Deepak

関連する問題