Use <Interaction.Behaviors> and <EventTriggerBehavior> in UWP 10 app
Asked Answered
S

1

7

How can I use <Interaction.Behaviors> and <EventTriggerBehavior> in a Windows 10 universal app? I will get something like this with Blend:

Source both images above: Jef Daels 2015

In may (bad) documentation, I've read that it must be something over here:

And here is the code for what I need to do it:

<ListBox Grid.Row="2" Grid.Column="0"  Grid.ColumnSpan="3"
         ItemContainerStyle="{StaticResource lstidflt}" SelectedItem="{Binding SelectedVillage, Mode=TwoWay}"
         ItemTemplate="{StaticResource weatheritemdt}" ItemsSource="{Binding VillageList}" >
</ListBox>
Sputter answered 26/12, 2015 at 12:19 Comment(7)
Possible duplicate of Binding VisualState to the ViewModel in Universal Windows 10 AppsWaikiki
I'm not entirely sure what you're asking here. You just want to add Behaviors to a UWP project? Easiest way is if you're using Blend anyway, click your "Behaviors" tab. It will say none exist with a hyperlink to install them into the app, click it, voila... Or am I misunderstanding?Dumbarton
@ChrisW.: no it not that what I need. I need how you can generate the code in my question (<Interaction.Behaviors> and <EventTriggerBehavior>). It is to make a navigation system to be navigated to a detail page of the selected item from the list box.Sputter
Well if you already have them in the project, you should be able to add the namespaces for interactions/interactivity and go to town with it. Are you talking about just how to do them from the Blend GUI? I just got done with a UWP project I had to add some too and didn't have any problems, but I don't generally use the IDE and just do it straight in the xaml.Dumbarton
@ChrisW.: No I haven't that code. The code on the image have I found on a document. But it is not enough explained how you can do it.Sputter
What your image shows is editing a template. Not really relevant to the behaviors stuff I'm afraid. Are you sure you've added the Behaviors from Nuget? If you click on your Behaviors tab in Blend, there should be a list of behaviors. You can drag and drop them from there onto the object which the behavior applies and select it in the document outline tree to edit the behavior's properties etc. It will add your xaml and namespaces for you upon doing so.Dumbarton
@ChrisW.: aaah oké. Thanks. This was helping me :)Sputter
S
5

I've found it. I must install the 'behaviors' package from Nuget and than drag and drop it onto the element I need to use it. Thanks to ChrisW.!

Sputter answered 4/1, 2016 at 18:15 Comment(1)
Glad we got you sorted. Cheers :)Dumbarton

© 2022 - 2024 — McMap. All rights reserved.