Open Sergio0694 opened 4 years ago
I'm surprised this wasn't here already actually! Having created this on multiple occasions for various projects, I'd find this addition welcoming.
Can anyone help with the CI? I'm not super familiar with the setup of this repo/CI, but the Microsoft.Xaml.Interactions
project is building just fine for me locally (granted, I needed to locally bump the SDK to 17763 since the original SDK 10586 is so old I don't even see that as an option in the Visual Studio installer). 😅
The CI is failing with some rather weird errors that seem a bit suspicious, considering the new behavior literally is a single self-contained class only using standard types from the BCL and the various built-in UWP types.
I mean, like:
TriggerOfT.cs(13,58): error CS1069: The type name 'DependencyObject' could not be found in the namespace 'Windows.UI.Xaml'. This type has been forwarded to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' Consider adding a reference to that assembly. [C:\projects\xamlbehaviors\src\BehaviorsSDKManaged\Microsoft.Xaml.Interactivity\Microsoft.Xaml.Interactivity.csproj]
VisualStateUtilities.cs(46,68): error CS1069: The type name 'FrameworkElement' could not be found in the namespace 'Windows.UI.Xaml'. This type has been forwarded to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' Consider adding a reference to that assembly. [C:\projects\xamlbehaviors\src\BehaviorsSDKManaged\Microsoft.Xaml.Interactivity\Microsoft.Xaml.Interactivity.csproj]
VisualStateUtilities.cs(78,58): error CS1069: The type name 'FrameworkElement' could not be found in the namespace 'Windows.UI.Xaml'. This type has been forwarded to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' Consider adding a reference to that assembly. [C:\projects\xamlbehaviors\src\BehaviorsSDKManaged\Microsoft.Xaml.Interactivity\Microsoft.Xaml.Interactivity.csproj]
I'm a bit confused here 🤔
@Sergio0694 it looks like the issue is to do with the SDKs not being available and it's building with VS2019 looking at the logs from appveyor.
At the top,
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\WindowsXaml\v16.0\8.2\Microsoft.Windows.UI.Xaml.Common.targets(676,5): warning : Could not find target platform winmds for the SDK specified by [Windows, 10.0, UAP, 10.0.10240.0, 10.0.10586.0]
Then everything after that point is just errors 🤔
Looking at the build history too shows it's been failing for some time.
It almost looks like there was a change with the CI in appveyor to move from VS2017 (where it was previously building).
Also appears that the change you described to get it to work was exactly what had been done on the preview WinUI branch too (https://github.com/Microsoft/XamlBehaviors/commit/4c12ffe8aee017d90504a90ffd4393f5876e64fb) by @DVaughan
Hey @jamesmcroft - thanks for looking into this! Yeah that makes perfect sense, especially because I really didn't make any breaking changes or refactorings at all in the PR.
I guess we'll just need to hear from someone from the behaviors team about how to proceed here then 😄
@mgoertz-msft what should be done here?
Feature: new
ItemClickBehavior
typeSummary
This PR introduces a new
ItemClickBerhavior
type, targetingListViewBase
(so it can be used with bothListView
andGridView
), which allows to easily invoke a command when an item is clicking, and also to pass the clicked item directly as parameter. This results in more compact and efficient code than using anEventTriggerBehavior
+ an invoke command behavior, and it allows to directly receive the clicked item as argument to the command, which would've otherwise not been possible.Here's a usage example:
The target command will be invoked when an item is clicked and will receive the
ItemClickEventArgs.ClickedItem
instance directly. This is especially useful when using eg. theRelayCommand<T>
type (see https://github.com/windows-toolkit/WindowsCommunityToolkit/issues/3230), as you can then also specify the target type of a clicked item and have the command wrap a model directly in the viewmodel: