It is impossible to solve the problem in the style of MVVM . There is something like a drop-down list of items.

 <TextBlock x:Name="CurItem" Text="Тут выбранный элемент"> <i:Interaction.Behaviors> <core:EventTriggerBehavior EventName="Tapped"> <media:ControlStoryboardAction Storyboard="{StaticResource Анимация-показываем_список_элементов_ItemsList}"/> </core:EventTriggerBehavior> </i:Interaction.Behaviors> </TextBlock> <ListBox x:Name="ItemsList" ItemsSource="{Binding ItemsSourceList}"/> 

I want the Tapped event to not work if there is only 1 item in the ListBox .

  • And it is impossible to write a check on the number of elements in the event handler? Or do you need to solve this VM? - Monk
  • It seems to me wrong to put this thing in the code-behind. Of course, this is easier, but we are striving for the best practices, right? =) - user200141
  • Disabling tapa for one item in the list is quite a planned behavior for me, I would leave in the event. - Monk
  • Non-use of the code-behind is not “best practice,” it is blindly following the mantra. Nothing wrong with pure GUI logic being in the code-behind. - ixSci
  • @Monk: So I don’t have an event in the code-behind, here’s an appeal to animation through a view. So far, it has temporarily created an event in code behind so that development does not stand. If I do not find the answer, then leave it. - user200141

0