├── tests └── tests.txt ├── key ├── Behaviors.snk ├── FinalPublicKey.snk └── 35MSSharedLib1024.snk ├── scripts ├── download-nuget.cmd ├── Microsoft.Xaml.Behaviors.Signing.targets ├── Microsoft.Xaml.Behaviors.WinUI.Managed.nuspec └── Microsoft.Xaml.Behaviors.Uwp.Managed.nuspec ├── samples └── CS │ ├── XAMLBehaviorsSample │ ├── Assets │ │ ├── Cheer.mp3 │ │ ├── Ding.mp3 │ │ ├── Whistle.mp3 │ │ ├── StoreLogo.png │ │ ├── SplashScreen.scale-200.png │ │ ├── LockScreenLogo.scale-200.png │ │ ├── Square44x44Logo.scale-200.png │ │ ├── Wide310x150Logo.scale-200.png │ │ ├── Square150x150Logo.scale-200.png │ │ └── Square44x44Logo.targetsize-24_altform-unplated.png │ ├── GoToStateControl.xaml.cs │ ├── PlaySoundControl.xaml.cs │ ├── DataTriggerControl.xaml.cs │ ├── CustomActionControl.xaml.cs │ ├── EventTriggerControl.xaml.cs │ ├── ChangePropertyControl.xaml.cs │ ├── CustomBehaviorControl.xaml.cs │ ├── NavigateToPageControl.xaml.cs │ ├── ControlStoryboardControl.xaml.cs │ ├── NavigatePageSample.xaml.cs │ ├── ContentDialogSample.xaml.cs │ ├── Properties │ │ ├── DesignTimeResources.xaml │ │ ├── AssemblyInfo.cs │ │ └── Default.rd.xml │ ├── ContentDialogPopUp.cs │ ├── App.xaml │ ├── ContentDialogSample.xaml │ ├── CallMethodControl.xaml.cs │ ├── IncrementalUpdateControl.xaml.cs │ ├── Package.appxmanifest │ ├── InvokeCommandControl.xaml.cs │ ├── DragPositionBehavior.cs │ ├── NavigatePageSample.xaml │ ├── CustomBehaviorControl.xaml │ ├── CustomActionControl.xaml │ ├── NavigateToPageControl.xaml │ ├── CallMethodControl.xaml │ ├── EventTriggerControl.xaml │ ├── App.xaml.cs │ ├── IncrementalUpdateControl.xaml │ ├── ControlStoryboardControl.xaml │ └── DataTriggerControl.xaml │ └── XAMLBehaviorsSample.sln ├── assets └── packaging │ └── XAMLInteractiveBehaviors_128x.png ├── src └── BehaviorsSDKManaged │ ├── ManagedUnitTests │ ├── Assets │ │ ├── StoreLogo.png │ │ ├── SplashScreen.scale-200.png │ │ ├── LockScreenLogo.scale-200.png │ │ ├── Square44x44Logo.scale-200.png │ │ ├── Wide310x150Logo.scale-200.png │ │ ├── Square150x150Logo.scale-200.png │ │ └── Square44x44Logo.targetsize-24_altform-unplated.png │ ├── UnitTestApp.xaml │ ├── BlankPage.xaml │ ├── BlankPage.xaml.cs │ ├── TestVisualTreeHelper.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ └── UnitTestApp.rd.xml │ ├── Package.appxmanifest │ ├── ActionCollectionTest.cs │ ├── TestUitilties.cs │ ├── NavigateToPageActionTest.cs │ └── UnitTestApp.xaml.cs │ ├── Microsoft.Xaml.Interactivity.Shared │ ├── GlobalSuppressions.cs │ ├── ITrigger.cs │ ├── Utility │ │ ├── UwpVisualTreeHelper.cs │ │ └── IVisualTreeHelper.cs │ ├── IAction.cs │ ├── TypeConstraintAttribute.cs │ ├── Core │ │ ├── ComparisonConditionType.cs │ │ ├── ResourceHelper.cs │ │ ├── DataBindingHelper.cs │ │ └── TypeConverterHelper.cs │ ├── IBehavior.cs │ ├── Microsoft.Xaml.Interactivity.Shared.shproj │ ├── Media │ │ └── ControlStoryboardOption.cs │ ├── DefaultEventAttribute.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── BehaviorOfT.cs │ ├── Trigger.cs │ ├── TriggerOfT.cs │ ├── ActionCollection.cs │ ├── CustomPropertyValueEditorAttribute.cs │ ├── Behavior.cs │ └── Microsoft.Xaml.Interactivity.Shared.projitems │ ├── Version │ ├── NuGetPackageVersion.props │ └── Version.cs │ ├── global.json │ ├── Microsoft.Xaml.Interactivity.DesignTools │ ├── Properties │ │ └── AssemblyInfo.cs │ └── MetadataTableProvider.SurfaceIsolation.cs │ ├── Microsoft.Xaml.Interactivity │ ├── Properties │ │ └── Microsoft.Xaml.Interactivity.rd.xml │ └── Resources │ │ ├── zh-CN │ │ └── Strings.resw │ │ ├── zh-TW │ │ └── Strings.resw │ │ ├── ko-KR │ │ └── Strings.resw │ │ ├── ja-JP │ │ └── Strings.resw │ │ ├── uk-UA │ │ └── Strings.resw │ │ ├── ru-RU │ │ └── Strings.resw │ │ ├── it-IT │ │ └── Strings.resw │ │ ├── es-ES │ │ └── Strings.resw │ │ ├── pt-BR │ │ └── Strings.resw │ │ ├── fr-FR │ │ └── Strings.resw │ │ └── de-DE │ │ └── Strings.resw │ └── Directory.Build.props ├── LICENSE ├── .vsconfig ├── .gitattributes ├── .github └── workflows │ └── managed-build.yml ├── SECURITY.md ├── NuGet_Documentation ├── README.Native.md └── README.Managed.md ├── README.md └── .gitignore /tests/tests.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /key/Behaviors.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/XamlBehaviors/HEAD/key/Behaviors.snk -------------------------------------------------------------------------------- /key/FinalPublicKey.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/XamlBehaviors/HEAD/key/FinalPublicKey.snk -------------------------------------------------------------------------------- /key/35MSSharedLib1024.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/XamlBehaviors/HEAD/key/35MSSharedLib1024.snk -------------------------------------------------------------------------------- /scripts/download-nuget.cmd: -------------------------------------------------------------------------------- 1 | powershell -command "(New-Object System.Net.WebClient).DownloadFile('http://nuget.org/nuget.exe', '%~pd0nuget.exe')" 2 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/Assets/Cheer.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/XamlBehaviors/HEAD/samples/CS/XAMLBehaviorsSample/Assets/Cheer.mp3 -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/Assets/Ding.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/XamlBehaviors/HEAD/samples/CS/XAMLBehaviorsSample/Assets/Ding.mp3 -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/Assets/Whistle.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/XamlBehaviors/HEAD/samples/CS/XAMLBehaviorsSample/Assets/Whistle.mp3 -------------------------------------------------------------------------------- /assets/packaging/XAMLInteractiveBehaviors_128x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/XamlBehaviors/HEAD/assets/packaging/XAMLInteractiveBehaviors_128x.png -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/XamlBehaviors/HEAD/samples/CS/XAMLBehaviorsSample/Assets/StoreLogo.png -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/ManagedUnitTests/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/XamlBehaviors/HEAD/src/BehaviorsSDKManaged/ManagedUnitTests/Assets/StoreLogo.png -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/XamlBehaviors/HEAD/samples/CS/XAMLBehaviorsSample/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/XamlBehaviors/HEAD/samples/CS/XAMLBehaviorsSample/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/XamlBehaviors/HEAD/samples/CS/XAMLBehaviorsSample/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/XamlBehaviors/HEAD/samples/CS/XAMLBehaviorsSample/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/XamlBehaviors/HEAD/samples/CS/XAMLBehaviorsSample/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/ManagedUnitTests/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/XamlBehaviors/HEAD/src/BehaviorsSDKManaged/ManagedUnitTests/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/ManagedUnitTests/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/XamlBehaviors/HEAD/src/BehaviorsSDKManaged/ManagedUnitTests/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/ManagedUnitTests/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/XamlBehaviors/HEAD/src/BehaviorsSDKManaged/ManagedUnitTests/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/ManagedUnitTests/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/XamlBehaviors/HEAD/src/BehaviorsSDKManaged/ManagedUnitTests/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/ManagedUnitTests/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/XamlBehaviors/HEAD/src/BehaviorsSDKManaged/ManagedUnitTests/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/GlobalSuppressions.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/XamlBehaviors/HEAD/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/GlobalSuppressions.cs -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/XamlBehaviors/HEAD/samples/CS/XAMLBehaviorsSample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Version/NuGetPackageVersion.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 3.0.0 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/ManagedUnitTests/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/XamlBehaviors/HEAD/src/BehaviorsSDKManaged/ManagedUnitTests/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": 3 | { 4 | "version": "9.0.306", 5 | "rollForward": "latestFeature", 6 | "allowPrerelease": false 7 | }, 8 | "msbuild-sdks": { 9 | "MSBuild.Sdk.Extras": "3.0.44" 10 | } 11 | } -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/GoToStateControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using Windows.UI.Xaml.Controls; 2 | 3 | namespace XAMLBehaviorsSample; 4 | 5 | public sealed partial class GoToStateControl : UserControl 6 | { 7 | public GoToStateControl() 8 | { 9 | this.InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/PlaySoundControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using Windows.UI.Xaml.Controls; 2 | 3 | namespace XAMLBehaviorsSample; 4 | 5 | public sealed partial class PlaySoundControl : UserControl 6 | { 7 | public PlaySoundControl() 8 | { 9 | this.InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/DataTriggerControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using Windows.UI.Xaml.Controls; 2 | 3 | namespace XAMLBehaviorsSample; 4 | 5 | public sealed partial class DataTriggerControl : UserControl 6 | { 7 | public DataTriggerControl() 8 | { 9 | this.InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/CustomActionControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using Windows.UI.Xaml.Controls; 2 | 3 | namespace XAMLBehaviorsSample; 4 | 5 | public sealed partial class CustomActionControl : UserControl 6 | { 7 | public CustomActionControl() 8 | { 9 | this.InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/EventTriggerControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using Windows.UI.Xaml.Controls; 2 | 3 | namespace XAMLBehaviorsSample; 4 | 5 | public sealed partial class EventTriggerControl : UserControl 6 | { 7 | public EventTriggerControl() 8 | { 9 | this.InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/ChangePropertyControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using Windows.UI.Xaml.Controls; 2 | 3 | namespace XAMLBehaviorsSample; 4 | 5 | public sealed partial class ChangePropertyControl : UserControl 6 | { 7 | public ChangePropertyControl() 8 | { 9 | this.InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/CustomBehaviorControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using Windows.UI.Xaml.Controls; 2 | 3 | namespace XAMLBehaviorsSample; 4 | 5 | public sealed partial class CustomBehaviorControl : UserControl 6 | { 7 | public CustomBehaviorControl() 8 | { 9 | this.InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/NavigateToPageControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using Windows.UI.Xaml.Controls; 2 | 3 | namespace XAMLBehaviorsSample; 4 | 5 | public sealed partial class NavigateToPageControl : UserControl 6 | { 7 | public NavigateToPageControl() 8 | { 9 | this.InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/ControlStoryboardControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using Windows.UI.Xaml.Controls; 2 | 3 | namespace XAMLBehaviorsSample; 4 | 5 | public sealed partial class ControlStoryboardControl : UserControl 6 | { 7 | public ControlStoryboardControl() 8 | { 9 | this.InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/ManagedUnitTests/UnitTestApp.xaml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/NavigatePageSample.xaml.cs: -------------------------------------------------------------------------------- 1 | using Windows.UI.Xaml.Controls; 2 | 3 | namespace XAMLBehaviorsSample; 4 | 5 | /// 6 | /// An empty page that can be used on its own or navigated to within a Frame. 7 | /// 8 | public sealed partial class NavigatePageSample : Page 9 | { 10 | public NavigatePageSample() 11 | { 12 | this.InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/ContentDialogSample.xaml.cs: -------------------------------------------------------------------------------- 1 | using Windows.UI.Xaml.Controls; 2 | 3 | namespace XAMLBehaviorsSample; 4 | 5 | public sealed partial class ContentDialogSample : ContentDialog 6 | { 7 | public ContentDialogSample() 8 | { 9 | this.InitializeComponent(); 10 | } 11 | 12 | private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) 13 | { 14 | this.Hide(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/Properties/DesignTimeResources.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/ContentDialogPopUp.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xaml.Interactivity; 2 | using System; 3 | using Windows.UI.Xaml; 4 | 5 | namespace XAMLBehaviorsSample; 6 | 7 | class ContentDialogPopUp : DependencyObject, IAction 8 | { 9 | ContentDialogSample samplecd; 10 | 11 | public object Execute(object sender, object parameter) 12 | { 13 | samplecd = new ContentDialogSample(); 14 | ShowCD(); 15 | return null; 16 | } 17 | 18 | public async void ShowCD() 19 | { 20 | await samplecd.ShowAsync(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/ManagedUnitTests/BlankPage.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/ITrigger.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | namespace Microsoft.Xaml.Interactivity; 5 | 6 | /// 7 | /// Interface implemented by all custom triggers. 8 | /// 9 | public interface ITrigger : IBehavior 10 | { 11 | /// 12 | /// Gets the collection of actions associated with the behavior. 13 | /// 14 | ActionCollection Actions { get; } 15 | } -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/App.xaml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/ManagedUnitTests/BlankPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using Windows.UI.Xaml.Controls; 2 | 3 | namespace ManagedUnitTests; 4 | 5 | /// 6 | /// This page serves two purposes: 7 | /// 8 | /// 1. Its existence causes the XAML compiler to implement IXamlMetadataProvider 9 | /// on the App class. IXamlMetadataProvider is used by NavigateToPageAction and will 10 | /// only be implemented on App if there are XAML types defined in the project. 11 | /// 12 | /// 2. It provides a target for the NavigateToPageAction to navigate to in tests. 13 | /// 14 | public sealed partial class BlankPage : Page 15 | { 16 | public BlankPage() 17 | { 18 | this.InitializeComponent(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Version/Version.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System.Reflection; 5 | 6 | // Version information for an assembly consists of the following four values: 7 | // 8 | // Major Version 9 | // Minor Version 10 | // Build Number 11 | // Revision 12 | // 13 | // You can specify all the values or you can default the Build and Revision Numbers 14 | // by using the '*' as shown below: 15 | // [assembly: AssemblyVersion("1.0.*")] 16 | [assembly: AssemblyVersion("3.0.0.0")] 17 | [assembly: AssemblyFileVersion("3.0.0.0")] 18 | [assembly: AssemblyInformationalVersion("3.0.0.0")] 19 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.DesignTools/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | [assembly: AssemblyTitle("Microsoft.Xaml.Interactivity.DesignTools")] 5 | [assembly: AssemblyDescription("")] 6 | [assembly: AssemblyConfiguration("")] 7 | [assembly: AssemblyCompany("Microsoft")] 8 | [assembly: AssemblyProduct("Microsoft.Xaml.Interactivity.DesignTools")] 9 | [assembly: AssemblyCopyright("Copyright © Microsoft 2015-2024")] 10 | [assembly: AssemblyTrademark("")] 11 | [assembly: AssemblyCulture("")] 12 | 13 | [assembly: ComVisible(false)] 14 | 15 | // The following GUID is for the ID of the typelib if this project is exposed to COM 16 | [assembly: Guid("b6f7c183-33a0-4942-b680-97bea6011890")] -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/ContentDialogSample.xaml: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/CallMethodControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using Windows.UI.Xaml.Controls; 3 | 4 | namespace XAMLBehaviorsSample; 5 | 6 | public sealed partial class CallMethodControl : UserControl, INotifyPropertyChanged 7 | { 8 | public int Count { get; set; } 9 | 10 | public CallMethodControl() 11 | { 12 | this.InitializeComponent(); 13 | this.DataContext = this; 14 | Count = 0; 15 | } 16 | 17 | public event PropertyChangedEventHandler PropertyChanged; 18 | 19 | public void IncrementCount() 20 | { 21 | Count++; 22 | OnPropertyChanged(nameof(Count)); 23 | } 24 | 25 | private void OnPropertyChanged(string propertyName) 26 | { 27 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/IncrementalUpdateControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Windows.UI.Xaml.Controls; 3 | 4 | namespace XAMLBehaviorsSample; 5 | 6 | public sealed partial class IncrementalUpdateControl : UserControl 7 | { 8 | public List Items; 9 | public IncrementalUpdateControl() 10 | { 11 | this.InitializeComponent(); 12 | Items = new List(); 13 | gridViewSample.ItemsSource = Items; 14 | for(int i = 1; i <= 100; i++) 15 | { 16 | Items.Add(new ItemSample(i)); 17 | } 18 | } 19 | } 20 | 21 | public class ItemSample 22 | { 23 | public int Count { get; set; } 24 | public ItemSample() 25 | { 26 | Count = 0; 27 | } 28 | public ItemSample(int i) 29 | { 30 | Count = i; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/Utility/UwpVisualTreeHelper.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #if WinUI 5 | using Microsoft.UI.Xaml; 6 | using Microsoft.UI.Xaml.Media; 7 | #else 8 | using Windows.UI.Xaml; 9 | using Windows.UI.Xaml.Media; 10 | #endif 11 | 12 | namespace Microsoft.Xaml.Interactivity.Utility; 13 | 14 | /// 15 | /// IVisualTreeHelper implementation that calls the real VisualTreeHelper. 16 | /// 17 | internal class UwpVisualTreeHelper : IVisualTreeHelper 18 | { 19 | #region IVisualTreeHelper implementation 20 | 21 | public DependencyObject GetParent(DependencyObject reference) 22 | { 23 | return VisualTreeHelper.GetParent(reference); 24 | } 25 | 26 | #endregion 27 | } 28 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/ManagedUnitTests/TestVisualTreeHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.Xaml.Interactivity.Utility; 3 | using Windows.UI.Xaml; 4 | 5 | namespace ManagedUnitTests; 6 | 7 | /// 8 | /// Test impementation of VisualTreeHelper. Enables unit testing of code that 9 | /// uses VisualTreeHelper without needing a real visual tree. 10 | /// 11 | internal class TestVisualTreeHelper : IVisualTreeHelper 12 | { 13 | private Dictionary _parents = new Dictionary(); 14 | 15 | public void AddChild(DependencyObject parent, DependencyObject child) 16 | { 17 | this._parents[child] = parent; 18 | } 19 | 20 | #region IVisualTreeHelper implementation 21 | 22 | public DependencyObject GetParent(DependencyObject child) 23 | { 24 | DependencyObject parent; 25 | this._parents.TryGetValue(child, out parent); 26 | return parent; 27 | } 28 | 29 | #endregion 30 | } 31 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/IAction.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | namespace Microsoft.Xaml.Interactivity; 5 | 6 | /// 7 | /// Interface implemented by all custom actions. 8 | /// 9 | public interface IAction 10 | { 11 | /// 12 | /// Executes the action. 13 | /// 14 | /// The that is passed to the action by the behavior. Generally this is or a target object. 15 | /// The value of this parameter is determined by the caller. 16 | /// An example of parameter usage is EventTriggerBehavior, which passes the EventArgs as a parameter to its actions. 17 | /// Returns the result of the action. 18 | object Execute(object sender, object parameter); 19 | } 20 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/TypeConstraintAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Xaml.Interactivity; 7 | 8 | /// 9 | /// Specifies type constraints on the AssociatedObject of . 10 | /// 11 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] 12 | public sealed class TypeConstraintAttribute : Attribute 13 | { 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | /// The constraint type. 18 | public TypeConstraintAttribute(Type constraint) 19 | { 20 | this.Constraint = constraint; 21 | } 22 | 23 | /// 24 | /// Gets the constraint type. 25 | /// 26 | public Type Constraint 27 | { 28 | get; 29 | private set; 30 | } 31 | } -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/Core/ComparisonConditionType.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | namespace Microsoft.Xaml.Interactivity; 5 | 6 | /// 7 | /// Represents one ternary condition. 8 | /// 9 | public enum ComparisonConditionType 10 | { 11 | /// 12 | /// Specifies an equal condition. 13 | /// 14 | Equal, 15 | /// 16 | /// Specifies a not equal condition. 17 | /// 18 | NotEqual, 19 | /// 20 | /// Specifies a less than condition. 21 | /// 22 | LessThan, 23 | /// 24 | /// Specifies a less than or equal condition. 25 | /// 26 | LessThanOrEqual, 27 | /// 28 | /// Specifies a greater than condition. 29 | /// 30 | GreaterThan, 31 | /// 32 | /// Specifies a greater than or equal condition. 33 | /// 34 | GreaterThanOrEqual 35 | } 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Microsoft 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /.vsconfig: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0", 3 | "components": [ 4 | "Microsoft.VisualStudio.Workload.ManagedDesktop", 5 | "Microsoft.VisualStudio.Workload.NativeDesktop", 6 | "Microsoft.VisualStudio.Workload.Universal", 7 | "Microsoft.Net.Component.4.6.2.SDK", 8 | "Microsoft.Net.Component.4.7.2.SDK", 9 | "Microsoft.Net.Component.4.8.SDK", 10 | "Microsoft.Net.Component.4.8.1.SDK", 11 | "Microsoft.VisualStudio.Component.Windows10SDK.18362", 12 | "Microsoft.VisualStudio.Component.Windows10SDK.19041", 13 | "Microsoft.VisualStudio.Component.Windows11SDK.22000", 14 | "Microsoft.VisualStudio.Component.Windows11SDK.22621", 15 | "Microsoft.VisualStudio.Component.Windows11SDK.26100", 16 | "Microsoft.VisualStudio.ComponentGroup.MSIX.Packaging", 17 | "Microsoft.VisualStudio.ComponentGroup.UWP.NetCoreAndStandard", 18 | "Microsoft.VisualStudio.ComponentGroup.UWP.Support", 19 | "Microsoft.VisualStudio.PackageGroup.TestTools.Core" 20 | ], 21 | "extensions": [ 22 | "https://marketplace.visualstudio.com/items?itemName=TeamXavalon.XAMLStyler2022" 23 | ] 24 | } -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/IBehavior.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #if WinUI 5 | using Microsoft.UI.Xaml; 6 | #else 7 | using Windows.UI.Xaml; 8 | #endif 9 | 10 | namespace Microsoft.Xaml.Interactivity; 11 | 12 | /// 13 | /// Interface implemented by all custom behaviors. 14 | /// 15 | public interface IBehavior 16 | { 17 | /// 18 | /// Gets the to which the is attached. 19 | /// 20 | DependencyObject AssociatedObject 21 | { 22 | get; 23 | } 24 | 25 | /// 26 | /// Attaches to the specified object. 27 | /// 28 | /// The to which the will be attached. 29 | void Attach(DependencyObject associatedObject); 30 | 31 | /// 32 | /// Detaches this instance from its associated object. 33 | /// 34 | void Detach(); 35 | } 36 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/Microsoft.Xaml.Interactivity.Shared.shproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 52e3ed43-3013-4155-ad87-6df52a265d59 5 | 14.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/Utility/IVisualTreeHelper.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #if WinUI 5 | using Microsoft.UI.Xaml; 6 | #else 7 | using Windows.UI.Xaml; 8 | #endif 9 | 10 | namespace Microsoft.Xaml.Interactivity.Utility; 11 | 12 | /// 13 | /// Abstraction layer over the UWP's VisualTreeHelper class so we can 14 | /// mock it for unit testing purposes where an actual view won't be available. 15 | /// 16 | internal interface IVisualTreeHelper 17 | { 18 | /// 19 | /// Returns an object's parent object in the visual tree. 20 | /// 21 | /// 22 | /// The object for which to get the parent object. 23 | /// 24 | /// 25 | /// The parent object of the reference object in the visual tree. 26 | /// 27 | /// 28 | /// THREAD SAFETY: This method should be called on the object's Dispatcher thread. 29 | /// 30 | DependencyObject GetParent(DependencyObject reference); 31 | } 32 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("XAMLBehaviorsSample")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("XAMLBehaviorsSample")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2015-2022")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Version information for an assembly consists of the following four values: 18 | // 19 | // Major Version 20 | // Minor Version 21 | // Build Number 22 | // Revision 23 | // 24 | // You can specify all the values or you can default the Build and Revision Numbers 25 | // by using the '*' as shown below: 26 | // [assembly: AssemblyVersion("1.0.*")] 27 | [assembly: AssemblyVersion("1.0.0.0")] 28 | [assembly: AssemblyFileVersion("1.0.0.0")] 29 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/Media/ControlStoryboardOption.cs: -------------------------------------------------------------------------------- 1 | #if WinUI 2 | using Microsoft.UI.Xaml.Media.Animation; 3 | #else 4 | using Windows.UI.Xaml.Media.Animation; 5 | #endif 6 | 7 | // Copyright (c) Microsoft. All rights reserved. 8 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 9 | namespace Microsoft.Xaml.Interactivity; 10 | 11 | /// 12 | /// Represents operations that can be applied to . 13 | /// 14 | public enum ControlStoryboardOption 15 | { 16 | /// 17 | /// Specifies the play operation. 18 | /// 19 | Play, 20 | /// 21 | /// Specifies the stop operation. 22 | /// 23 | Stop, 24 | /// 25 | /// Specifies the TogglePlayPause operation. 26 | /// 27 | TogglePlayPause, 28 | /// 29 | /// Specifies the pause operation. 30 | /// 31 | Pause, 32 | /// 33 | /// Specifies the resume operation. 34 | /// 35 | Resume, 36 | /// 37 | /// Specifies the SkipToFill operation. 38 | /// 39 | SkipToFill 40 | } 41 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/ManagedUnitTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ManagedUnitTests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("ManagedUnitTests")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2015-2024")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | [assembly: AssemblyMetadata("TargetPlatform","UAP")] 17 | 18 | // Version information for an assembly consists of the following four values: 19 | // 20 | // Major Version 21 | // Minor Version 22 | // Build Number 23 | // Revision 24 | // 25 | // You can specify all the values or you can default the Build and Revision Numbers 26 | // by using the '*' as shown below: 27 | // [assembly: AssemblyVersion("1.0.*")] 28 | [assembly: AssemblyVersion("1.0.0.0")] 29 | [assembly: AssemblyFileVersion("1.0.0.0")] 30 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/ManagedUnitTests/Properties/UnitTestApp.rd.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/Properties/Default.rd.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /scripts/Microsoft.Xaml.Behaviors.Signing.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | true 6 | ..\..\..\key\FinalPublicKey.snk 7 | $(GenerateNuspecDependsOn);TimestampNugetPackage 8 | 9 | 10 | true 11 | 12 | 13 | 14 | 15 | Microsoft400 16 | StrongName 17 | 18 | 19 | Microsoft400 20 | StrongName 21 | 22 | 23 | 24 | 25 | 26 | $([System.DateTime]::Now.ToString(yyyyMMdd-HHmm)) 27 | $(PackageVersion)-CI-$(CurrentDate) 28 | version=$(PackageVersion) 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/DefaultEventAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Xaml.Interactivity; 7 | 8 | /// 9 | /// Provides design tools information about which EventName to set for EventTriggerBehavior when instantiating an . 10 | /// 11 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] 12 | public sealed class DefaultEventAttribute : Attribute 13 | { 14 | private readonly Type _targetType; 15 | private readonly string _eventName; 16 | 17 | /// 18 | /// Initializes a new instance of the class. 19 | /// 20 | /// The type this attribute applies to. 21 | /// The event name for the EventTriggerBehavior. 22 | public DefaultEventAttribute(Type targetType, string eventName) 23 | { 24 | this._targetType = targetType; 25 | this._eventName = eventName; 26 | } 27 | 28 | /// 29 | /// Gets the type that the applies to. 30 | /// 31 | public Type TargetType 32 | { 33 | get 34 | { 35 | return this._targetType; 36 | } 37 | } 38 | 39 | /// 40 | /// Gets the event name to pass to the EventTriggerBehavior constructor. 41 | /// 42 | public string EventName 43 | { 44 | get 45 | { 46 | return this._eventName; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/ManagedUnitTests/Package.appxmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ManagedUnitTests 7 | xamlbehaviors 8 | Assets\StoreLogo.png 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System.Reflection; 5 | using System.Runtime.CompilerServices; 6 | using System.Runtime.InteropServices; 7 | 8 | // General Information about an assembly is controlled through the following 9 | // set of attributes. Change these attribute values to modify the information 10 | // associated with an assembly. 11 | #if !NET8_0_OR_GREATER 12 | [assembly: AssemblyTitle("Microsoft.Xaml.Interactivity")] 13 | [assembly: AssemblyCompany("Microsoft")] 14 | [assembly: AssemblyProduct("Microsoft.Xaml.Interactivity")] 15 | [assembly: AssemblyConfiguration("")] 16 | [assembly: AssemblyCopyright("Copyright © Microsoft 2015-2024")] 17 | #endif 18 | [assembly: AssemblyDescription("")] 19 | [assembly: AssemblyTrademark("")] 20 | [assembly: AssemblyCulture("")] 21 | 22 | [assembly: ComVisible(false)] 23 | 24 | // Behaviors.snk public key is 0024000004800000940000000602000000240000525341310004000001000100e5435599803109fe684072f487ec0670f2766325a25d47089633ffb5d9a56bf115a705bc0632660aeecfe00248951540865f481613845080859feafc5d9b55750395e7ca4c2124136d17bc9e73f0371d802fc2c9e8308f6f8b0ab3096661d2d1b0cbbbcb6de3fe711ef415f29271088537081b09ad1ee08ce8020b22031cdebd 25 | [assembly: InternalsVisibleTo("ManagedUnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100e5435599803109fe684072f487ec0670f2766325a25d47089633ffb5d9a56bf115a705bc0632660aeecfe00248951540865f481613845080859feafc5d9b55750395e7ca4c2124136d17bc9e73f0371d802fc2c9e8308f6f8b0ab3096661d2d1b0cbbbcb6de3fe711ef415f29271088537081b09ad1ee08ce8020b22031cdebd")] -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/ManagedUnitTests/ActionCollectionTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | using Microsoft.VisualStudio.TestTools.UnitTesting.AppContainer; 6 | using Microsoft.Xaml.Interactivity; 7 | 8 | namespace ManagedUnitTests; 9 | 10 | [TestClass] 11 | public class ActionCollectionTest 12 | { 13 | [UITestMethod] 14 | public void Constructor_DefaultConstructor_SetsVolumeCorrectly() 15 | { 16 | PlaySoundAction playSoundAction = new PlaySoundAction(); 17 | Assert.AreEqual(0.5, playSoundAction.Volume, "Volume should be initialized to 0.5"); 18 | } 19 | 20 | [UITestMethod] 21 | public void Invoke_RelativeSource_Invokes() 22 | { 23 | PlaySoundAction playSoundAction = new PlaySoundAction(); 24 | 25 | playSoundAction.Source = "foo.wav"; 26 | bool result = (bool)playSoundAction.Execute(null, null); 27 | Assert.IsTrue(result); 28 | } 29 | 30 | [UITestMethod] 31 | public void Invoke_AbsoluteSource_Invokes() 32 | { 33 | PlaySoundAction playSoundAction = new PlaySoundAction(); 34 | 35 | playSoundAction.Source = "ms-appx:///foo.wav"; 36 | bool result = (bool)playSoundAction.Execute(null, null); 37 | Assert.IsTrue(result); 38 | } 39 | 40 | [UITestMethod] 41 | public void Invoke_InvalidSource_ReturnsFalse() 42 | { 43 | PlaySoundAction playSoundAction = new PlaySoundAction(); 44 | 45 | Assert.IsFalse((bool)playSoundAction.Execute(null, null), 46 | "PlaySoundAction.Execute should return false with a null source path."); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/BehaviorOfT.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | 6 | #if WinUI 7 | using Microsoft.UI.Xaml; 8 | #else 9 | using Windows.UI.Xaml; 10 | #endif 11 | 12 | namespace Microsoft.Xaml.Interactivity; 13 | 14 | /// 15 | /// A base class for behaviors making them code compatible with older frameworks, 16 | /// and allow for typed associtated objects. 17 | /// 18 | /// The object type to attach to 19 | public abstract class Behavior : Behavior where T : DependencyObject 20 | { 21 | /// 22 | /// Gets the object to which this behavior is attached. 23 | /// 24 | public new T AssociatedObject 25 | { 26 | get { return base.AssociatedObject as T; } 27 | } 28 | 29 | /// 30 | /// Called after the behavior is attached to the . 31 | /// 32 | /// 33 | /// Override this to hook up functionality to the 34 | /// 35 | protected override void OnAttached() 36 | { 37 | base.OnAttached(); 38 | 39 | if (this.AssociatedObject == null) 40 | { 41 | string actualType = base.AssociatedObject.GetType().FullName; 42 | string expectedType = typeof (T).FullName; 43 | string message = string.Format(ResourceHelper.GetString("InvalidAssociatedObjectExceptionMessage"), actualType, expectedType); 44 | throw new InvalidOperationException(message); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/Trigger.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | using System.Diagnostics.CodeAnalysis; 6 | 7 | #if WinUI 8 | using Microsoft.UI.Xaml; 9 | using Microsoft.UI.Xaml.Markup; 10 | #else 11 | using Windows.UI.Xaml; 12 | using Windows.UI.Xaml.Markup; 13 | #endif 14 | 15 | namespace Microsoft.Xaml.Interactivity; 16 | 17 | /// 18 | /// A base class for behaviors, implementing the basic plumbing of ITrigger 19 | /// 20 | [ContentPropertyAttribute(Name = "Actions")] 21 | public abstract class Trigger : Behavior, ITrigger 22 | { 23 | /// 24 | /// Identifies the dependency property. 25 | /// 26 | [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] 27 | public static readonly DependencyProperty ActionsProperty = DependencyProperty.Register( 28 | "Actions", 29 | typeof(ActionCollection), 30 | typeof(Trigger), 31 | new PropertyMetadata(null)); 32 | 33 | /// 34 | /// Gets the collection of actions associated with the behavior. This is a dependency property. 35 | /// 36 | public ActionCollection Actions 37 | { 38 | get 39 | { 40 | ActionCollection actionCollection = (ActionCollection)this.GetValue(Trigger.ActionsProperty); 41 | if (actionCollection == null) 42 | { 43 | actionCollection = new ActionCollection(); 44 | this.SetValue(Trigger.ActionsProperty, actionCollection); 45 | } 46 | 47 | return actionCollection; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/Package.appxmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 13 | 14 | 15 | 16 | 17 | XAMLBehaviorsSample 18 | jonchu 19 | Assets\StoreLogo.png 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/TriggerOfT.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | using System.ComponentModel; 6 | 7 | #if WinUI 8 | using Microsoft.UI.Xaml; 9 | #else 10 | using Windows.UI.Xaml; 11 | #endif 12 | 13 | namespace Microsoft.Xaml.Interactivity; 14 | 15 | /// 16 | /// A base class for behaviors, implementing the basic plumbing of ITrigger 17 | /// 18 | /// The object type to attach to 19 | public abstract class Trigger : Trigger where T : DependencyObject 20 | { 21 | /// 22 | /// Gets the object to which this behavior is attached. 23 | /// 24 | [EditorBrowsable(EditorBrowsableState.Never)] 25 | public new T AssociatedObject 26 | { 27 | get { return base.AssociatedObject as T; } 28 | } 29 | 30 | /// 31 | /// Called after the behavior is attached to the . 32 | /// 33 | /// 34 | /// Override this to hook up functionality to the 35 | /// 36 | protected override void OnAttached() 37 | { 38 | base.OnAttached(); 39 | 40 | if (this.AssociatedObject == null) 41 | { 42 | string actualType = base.AssociatedObject.GetType().FullName; 43 | string expectedType = typeof(T).FullName; 44 | string message = string.Format(ResourceHelper.GetString("InvalidAssociatedObjectExceptionMessage"), actualType, expectedType); 45 | throw new InvalidOperationException(message); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/ActionCollection.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | using Windows.Foundation.Collections; 6 | 7 | #if WinUI 8 | using Microsoft.UI.Xaml; 9 | #else 10 | using Windows.UI.Xaml; 11 | #endif 12 | 13 | namespace Microsoft.Xaml.Interactivity; 14 | 15 | /// 16 | /// Represents a collection of IActions. 17 | /// 18 | public sealed partial class ActionCollection : DependencyObjectCollection 19 | { 20 | /// 21 | /// Initializes a new instance of the class. 22 | /// 23 | public ActionCollection() 24 | { 25 | this.VectorChanged += this.ActionCollection_VectorChanged; 26 | } 27 | 28 | private void ActionCollection_VectorChanged(IObservableVector sender, IVectorChangedEventArgs eventArgs) 29 | { 30 | CollectionChange collectionChange = eventArgs.CollectionChange; 31 | 32 | if (collectionChange == CollectionChange.Reset) 33 | { 34 | foreach (DependencyObject item in this) 35 | { 36 | ActionCollection.VerifyType(item); 37 | } 38 | } 39 | else if (collectionChange == CollectionChange.ItemInserted || collectionChange == CollectionChange.ItemChanged) 40 | { 41 | DependencyObject changedItem = this[(int)eventArgs.Index]; 42 | ActionCollection.VerifyType(changedItem); 43 | } 44 | } 45 | 46 | private static void VerifyType(DependencyObject item) 47 | { 48 | if (!(item is IAction)) 49 | { 50 | throw new InvalidOperationException(ResourceHelper.GetString("NonActionAddedToActionCollectionExceptionMessage")); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity/Properties/Microsoft.Xaml.Interactivity.rd.xml: -------------------------------------------------------------------------------- 1 | 2 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/ManagedUnitTests/TestUitilties.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | using Windows.UI.Xaml; 6 | using Microsoft.VisualStudio.TestTools.UnitTesting; 7 | 8 | namespace ManagedUnitTests; 9 | 10 | public static class TestUtilities 11 | { 12 | /// 13 | /// Handles the difference between InvalidOperationException in managed and native. 14 | /// 15 | public static void AssertThrowsInvalidOperationException(Action action) 16 | { 17 | Assert.ThrowsException(action); 18 | } 19 | 20 | public static void AssertThrowsArgumentException(Action action) 21 | { 22 | Assert.ThrowsException(action); 23 | } 24 | 25 | public static void AssertDetached(StubBehavior behavior) 26 | { 27 | Assert.AreEqual(1, behavior.DetachCount, "The Behavior should be detached."); 28 | Assert.IsNull(behavior.AssociatedObject, "A Detached Behavior should have a null AssociatedObject."); 29 | } 30 | 31 | public static void AssertNotDetached(StubBehavior behavior) 32 | { 33 | Assert.AreEqual(0, behavior.DetachCount, "The Behavior should not be detached."); 34 | } 35 | 36 | public static void AssertAttached(StubBehavior behavior, DependencyObject associatedObject) 37 | { 38 | Assert.AreEqual(1, behavior.AttachCount, "The behavior should be attached."); 39 | Assert.AreEqual(associatedObject, behavior.AssociatedObject, "The AssociatedObject of the Behavior should be what it was attached to."); 40 | } 41 | 42 | public static void AssertNotAttached(StubBehavior behavior) 43 | { 44 | Assert.AreEqual(0, behavior.AttachCount, "The behavior should not be attached."); 45 | Assert.IsNull(behavior.AssociatedObject, "The AssociatedObject should be null for a non-attached Behavior."); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/CustomPropertyValueEditorAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Xaml.Interactivity; 7 | 8 | /// 9 | /// Enumerates possible values for reusable property value editors. 10 | /// 11 | public enum CustomPropertyValueEditor 12 | { 13 | /// 14 | /// Uses the storyboard picker, if supported, to edit this property at design time. 15 | /// 16 | Storyboard, 17 | /// 18 | /// Uses the state picker, if supported, to edit this property at design time. 19 | /// 20 | StateName, 21 | /// 22 | /// Uses the element-binding picker, if supported, to edit this property at design time. 23 | /// 24 | ElementBinding, 25 | /// 26 | /// Uses the property-binding picker, if supported, to edit this property at design time. 27 | /// 28 | PropertyBinding, 29 | } 30 | 31 | /// 32 | /// Associates the given editor type with the property to which the is applied. 33 | /// 34 | /// Use this attribute to get improved design-time editing for properties that denote element (by name), storyboards, or states (by name). 35 | [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] 36 | public sealed class CustomPropertyValueEditorAttribute : Attribute 37 | { 38 | /// 39 | /// Initializes a new instance of the class. 40 | /// 41 | /// The custom property value editor. 42 | public CustomPropertyValueEditorAttribute(CustomPropertyValueEditor customPropertyValueEditor) 43 | { 44 | this.CustomPropertyValueEditor = customPropertyValueEditor; 45 | } 46 | 47 | /// 48 | /// Gets the custom property value editor. 49 | /// 50 | public CustomPropertyValueEditor CustomPropertyValueEditor 51 | { 52 | get; 53 | private set; 54 | } 55 | } -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.DesignTools/MetadataTableProvider.SurfaceIsolation.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Xaml.Interactivity.Design; 7 | 8 | partial class MetadataTableProvider 9 | { 10 | private void AddAttributes(string typeIdentifier, params Attribute[] attributes) 11 | { 12 | _attributeTableBuilder.AddCustomAttributes(typeIdentifier, attributes); 13 | } 14 | 15 | private void AddAttributes(string typeIdentifier, string propertyName, params Attribute[] attributes) 16 | { 17 | _attributeTableBuilder.AddCustomAttributes(typeIdentifier, propertyName, attributes); 18 | } 19 | 20 | /// 21 | /// This class contains the type names required by the new Extensibility APIs. 22 | /// 23 | private static class Targets 24 | { 25 | private const string rootNamespace = "Microsoft.Xaml.Interactivity."; 26 | 27 | internal const string CallMethodAction = rootNamespace + "CallMethodAction"; 28 | internal const string ChangePropertyAction = rootNamespace + "ChangePropertyAction"; 29 | internal const string ControlStoryboardAction = rootNamespace + "ControlStoryboardAction"; 30 | internal const string DataTriggerBehavior = rootNamespace + "DataTriggerBehavior"; 31 | internal const string IncrementalUpdateBehavior = rootNamespace + "IncrementalUpdateBehavior"; 32 | internal const string EventTriggerBehavior = rootNamespace + "EventTriggerBehavior"; 33 | internal const string GoToStateAction = rootNamespace + "GoToStateAction"; 34 | internal const string InvokeCommandAction = rootNamespace + "InvokeCommandAction"; 35 | internal const string NavigateToPageAction = rootNamespace + "NavigateToPageAction"; 36 | internal const string PlaySoundAction = rootNamespace + "PlaySoundAction"; 37 | internal const string ActionCollection = rootNamespace + "ActionCollection"; 38 | internal const string BehaviorCollection = rootNamespace + "BehaviorCollection"; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /scripts/Microsoft.Xaml.Behaviors.WinUI.Managed.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Microsoft.Xaml.Behaviors.WinUI.Managed 5 | $version$ 6 | Microsoft.Xaml.Behaviors.WinUI.Managed 7 | Microsoft 8 | xamlexperiencesteam,Microsoft 9 | true 10 | Easily add interactivity to your WinUI apps using XAML Behaviors. Behaviors encapsulate reusable functionalities for elements that can be easily added to your XAML without the need for more imperative code. This is the managed version for C# UWP WinUI projects. 11 | MIT 12 | http://go.microsoft.com/fwlink/?LinkID=651678 13 | http://go.microsoft.com/fwlink/?LinkID=708511 14 | © Microsoft Corporation. All rights reserved. 15 | Behavior Action Behaviors Actions Blend Managed C# Interaction Interactivity Interactions WinUI 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | $([MSBuild]::EnsureTrailingSlash($([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), BehaviorsSDKManaged.sln)))) 12 | $(BehaviorsSDKManagedSolutionPath) 13 | 14 | 15 | 16 | 17 | 12.0 18 | true 19 | 20 | 25 | strict 26 | 27 | 35 | true 36 | 37 | 38 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/InvokeCommandControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Windows.Input; 4 | using Windows.UI; 5 | using Windows.UI.Xaml.Controls; 6 | using Windows.UI.Xaml.Media; 7 | 8 | namespace XAMLBehaviorsSample; 9 | 10 | public sealed partial class InvokeCommandControl : UserControl, INotifyPropertyChanged 11 | { 12 | public int Count { get; set; } 13 | public event PropertyChangedEventHandler PropertyChanged; 14 | public SolidColorBrush darkgreybrush; 15 | public SolidColorBrush pinkbrush; 16 | 17 | public class SampleCommand : ICommand 18 | { 19 | public event EventHandler CanExecuteChanged; 20 | 21 | public bool CanExecute(object parameter) 22 | { 23 | return true; 24 | } 25 | 26 | public void Execute(object parameter) 27 | { 28 | CanExecuteChanged(null, null); 29 | } 30 | } 31 | 32 | public ICommand UpdateCountCommand { get; set; } 33 | public ICommand UpdateGreyCommand { get; set; } 34 | public ICommand UpdatePinkCommand { get; set; } 35 | 36 | public InvokeCommandControl() 37 | { 38 | this.InitializeComponent(); 39 | UpdateCountCommand = new SampleCommand(); 40 | UpdateGreyCommand = new SampleCommand(); 41 | UpdatePinkCommand = new SampleCommand(); 42 | 43 | this.UpdateCountCommand.CanExecuteChanged += UpdateCountCommand_CanExecuteChanged; 44 | this.UpdateGreyCommand.CanExecuteChanged += UpdateGreyCommand_CanExecuteChanged; 45 | this.UpdatePinkCommand.CanExecuteChanged += UpdatePinkCommand_CanExecuteChanged; 46 | 47 | this.DataContext = this; 48 | darkgreybrush = new SolidColorBrush(); 49 | darkgreybrush.Color = Color.FromArgb(255, 51, 51, 50); 50 | pinkbrush = new SolidColorBrush(); 51 | pinkbrush.Color = Color.FromArgb(255, 233, 95, 91); 52 | } 53 | 54 | private void UpdateCountCommand_CanExecuteChanged(object sender, EventArgs e) 55 | { 56 | Count++; 57 | OnPropertyChanged(nameof(Count)); 58 | } 59 | 60 | private void UpdateGreyCommand_CanExecuteChanged(object sender, EventArgs e) 61 | { 62 | border.Background = darkgreybrush; 63 | } 64 | 65 | private void UpdatePinkCommand_CanExecuteChanged(object sender, EventArgs e) 66 | { 67 | border.Background = pinkbrush; 68 | } 69 | 70 | private void OnPropertyChanged(string propertyName) 71 | { 72 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/DragPositionBehavior.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xaml.Interactivity; 2 | using Windows.Foundation; 3 | using Windows.UI.Xaml; 4 | using Windows.UI.Xaml.Input; 5 | using Windows.UI.Xaml.Media; 6 | 7 | namespace XAMLBehaviorsSample; 8 | 9 | public class DragPositionBehavior : DependencyObject, IBehavior 10 | { 11 | public DependencyObject AssociatedObject 12 | { 13 | get; 14 | set; 15 | } 16 | 17 | public void Attach(DependencyObject associatedObject) 18 | { 19 | if ((associatedObject != AssociatedObject) && !Windows.ApplicationModel.DesignMode.DesignModeEnabled) 20 | { 21 | AssociatedObject = associatedObject; 22 | var fe = AssociatedObject as FrameworkElement; 23 | if (fe != null) 24 | { 25 | fe.PointerPressed += fe_PointerPressed; 26 | fe.PointerReleased += fe_PointerReleased; 27 | } 28 | } 29 | } 30 | 31 | UIElement parent = null; 32 | Point prevPoint; 33 | int pointerId = -1; 34 | void fe_PointerPressed(object sender, PointerRoutedEventArgs e) 35 | { 36 | var fe = AssociatedObject as FrameworkElement; 37 | parent = (UIElement)fe.Parent; 38 | 39 | if (!(fe.RenderTransform is TranslateTransform)) 40 | fe.RenderTransform = new TranslateTransform(); 41 | prevPoint = e.GetCurrentPoint(parent).Position; 42 | parent.PointerMoved += move; 43 | pointerId = (int)e.Pointer.PointerId; 44 | } 45 | 46 | private void move(object o, PointerRoutedEventArgs args) 47 | { 48 | if (args.Pointer.PointerId != pointerId) 49 | return; 50 | 51 | var fe = AssociatedObject as FrameworkElement; 52 | var pos = args.GetCurrentPoint(parent).Position; 53 | var tr = (TranslateTransform)fe.RenderTransform; 54 | tr.X += pos.X - prevPoint.X; 55 | tr.Y += pos.Y - prevPoint.Y; 56 | prevPoint = pos; 57 | } 58 | void fe_PointerReleased(object sender, PointerRoutedEventArgs e) 59 | { 60 | var fe = AssociatedObject as FrameworkElement; 61 | if (e.Pointer.PointerId != pointerId) 62 | return; 63 | parent.PointerMoved -= move; 64 | pointerId = -1; 65 | } 66 | public void Detach() 67 | { 68 | var fe = AssociatedObject as FrameworkElement; 69 | if (fe != null) 70 | { 71 | fe.PointerPressed -= fe_PointerPressed; 72 | fe.PointerReleased -= fe_PointerReleased; 73 | } 74 | parent = null; 75 | AssociatedObject = null; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/NavigatePageSample.xaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /.github/workflows/managed-build.yml: -------------------------------------------------------------------------------- 1 | name: Build Managed 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | managed-build: 11 | runs-on: windows-2022 12 | steps: 13 | - name: Checkout XamlBehaviors.git 14 | uses: actions/checkout@v4 15 | 16 | - name: Install the .NET 9.0.306 SDK 17 | uses: actions/setup-dotnet@v4 18 | with: 19 | dotnet-version: 9.0.306 20 | 21 | - name: Setup MSBuild 22 | uses: microsoft/setup-msbuild@v2 23 | 24 | - name: Setup/Install NuGet 6.11.0 25 | uses: nuget/setup-nuget@v2 26 | with: 27 | nuget-version: '6.11.0' 28 | 29 | - name: NuGet Restore BehaviorsSDKManaged.sln 30 | run: nuget restore src\BehaviorsSDKManaged\BehaviorsSDKManaged.sln 31 | 32 | - name: Build BehaviorsSDKManaged.sln 33 | run: msbuild src\BehaviorsSDKManaged\BehaviorsSDKManaged.sln /p:Configuration=Release -v:diag /bl 34 | 35 | - name: Upload MSBuild binary log 36 | uses: actions/upload-artifact@v4 37 | with: 38 | name: msbuild_binlog_Release_x64 39 | path: msbuild.binlog 40 | if-no-files-found: error 41 | 42 | - name: Build UWP package 43 | run: msbuild /t:pack src\BehaviorsSDKManaged\Microsoft.Xaml.Interactivity.Uwp\Microsoft.Xaml.Interactivity.Uwp.csproj /p:Configuration=Release /p:TimestampPackage=true 44 | 45 | - name: Build WinUI 3 package 46 | run: msbuild /t:pack src\BehaviorsSDKManaged\Microsoft.Xaml.Interactivity.WinUI\Microsoft.Xaml.Interactivity.WinUI.csproj /p:Configuration=Release /p:TimestampPackage=true 47 | 48 | - name: Upload NuGet packages 49 | uses: actions/upload-artifact@v4 50 | with: 51 | name: nuget_packages 52 | path: out\NuGetPackages\*.nupkg 53 | if-no-files-found: error 54 | 55 | samples-build: 56 | runs-on: windows-2022 57 | steps: 58 | - name: Checkout XamlBehaviors.git 59 | uses: actions/checkout@v4 60 | 61 | - name: Install the .NET 9.0.306 SDK 62 | uses: actions/setup-dotnet@v4 63 | with: 64 | dotnet-version: 9.0.306 65 | 66 | - name: Setup MSBuild 67 | uses: microsoft/setup-msbuild@v2 68 | 69 | - name: Setup/Install NuGet 6.11.0 70 | uses: nuget/setup-nuget@v2 71 | with: 72 | nuget-version: '6.11.0' 73 | 74 | - name: NuGet Restore XAMLBehaviorsSample.sln 75 | run: nuget restore samples\CS\XAMLBehaviorsSample.sln 76 | 77 | - name: Build XAMLBehaviorsSample.sln 78 | run: msbuild samples\CS\XAMLBehaviorsSample.sln /p:Configuration=Release -v:diag /bl 79 | 80 | - name: Upload MSBuild binary log 81 | uses: actions/upload-artifact@v4 82 | with: 83 | name: msbuild_samples_binlog_Release_x64 84 | path: msbuild.binlog 85 | if-no-files-found: error 86 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Security 4 | 5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). 6 | 7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. 8 | 9 | ## Reporting Security Issues 10 | 11 | **Please do not report security vulnerabilities through public GitHub issues.** 12 | 13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). 14 | 15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). 16 | 17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). 18 | 19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: 20 | 21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) 22 | * Full paths of source file(s) related to the manifestation of the issue 23 | * The location of the affected source code (tag/branch/commit or direct URL) 24 | * Any special configuration required to reproduce the issue 25 | * Step-by-step instructions to reproduce the issue 26 | * Proof-of-concept or exploit code (if possible) 27 | * Impact of the issue, including how an attacker might exploit the issue 28 | 29 | This information will help us triage your report more quickly. 30 | 31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. 32 | 33 | ## Preferred Languages 34 | 35 | We prefer all communications to be in English. 36 | 37 | ## Policy 38 | 39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/ManagedUnitTests/NavigateToPageActionTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | using Microsoft.VisualStudio.TestTools.UnitTesting.AppContainer; 6 | using Microsoft.Xaml.Interactivity; 7 | using Windows.UI.Xaml; 8 | 9 | namespace ManagedUnitTests; 10 | 11 | [TestClass] 12 | public class NavigateToPageActionTest 13 | { 14 | private static readonly string TestPageName = typeof(BlankPage).FullName; 15 | 16 | [UITestMethod] 17 | public void Execute_SenderImplementsINavigate_NavigatesToSender() 18 | { 19 | // Arrange 20 | TestVisualTreeHelper visualTreeHelper = new TestVisualTreeHelper(); 21 | NavigateToPageAction action = new NavigateToPageAction(visualTreeHelper); 22 | action.TargetPage = NavigateToPageActionTest.TestPageName; 23 | NavigableStub navigateTarget = new NavigableStub(); 24 | 25 | // Act 26 | bool success = (bool)action.Execute(navigateTarget, null); 27 | 28 | // Assert 29 | Assert.IsTrue(success); 30 | Assert.AreEqual(NavigateToPageActionTest.TestPageName, navigateTarget.NavigatedTypeFullName); 31 | } 32 | 33 | [UITestMethod] 34 | public void Execute_SenderDoesNotImplementINavigate_NavigatesToAncestor() 35 | { 36 | // Arrange 37 | TestVisualTreeHelper visualTreeHelper = new TestVisualTreeHelper(); 38 | NavigateToPageAction action = new NavigateToPageAction(visualTreeHelper); 39 | action.TargetPage = NavigateToPageActionTest.TestPageName; 40 | DependencyObject sender = new SimpleDependencyObject(); 41 | NavigableStub navigateTarget = new NavigableStub(); 42 | visualTreeHelper.AddChild(navigateTarget, sender); 43 | 44 | // Act 45 | bool success = (bool)action.Execute(sender, null); 46 | 47 | // Assert 48 | Assert.IsTrue(success); 49 | Assert.AreEqual(NavigateToPageActionTest.TestPageName, navigateTarget.NavigatedTypeFullName); 50 | } 51 | 52 | [UITestMethod] 53 | public void Execute_NoAncestorImplementsINavigate_Fails() 54 | { 55 | // Arrange 56 | TestVisualTreeHelper visualTreeHelper = new TestVisualTreeHelper(); 57 | NavigateToPageAction action = new NavigateToPageAction(visualTreeHelper); 58 | action.TargetPage = NavigateToPageActionTest.TestPageName; 59 | DependencyObject sender = new SimpleDependencyObject(); 60 | DependencyObject parent = new SimpleDependencyObject(); 61 | visualTreeHelper.AddChild(parent, sender); 62 | 63 | // Act 64 | bool success = (bool)action.Execute(sender, null); 65 | 66 | // Assert 67 | Assert.IsFalse(success); 68 | } 69 | 70 | private class SimpleDependencyObject : DependencyObject 71 | { 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /NuGet_Documentation/README.Native.md: -------------------------------------------------------------------------------- 1 | ## Build Status 2 | ![](https://ci.appveyor.com/api/projects/status/897ervx359xqa7vh/branch/master?svg=true) 3 | 4 | ## Getting Started 5 | 6 | ### Resources 7 | 8 | - [Documentation](https://github.com/Microsoft/XamlBehaviors/wiki) 9 | - [Samples](/samples) 10 | - [Changelog](https://github.com/Microsoft/XamlBehaviors/wiki/Changelog) 11 | - [Source Code](https://github.com/Microsoft/XamlBehaviors) 12 | - [![Join the chat at https://gitter.im/Microsoft/XamlBehaviors](https://badges.gitter.im/Microsoft/XamlBehaviors.svg)](https://gitter.im/Microsoft/XamlBehaviors?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 13 | 14 | ### More Info 15 | 16 | - [Report a bug or ask a question](https://github.com/Microsoft/XamlBehaviors/issues) 17 | - [Contribute](https://github.com/Microsoft/XamlBehaviors/wiki/Contribute-to-XAML-Behaviors) 18 | - [License](http://opensource.org/licenses/MIT) 19 | 20 | ## Code Example 21 | 22 | For an example of using Behaviors in an application, here is a snippet of XAML: 23 | ```xml 24 | 35 | ``` 36 | ## Using Behaviors SDK 37 | 38 | The [documentation](https://github.com/Microsoft/XamlBehaviors/wiki) explains how to install Visual Studio, add the XAML Behaviors NuGet package to your project, and get started using the API. 39 | 40 | ## Building Behaviors from Source 41 | 42 | **What You Need** 43 | 44 | - [Visual Studio 2015 Update 1 w/ Universal Windows Tools](https://www.visualstudio.com/features/windows-apps-games-vs) 45 | - [Multilingual App Toolkit](https://developer.microsoft.com/en-us/windows/develop/multilingual-app-toolkit) 46 | 47 | **Clone the Repository** 48 | 49 | - Go to 'View' -> 'Team Explorer' -> 'Local Git Repositories' -> 'Clone' 50 | - Add the XAML Behaviors repository URL (https://github.com/Microsoft/XamlBehaviors) and hit 'Clone' 51 | 52 | **Build and Create Managed XAML Behaviors NuGet** 53 | 54 | - Open the "BehaviorsSDKManaged.sln" solution in Visual Studio 55 | - Change Build Configuration to Release 56 | - Build [Ctrl + B] 57 | - Install the latest NuGet command-line tool by running **scripts/download-nuget.cmd** 58 | - Run **scripts/CreateManagedNuGet.cmd** 59 | - *(Optional)* Provide a version number to the command line to override the default version 60 | 61 | **Build and Create Native XAML Behaviors NuGet** 62 | 63 | - Open the "BehaviorsSDKNative.sln" solution in Visual Studio 64 | - [Batch Build](https://msdn.microsoft.com/en-us/library/169az28z(v=vs.90).aspx) for x86, x64, and ARM in Release 65 | - Install the latest NuGet command-line tool by running **scripts/download-nuget.cmd** 66 | - Run **scripts/CreateNativeNuGet.cmd** 67 | - *(Optional)* Provide a version number to the command line to override the default version 68 | -------------------------------------------------------------------------------- /NuGet_Documentation/README.Managed.md: -------------------------------------------------------------------------------- 1 | ## Build Status 2 | ![](https://ci.appveyor.com/api/projects/status/0dptycdhhykyscr4/branch/master?svg=true) 3 | 4 | ## Getting Started 5 | 6 | ### Resources 7 | 8 | - [Documentation](https://github.com/Microsoft/XamlBehaviors/wiki) 9 | - [Samples](/samples) 10 | - [Changelog](https://github.com/Microsoft/XamlBehaviors/wiki/Changelog) 11 | - [Source Code](https://github.com/Microsoft/XamlBehaviors) 12 | - [![Join the chat at https://gitter.im/Microsoft/XamlBehaviors](https://badges.gitter.im/Microsoft/XamlBehaviors.svg)](https://gitter.im/Microsoft/XamlBehaviors?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 13 | 14 | ### More Info 15 | 16 | - [Report a bug or ask a question](https://github.com/Microsoft/XamlBehaviors/issues) 17 | - [Contribute](https://github.com/Microsoft/XamlBehaviors/wiki/Contribute-to-XAML-Behaviors) 18 | - [License](http://opensource.org/licenses/MIT) 19 | 20 | ## Code Example 21 | 22 | For an example of using Behaviors in an application, here is a snippet of XAML: 23 | ```xml 24 | 35 | ``` 36 | ## Using Behaviors SDK 37 | 38 | The [documentation](https://github.com/Microsoft/XamlBehaviors/wiki) explains how to install Visual Studio, add the XAML Behaviors NuGet package to your project, and get started using the API. 39 | 40 | ## Building Behaviors from Source 41 | 42 | **What You Need** 43 | 44 | - [Visual Studio 2015 Update 1 w/ Universal Windows Tools](https://www.visualstudio.com/features/windows-apps-games-vs) 45 | - [Multilingual App Toolkit](https://developer.microsoft.com/en-us/windows/develop/multilingual-app-toolkit) 46 | 47 | **Clone the Repository** 48 | 49 | - Go to 'View' -> 'Team Explorer' -> 'Local Git Repositories' -> 'Clone' 50 | - Add the XAML Behaviors repository URL (https://github.com/Microsoft/XamlBehaviors) and hit 'Clone' 51 | 52 | **Build and Create Managed XAML Behaviors NuGet** 53 | 54 | - Open the "BehaviorsSDKManaged.sln" solution in Visual Studio 55 | - Change Build Configuration to Release 56 | - Build [Ctrl + B] 57 | - Install the latest NuGet command-line tool by running **scripts/download-nuget.cmd** 58 | - Run **scripts/CreateManagedNuGet.cmd** 59 | - *(Optional)* Provide a version number to the command line to override the default version 60 | 61 | **Build and Create Native XAML Behaviors NuGet** 62 | 63 | - Open the "BehaviorsSDKNative.sln" solution in Visual Studio 64 | - [Batch Build](https://msdn.microsoft.com/en-us/library/169az28z(v=vs.90).aspx) for x86, x64, and ARM in Release 65 | - Install the latest NuGet command-line tool by running **scripts/download-nuget.cmd** 66 | - Run **scripts/CreateNativeNuGet.cmd** 67 | - *(Optional)* Provide a version number to the command line to override the default version 68 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/Behavior.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | using System.Diagnostics; 6 | using System.Globalization; 7 | 8 | #if WinUI 9 | using Microsoft.UI.Xaml; 10 | #else 11 | using Windows.UI.Xaml; 12 | #endif 13 | 14 | namespace Microsoft.Xaml.Interactivity; 15 | 16 | /// 17 | /// A base class for behaviors, implementing the basic plumbing of IBehavior 18 | /// 19 | public abstract class Behavior : DependencyObject, IBehavior 20 | { 21 | /// 22 | /// Gets the to which the behavior is attached. 23 | /// 24 | public DependencyObject AssociatedObject { get; private set; } 25 | 26 | /// 27 | /// Attaches the behavior to the specified . 28 | /// 29 | /// The to which to attach. 30 | /// is null. 31 | public void Attach(DependencyObject associatedObject) 32 | { 33 | if (associatedObject == this.AssociatedObject || global::Windows.ApplicationModel.DesignMode.DesignModeEnabled) 34 | { 35 | return; 36 | } 37 | 38 | if (this.AssociatedObject != null) 39 | { 40 | throw new InvalidOperationException(string.Format( 41 | CultureInfo.CurrentCulture, 42 | ResourceHelper.CannotAttachBehaviorMultipleTimesExceptionMessage, 43 | associatedObject, 44 | this.AssociatedObject)); 45 | } 46 | 47 | Debug.Assert(associatedObject != null, "Cannot attach the behavior to a null object."); 48 | 49 | if (associatedObject == null) throw new ArgumentNullException(nameof(associatedObject)); 50 | 51 | AssociatedObject = associatedObject; 52 | OnAttached(); 53 | } 54 | 55 | /// 56 | /// Detaches the behaviors from the . 57 | /// 58 | public void Detach() 59 | { 60 | OnDetaching(); 61 | AssociatedObject = null; 62 | } 63 | 64 | /// 65 | /// Called after the behavior is attached to the . 66 | /// 67 | /// 68 | /// Override this to hook up functionality to the 69 | /// 70 | protected virtual void OnAttached() 71 | { 72 | } 73 | 74 | /// 75 | /// Called when the behavior is being detached from its . 76 | /// 77 | /// 78 | /// Override this to unhook functionality from the 79 | /// 80 | protected virtual void OnDetaching() 81 | { 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/Microsoft.Xaml.Interactivity.Shared.projitems: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | true 6 | 52e3ed43-3013-4155-ad87-6df52a265d59 7 | 8 | 9 | Microsoft.Xaml.Interactivity.Shared 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/Core/ResourceHelper.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | namespace Microsoft.Xaml.Interactivity; 5 | 6 | using Windows.ApplicationModel.Resources; 7 | 8 | internal static class ResourceHelper 9 | { 10 | #if NET8_0_OR_GREATER && !MODERN_WINDOWS_UWP 11 | private static ResourceLoader strings = new ResourceLoader(ResourceLoader.GetDefaultResourceFilePath(), "Microsoft.Xaml.Interactivity/Strings"); 12 | #endif 13 | 14 | public static string GetString(string resourceName) 15 | { 16 | #if !NET8_0_OR_GREATER || MODERN_WINDOWS_UWP 17 | ResourceLoader strings = ResourceLoader.GetForCurrentView("Microsoft.Xaml.Interactivity/Strings"); 18 | #endif 19 | return strings.GetString(resourceName); 20 | } 21 | 22 | public static string CallMethodActionValidMethodNotFoundExceptionMessage 23 | { 24 | get 25 | { 26 | return ResourceHelper.GetString("CallMethodActionValidMethodNotFoundExceptionMessage"); 27 | } 28 | } 29 | 30 | public static string ChangePropertyActionCannotFindPropertyNameExceptionMessage 31 | { 32 | get 33 | { 34 | return ResourceHelper.GetString("ChangePropertyActionCannotFindPropertyNameExceptionMessage"); 35 | } 36 | } 37 | 38 | public static string ChangePropertyActionCannotSetValueExceptionMessage 39 | { 40 | get 41 | { 42 | return ResourceHelper.GetString("ChangePropertyActionCannotSetValueExceptionMessage"); 43 | } 44 | } 45 | 46 | public static string ChangePropertyActionPropertyIsReadOnlyExceptionMessage 47 | { 48 | get 49 | { 50 | return ResourceHelper.GetString("ChangePropertyActionPropertyIsReadOnlyExceptionMessage"); 51 | } 52 | } 53 | 54 | public static string GoToStateActionTargetHasNoStateGroups 55 | { 56 | get 57 | { 58 | return ResourceHelper.GetString("GoToStateActionTargetHasNoStateGroups"); 59 | } 60 | } 61 | 62 | public static string CannotAttachBehaviorMultipleTimesExceptionMessage 63 | { 64 | get 65 | { 66 | return ResourceHelper.GetString("CannotAttachBehaviorMultipleTimesExceptionMessage"); 67 | } 68 | } 69 | 70 | public static string CannotFindEventNameExceptionMessage 71 | { 72 | get 73 | { 74 | return ResourceHelper.GetString("CannotFindEventNameExceptionMessage"); 75 | } 76 | } 77 | 78 | public static string InvalidLeftOperand 79 | { 80 | get 81 | { 82 | return ResourceHelper.GetString("InvalidLeftOperand"); 83 | } 84 | } 85 | 86 | public static string InvalidRightOperand 87 | { 88 | get 89 | { 90 | return ResourceHelper.GetString("InvalidRightOperand"); 91 | } 92 | } 93 | 94 | public static string InvalidOperands 95 | { 96 | get 97 | { 98 | return ResourceHelper.GetString("InvalidOperands"); 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/CustomBehaviorControl.xaml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Implementing a Custom Behavior for DragPositionBehavior allows controls to be moved around the canvas. 34 | In this example, the shapes are able to be dragged around the page using a mouse drag. 35 | 36 | 37 | 38 | <Rectangle> 39 | <Interactivity:Interaction.Behaviors> 40 | <Behaviors:DragPositionBehavior/> 41 | </Interactivity:Interaction.Behaviors> 42 | </Rectangle> 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /scripts/Microsoft.Xaml.Behaviors.Uwp.Managed.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Microsoft.Xaml.Behaviors.Uwp.Managed 5 | $version$ 6 | Microsoft.Xaml.Behaviors.Uwp.Managed 7 | Microsoft 8 | xamlexperiencesteam,Microsoft 9 | true 10 | Easily add interactivity to your apps using XAML Behaviors. Now with UWP support! Behaviors encapsulate reusable functionalities for elements that can be easily added to your XAML without the need for more imperative code. This is the managed version for C# UWP projects. 11 | MIT 12 | http://go.microsoft.com/fwlink/?LinkID=651678 13 | http://go.microsoft.com/fwlink/?LinkID=708511 14 | © Microsoft Corporation. All rights reserved. 15 | Behavior Action Behaviors Actions Blend Managed C# Interaction Interactivity Interactions 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/Core/DataBindingHelper.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | #if NET8_0_OR_GREATER 7 | using System.Diagnostics.CodeAnalysis; 8 | #endif 9 | using System.Reflection; 10 | 11 | #if WinUI 12 | using Microsoft.UI.Xaml; 13 | using Microsoft.UI.Xaml.Data; 14 | #else 15 | using Windows.UI.Xaml; 16 | using Windows.UI.Xaml.Data; 17 | #endif 18 | 19 | namespace Microsoft.Xaml.Interactivity; 20 | 21 | internal static class DataBindingHelper 22 | { 23 | private static readonly Dictionary> DependenciesPropertyCache = new Dictionary>(); 24 | 25 | /// 26 | /// Ensures that all binding expression on actions are up to date. 27 | /// 28 | /// 29 | /// DataTriggerBehavior fires during data binding phase. Since the ActionCollection is a child of the behavior, 30 | /// bindings on the action may not be up-to-date. This routine is called before the action 31 | /// is executed in order to guarantee that all bindings are refreshed with the most current data. 32 | /// 33 | #if NET8_0_OR_GREATER 34 | [RequiresUnreferencedCode("This method accesses all fields of input action objects.")] 35 | #endif 36 | public static void RefreshDataBindingsOnActions(ActionCollection actions) 37 | { 38 | foreach (DependencyObject action in actions) 39 | { 40 | foreach (DependencyProperty property in DataBindingHelper.GetDependencyProperties(action.GetType())) 41 | { 42 | DataBindingHelper.RefreshBinding(action, property); 43 | } 44 | } 45 | } 46 | 47 | private static IEnumerable GetDependencyProperties( 48 | #if NET8_0_OR_GREATER 49 | [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] 50 | #endif 51 | Type type) 52 | { 53 | List propertyList = null; 54 | 55 | if (!DataBindingHelper.DependenciesPropertyCache.TryGetValue(type, out propertyList)) 56 | { 57 | propertyList = new List(); 58 | 59 | while (type != null && type != typeof(DependencyObject)) 60 | { 61 | foreach (FieldInfo fieldInfo in type.GetRuntimeFields()) 62 | { 63 | if (fieldInfo.IsPublic && fieldInfo.FieldType == typeof(DependencyProperty)) 64 | { 65 | DependencyProperty property = fieldInfo.GetValue(null) as DependencyProperty; 66 | if (property != null) 67 | { 68 | propertyList.Add(property); 69 | } 70 | } 71 | } 72 | 73 | type = type.GetTypeInfo().BaseType; 74 | } 75 | 76 | DataBindingHelper.DependenciesPropertyCache[type] = propertyList; 77 | } 78 | 79 | return propertyList; 80 | } 81 | 82 | private static void RefreshBinding(DependencyObject target, DependencyProperty property) 83 | { 84 | BindingExpression binding = target.ReadLocalValue(property) as BindingExpression; 85 | if (binding != null && binding.ParentBinding != null) 86 | { 87 | BindingOperations.SetBinding(target, property, binding.ParentBinding); 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/CustomActionControl.xaml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | This example illustrates a custom action that brings up a ContentDialog when the button is clicked. 35 | 36 | 37 | 38 | <Button x:Name="button"> 39 | <Interactivity:Interaction.Behaviors> 40 | <Interactivity:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button}"> 41 | <Behaviors:ContentDialogPopUp/> 42 | </Interactions:EventTriggerBehavior> 43 | </Interactivity:Interaction.Behaviors> 44 | </Button> 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/NavigateToPageControl.xaml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | NavigateToPageAction represents an action that switches the current visual to a specified Page. In this example, clicking the button triggers a NavigateToPageAction that reloads the current page. 33 | 34 | 35 | <Button x:Name="button"> 36 | <Interactivity:Interaction.Behaviors> 37 | <Interactivity:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button}"> 38 | <Interactivity:NavigateToPageAction TargetPage="XAMLBehaviorsSample.NavigatePageSample"/> 39 | </Interactions:EventTriggerBehavior> 40 | </Interactivity:Interaction.Behaviors> 41 | </Button> 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/Core/TypeConverterHelper.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | using System.Globalization; 6 | 7 | #if WinUI 8 | using Microsoft.UI.Xaml.Controls; 9 | using Microsoft.UI.Xaml.Markup; 10 | #else 11 | using Windows.UI.Xaml.Controls; 12 | using Windows.UI.Xaml.Markup; 13 | #endif 14 | 15 | namespace Microsoft.Xaml.Interactivity; 16 | 17 | /// 18 | /// A helper class that enables converting values specified in markup (strings) to their object representation. 19 | /// 20 | internal static class TypeConverterHelper 21 | { 22 | private const string ContentControlFormatString = "{2}"; 23 | 24 | /// 25 | /// Converts string representation of a value to its object representation. 26 | /// 27 | /// The value to convert. 28 | /// The full name of the destination type. 29 | /// Object representation of the string value. 30 | /// destinationTypeFullName cannot be null. 31 | public static Object Convert(string value, string destinationTypeFullName) 32 | { 33 | if (string.IsNullOrEmpty(destinationTypeFullName)) 34 | { 35 | throw new ArgumentNullException(nameof(destinationTypeFullName)); 36 | } 37 | 38 | string scope = TypeConverterHelper.GetScope(destinationTypeFullName); 39 | 40 | // Value types in the "System" namespace must be special cased due to a bug in the xaml compiler 41 | if (string.Equals(scope, "System", StringComparison.Ordinal)) 42 | { 43 | if (string.Equals(destinationTypeFullName, (typeof(string).FullName), StringComparison.Ordinal)) 44 | { 45 | return value; 46 | } 47 | else if (string.Equals(destinationTypeFullName, typeof(bool).FullName, StringComparison.Ordinal)) 48 | { 49 | return bool.Parse(value); 50 | } 51 | else if (string.Equals(destinationTypeFullName, typeof(int).FullName, StringComparison.Ordinal)) 52 | { 53 | return int.Parse(value, CultureInfo.InvariantCulture); 54 | } 55 | else if (string.Equals(destinationTypeFullName, typeof(double).FullName, StringComparison.Ordinal)) 56 | { 57 | return double.Parse(value, CultureInfo.InvariantCulture); 58 | } 59 | } 60 | 61 | string type = TypeConverterHelper.GetType(destinationTypeFullName); 62 | string contentControlXaml = string.Format(CultureInfo.InvariantCulture, TypeConverterHelper.ContentControlFormatString, scope, type, value); 63 | 64 | ContentControl contentControl = XamlReader.Load(contentControlXaml) as ContentControl; 65 | if (contentControl != null) 66 | { 67 | return contentControl.Content; 68 | } 69 | 70 | return null; 71 | } 72 | 73 | private static String GetScope(string name) 74 | { 75 | int indexOfLastPeriod = name.LastIndexOf('.'); 76 | if (indexOfLastPeriod != name.Length - 1) 77 | { 78 | return name.Substring(0, indexOfLastPeriod); 79 | } 80 | 81 | return name; 82 | } 83 | 84 | private static String GetType(string name) 85 | { 86 | int indexOfLastPeriod = name.LastIndexOf('.'); 87 | if (indexOfLastPeriod != name.Length - 1) 88 | { 89 | return name.Substring(++indexOfLastPeriod); 90 | } 91 | 92 | return name; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/ManagedUnitTests/UnitTestApp.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Runtime.InteropServices.WindowsRuntime; 6 | using Windows.ApplicationModel; 7 | using Windows.ApplicationModel.Activation; 8 | using Windows.Foundation; 9 | using Windows.Foundation.Collections; 10 | using Windows.UI.Xaml; 11 | using Windows.UI.Xaml.Controls; 12 | using Windows.UI.Xaml.Controls.Primitives; 13 | using Windows.UI.Xaml.Data; 14 | using Windows.UI.Xaml.Input; 15 | using Windows.UI.Xaml.Media; 16 | using Windows.UI.Xaml.Navigation; 17 | 18 | namespace ManagedUnitTests; 19 | 20 | /// 21 | /// Provides application-specific behavior to supplement the default Application class. 22 | /// 23 | sealed partial class App : Application 24 | { 25 | /// 26 | /// Initializes the singleton application object. This is the first line of authored code 27 | /// executed, and as such is the logical equivalent of main() or WinMain(). 28 | /// 29 | public App() 30 | { 31 | this.InitializeComponent(); 32 | this.Suspending += OnSuspending; 33 | } 34 | 35 | /// 36 | /// Invoked when the application is launched normally by the end user. Other entry points 37 | /// will be used such as when the application is launched to open a specific file. 38 | /// 39 | /// Details about the launch request and process. 40 | protected override void OnLaunched(LaunchActivatedEventArgs e) 41 | { 42 | 43 | #if DEBUG 44 | if (System.Diagnostics.Debugger.IsAttached) 45 | { 46 | this.DebugSettings.EnableFrameRateCounter = true; 47 | } 48 | #endif 49 | 50 | Frame rootFrame = Window.Current.Content as Frame; 51 | 52 | // Do not repeat app initialization when the Window already has content, 53 | // just ensure that the window is active 54 | if (rootFrame == null) 55 | { 56 | // Create a Frame to act as the navigation context and navigate to the first page 57 | rootFrame = new Frame(); 58 | 59 | rootFrame.NavigationFailed += OnNavigationFailed; 60 | 61 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) 62 | { 63 | //TODO: Load state from previously suspended application 64 | } 65 | 66 | // Place the frame in the current Window 67 | Window.Current.Content = rootFrame; 68 | } 69 | 70 | Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.CreateDefaultUI(); 71 | 72 | // Ensure the current window is active 73 | Window.Current.Activate(); 74 | 75 | Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.Run(e.Arguments); 76 | } 77 | 78 | /// 79 | /// Invoked when Navigation to a certain page fails 80 | /// 81 | /// The Frame which failed navigation 82 | /// Details about the navigation failure 83 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e) 84 | { 85 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName); 86 | } 87 | 88 | /// 89 | /// Invoked when application execution is being suspended. Application state is saved 90 | /// without knowing whether the application will be terminated or resumed with the contents 91 | /// of memory still intact. 92 | /// 93 | /// The source of the suspend request. 94 | /// Details about the suspend request. 95 | private void OnSuspending(object sender, SuspendingEventArgs e) 96 | { 97 | var deferral = e.SuspendingOperation.GetDeferral(); 98 | //TODO: Save application state and stop any background activity 99 | deferral.Complete(); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # XAML Behaviors 2 | 3 | XAML Behaviors is an easy-to-use means of adding common and reusable interactivity to your Windows UWP applications with minimal code. It is available for managed applications only. Use of XAML Behaviors is governed by the MIT License 4 | 5 | ## Build Status 6 | 7 | | Platform | Status | 8 | | -------- | ------ | 9 | | Managed | ![Build Managed](https://github.com/microsoft/XamlBehaviors/workflows/Build%20Managed/badge.svg) | 10 | 11 | ## Getting Started 12 | 13 | ### Where to get it 14 | 15 | - NuGet package for [Managed](https://www.nuget.org/packages/Microsoft.Xaml.Behaviors.Uwp.Managed/) 16 | - [Source Code](https://github.com/Microsoft/XamlBehaviors) 17 | 18 | ### Resources 19 | 20 | - [Documentation](https://github.com/Microsoft/XamlBehaviors/wiki) 21 | - [Samples](/samples) 22 | - [Changelog](https://github.com/Microsoft/XamlBehaviors/wiki/Changelog) 23 | - [![Join the chat at https://gitter.im/Microsoft/XamlBehaviors](https://badges.gitter.im/Microsoft/XamlBehaviors.svg)](https://gitter.im/Microsoft/XamlBehaviors?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 24 | 25 | ### More Info 26 | 27 | - [Report a bug or ask a question](https://github.com/Microsoft/XamlBehaviors/issues) 28 | - [Contribute](https://github.com/Microsoft/XamlBehaviors/wiki/Contribute-to-XAML-Behaviors) 29 | - [License](http://opensource.org/licenses/MIT) 30 | 31 | ### Code Example 32 | 33 | For an example of using Behaviors in an application, here is a snippet of XAML: 34 | 35 | ```xml 36 | 47 | ``` 48 | 49 | ### Using Behaviors SDK 50 | 51 | The [documentation](https://github.com/Microsoft/XamlBehaviors/wiki) explains how to install Visual Studio, add the XAML Behaviors NuGet package to your project, and get started using the API. 52 | 53 | ### Building Behaviors from Source 54 | 55 | #### What You Need 56 | 57 | - [Visual Studio 2022 17.12+ w/ Universal Windows Tools](https://visualstudio.microsoft.com/vs/features/universal-windows-platform/) 58 | - [Multilingual App Toolkit](https://developer.microsoft.com/en-us/windows/develop/multilingual-app-toolkit) 59 | 60 | #### Clone the Repository 61 | 62 | - Go to 'View' -> 'Team Explorer' -> 'Local Git Repositories' -> 'Clone' 63 | - Add the XAML Behaviors repository URL (https://github.com/Microsoft/XamlBehaviors) and hit 'Clone' 64 | 65 | #### Build and Create Managed XAML Behaviors NuGet 66 | 67 | - Ensure that [nuget.exe](https://learn.microsoft.com/en-us/nuget/install-nuget-client-tools?tabs=windows) is available in PATH 68 | - If you're using Visual Studio 69 | - Open the "BehaviorsSDKManaged.sln" solution in Visual Studio 70 | - Change Build Configuration to Release 71 | - Build solution with right click > Build, or by clicking F6 72 | - If you're building from CLI (Visual Studio Developer Command prompt): 73 | - Run `nuget restore src\BehaviorsSDKManaged\BehaviorsSDKManaged.sln` 74 | - Run `msbuild -t:build src\BehaviorsSDKManaged\BehaviorsSDKManaged.sln /p:Configuration=Release` 75 | 76 | For UWP: 77 | - Run `msbuild /t:pack src\BehaviorsSDKManaged\Microsoft.Xaml.Interactivity.Uwp\Microsoft.Xaml.Interactivity.Uwp.csproj /p:Configuration=Release` 78 | - *(Optional)* Add `/p:TimestampPackage=true` to include the timestamp in the NuGet package version 79 | 80 | For WinUI: 81 | 82 | - Run `msbuild /t:Pack src\BehaviorsSDKManaged\Microsoft.Xaml.Interactivity.WinUI\Microsoft.Xaml.Interactivity.WinUI.csproj /p:Configuration=Release` 83 | - *(Optional)* Add `/p:TimestampPackage=true` to include the timestamp in the NuGet package version 84 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/CallMethodControl.xaml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | CallMethodAction represents an action which when triggered, calls a method on a specified object. 34 | In this example, Pressing the button triggers the CallMethodAction to invoke a method that increments the number displayed. 35 | 36 | 37 | 38 | <Button x:Name="button"> 39 | <Interactivity:Interaction.Behaviors> 40 | <Interactivity:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button}"> 41 | <Interactivity:CallMethodAction TargetObject="{Binding}" MethodName="IncrementCount"/> 42 | </Interactions:EventTriggerBehavior> 43 | </Interactivity:Interaction.Behaviors> 44 | </Button> 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity/Resources/zh-CN/Strings.resw: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | text/microsoft-resx 5 | 6 | 7 | 2.0 8 | 9 | 10 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 11 | 12 | 13 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 14 | 15 | 16 | 在 {1} 类型的对象上找不到符合正确签名的名为 {0} 的方法。 17 | {0} is the name of the method that could not be found. {1} is the name of the type that was searched for the method. 18 | 19 | 20 | 行为的实例不能一次附加到多个对象。 21 | 22 | 23 | 在类型 {1} 上找不到名为 {0} 的事件。 24 | {0} is the EventName property value specified by the user. {1} is the Type we are trying to find an event on. 25 | 26 | 27 | 在类型 {1} 上找不到名为 {0} 的属性。 28 | {0} is the PropertyName property value specified by the user. {1} is the Type we are trying to find a property on. 29 | 30 | 31 | 无法将 {0} 类型的值赋予 {2} 类型的属性 {1}。{1} 属性只可接受 {2} 类型的赋值。 32 | {0} is the type name of the illegal value, or "null" if value is null. {1} is the name of the property. {2} is the type of the property. 33 | 34 | 35 | 类型 {1} 定义的属性 {0} 不 揭示 set 方法,因此不可修改。 36 | {0} is the name of the property. {1} is the name of the type that defines the property. 37 | 38 | 39 | 不支持事件 {0}。请考虑实现自定义 IBehavior 以响应此事件。 40 | {0} is the name of an event. 41 | 42 | 43 | 目标 {0} 不定义任何 VisualStateGroups。 44 | {0} is an element name and could be an empty string. 45 | 46 | 47 | {0} 类型的 Binding 属性无法用于运算符 {1}。 48 | {0} is the type of the DataTriggerBehavior.Binding property specified by the user. {1} is one of the ComparisonConditionType enum values. 49 | 50 | 51 | {0} 类型的 Binding 属性以及 {1} 类型的 Value 属性无法用于运算符 {2}。 52 | {0} is the type of the DataTriggerBehavior.Binding property specified by the user. {1} is the type of the DataTriggerBehavior.Value property specified by the user. {2} is one of the ComparisonConditionType enum values. 53 | 54 | 55 | {0} 类型的 Value 属性无法用于运算符 {1}。 56 | {1} is the type of the DataTriggerBehavior.Value property specified by the user. {1} is one of the ComparisonConditionType enum values. 57 | 58 | 59 | 不能多次将行为的实例添加到 BehaviorCollection。 60 | 61 | 62 | 在 ActionCollection 中只支持 IAction 类型。 63 | 64 | 65 | 在 BehaviorCollection 中只支持 IBehavior 类型。 66 | 67 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity/Resources/zh-TW/Strings.resw: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | text/microsoft-resx 5 | 6 | 7 | 2.0 8 | 9 | 10 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 11 | 12 | 13 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 14 | 15 | 16 | 在類型 {1} 的物件上找不到符合預期的簽章且名稱為 {0} 的方法。 17 | {0} is the name of the method that could not be found. {1} is the name of the type that was searched for the method. 18 | 19 | 20 | 無法一次將行為執行個體附加到多個物件。 21 | 22 | 23 | 在類型 {1} 上找不到名稱為 {0} 的事件。 24 | {0} is the EventName property value specified by the user. {1} is the Type we are trying to find an event on. 25 | 26 | 27 | 在類型 {1} 上找不到名稱為 {0} 的屬性。 28 | {0} is the PropertyName property value specified by the user. {1} is the Type we are trying to find a property on. 29 | 30 | 31 | 無法將類型 {0} 的值指派給類型 {2} 的屬性 {1}。只有類型 {2} 的值能夠指派給 {1} 屬性。 32 | {0} is the type name of the illegal value, or "null" if value is null. {1} is the name of the property. {2} is the type of the property. 33 | 34 | 35 | 類型 {1} 所定義的屬性 {0} 未公開 set 方法,因此無法修改。 36 | {0} is the name of the property. {1} is the name of the type that defines the property. 37 | 38 | 39 | 不支援事件 {0}。請考慮實作自訂的 IBehavior 以回應這個事件。 40 | {0} is the name of an event. 41 | 42 | 43 | 目標 {0} 未定義任何 VisualStateGroups。 44 | {0} is an element name and could be an empty string. 45 | 46 | 47 | 類型 {0} 的 Binding 屬性無法搭配運算子 {1} 一起使用。 48 | {0} is the type of the DataTriggerBehavior.Binding property specified by the user. {1} is one of the ComparisonConditionType enum values. 49 | 50 | 51 | 類型 {0} 的 Binding 屬性和類型 {1} 的 Value 屬性無法搭配運算子 {2} 一起使用。 52 | {0} is the type of the DataTriggerBehavior.Binding property specified by the user. {1} is the type of the DataTriggerBehavior.Value property specified by the user. {2} is one of the ComparisonConditionType enum values. 53 | 54 | 55 | 類型 {0} 的 Value 屬性無法搭配運算子 {1} 一起使用。 56 | {1} is the type of the DataTriggerBehavior.Value property specified by the user. {1} is one of the ComparisonConditionType enum values. 57 | 58 | 59 | 無法重複將行為執行個體加到 BehaviorCollection。 60 | 61 | 62 | ActionCollection 只支援 IAction 類型。 63 | 64 | 65 | BehaviorCollection 只支援 IBehavior 類型。 66 | 67 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/EventTriggerControl.xaml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | EventTriggerBehavior listens for a specific event on its source and executes an action when the event is fired. 34 | In this example, the EventTriggerBehavior listens for the "Click" event on the button. When it is fired, it triggers the changing of the rectangle's color. 35 | 36 | 37 | 38 | <Button x:Name="button"> 39 | <Interactivity:Interaction.Behaviors> 40 | <Interactivity:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button}"> 41 | <Interactivity:ChangePropertyAction TargetObject="{Binding ElementName=DataTriggerRectangle}" PropertyName="Fill" Value="{StaticResource PaleYellowBrush}"/> 42 | </Interactions:EventTriggerBehavior> 43 | </Interactivity:Interaction.Behaviors> 44 | </Button> 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity/Resources/ko-KR/Strings.resw: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | text/microsoft-resx 5 | 6 | 7 | 2.0 8 | 9 | 10 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 11 | 12 | 13 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 14 | 15 | 16 | {1} 형식의 개체에서 예상 시그니처와 일치하는 이름이 {0}인 메서드를 찾을 수 없습니다. 17 | {0} is the name of the method that could not be found. {1} is the name of the type that was searched for the method. 18 | 19 | 20 | 동작의 인스턴스 하나를 한 번에 둘 이상의 개체에 연결할 수 없습니다. 21 | 22 | 23 | 이름이 {0}인 형식 {1}의 이벤트를 찾을 수 없습니다. 24 | {0} is the EventName property value specified by the user. {1} is the Type we are trying to find an event on. 25 | 26 | 27 | 이름이 {0}인 형식 {1}의 속성을 찾을 수 없습니다. 28 | {0} is the PropertyName property value specified by the user. {1} is the Type we are trying to find a property on. 29 | 30 | 31 | {0} 형식의 값을 {2} 형식의 속성 {1}에 할당할 수 없습니다. {1} 속성에는 {2} 형식의 값만 할당할 수 있습니다. 32 | {0} is the type name of the illegal value, or "null" if value is null. {1} is the name of the property. {2} is the type of the property. 33 | 34 | 35 | {1} 형식으로 정의된 {0} 속성이 set 메서드를 노출하지 않으므로 수정할 수 없습니다. 36 | {0} is the name of the property. {1} is the name of the type that defines the property. 37 | 38 | 39 | {0} 이벤트가 지원되지 않습니다. 이 이벤트에 응답하도록 사용자 지정 IBehavior를 구현해 보십시오. 40 | {0} is the name of an event. 41 | 42 | 43 | 대상 {0}이(가) VisualStateGroups를 정의하지 않습니다. 44 | {0} is an element name and could be an empty string. 45 | 46 | 47 | {0} 형식의 Binding 속성을 {1} 연산자와 함께 사용할 수 없습니다. 48 | {0} is the type of the DataTriggerBehavior.Binding property specified by the user. {1} is one of the ComparisonConditionType enum values. 49 | 50 | 51 | {0} 형식의 Binding 속성과 {1} 형식의 Value 속성을 {2} 연산자와 함께 사용할 수 없습니다. 52 | {0} is the type of the DataTriggerBehavior.Binding property specified by the user. {1} is the type of the DataTriggerBehavior.Value property specified by the user. {2} is one of the ComparisonConditionType enum values. 53 | 54 | 55 | {0} 형식의 Value 속성을 {1} 연산자와 함께 사용할 수 없습니다. 56 | {1} is the type of the DataTriggerBehavior.Value property specified by the user. {1} is one of the ComparisonConditionType enum values. 57 | 58 | 59 | 동작의 인스턴스 하나를 BehaviorCollection에 두 번 이상 추가할 수 없습니다. 60 | 61 | 62 | ActionCollection에서 IAction 형식만 지원됩니다. 63 | 64 | 65 | BehaviorCollection에서 IBehavior 형식만 지원됩니다. 66 | 67 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity/Resources/ja-JP/Strings.resw: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | text/microsoft-resx 5 | 6 | 7 | 2.0 8 | 9 | 10 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 11 | 12 | 13 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 14 | 15 | 16 | メソッド {0} が、期待される署名と一致する型 {1} のオブジェクトにありません。 17 | {0} is the name of the method that could not be found. {1} is the name of the type that was searched for the method. 18 | 19 | 20 | ビヘイビアーのインスタンスは、1 度に複数のオブジェクトに追加することはできません。 21 | 22 | 23 | 名前が {0} (型 {1}) のイベントが見つかりません。 24 | {0} is the EventName property value specified by the user. {1} is the Type we are trying to find an event on. 25 | 26 | 27 | 名前が {0} (型 {1}) のプロパティが見つかりません。 28 | {0} is the PropertyName property value specified by the user. {1} is the Type we are trying to find a property on. 29 | 30 | 31 | 型 {0} の値をプロパティ {1} (型 {2}) に割り当てることができません。{1} プロパティは、型 {2} の値にのみ割り当てることができます。 32 | {0} is the type name of the illegal value, or "null" if value is null. {1} is the name of the property. {2} is the type of the property. 33 | 34 | 35 | プロパティ {0} (型 {1} で定義) は、set メソッドを提示していないため、修正できません。 36 | {0} is the name of the property. {1} is the name of the type that defines the property. 37 | 38 | 39 | イベント {0} はサポートされていません。カスタム IBehavior を実装して、このイベントに応答することを検討してください。 40 | {0} is the name of an event. 41 | 42 | 43 | ターゲット {0} は、VisualStateGroups を一切定義していません。 44 | {0} is an element name and could be an empty string. 45 | 46 | 47 | 型 {0} の Binding プロパティは、演算子 {1} と共に使用できません。 48 | {0} is the type of the DataTriggerBehavior.Binding property specified by the user. {1} is one of the ComparisonConditionType enum values. 49 | 50 | 51 | 型 {0} の Binding プロパティと型 {1} の Value プロパティは、演算子 {2} と共に使用できません。 52 | {0} is the type of the DataTriggerBehavior.Binding property specified by the user. {1} is the type of the DataTriggerBehavior.Value property specified by the user. {2} is one of the ComparisonConditionType enum values. 53 | 54 | 55 | 型 {0} の Value プロパティは、演算子 {1} と共に使用できません。 56 | {1} is the type of the DataTriggerBehavior.Value property specified by the user. {1} is one of the ComparisonConditionType enum values. 57 | 58 | 59 | ビヘイビアーのインスタンスを BehaviorCollection に複数回追加することはできません。 60 | 61 | 62 | ActionCollection では IAction 型のみサポートされます。 63 | 64 | 65 | BehaviorCollection では IBehavior 型のみサポートされます。 66 | 67 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Windows.ApplicationModel; 3 | using Windows.ApplicationModel.Activation; 4 | using Windows.Foundation.Metadata; 5 | using Windows.UI.Xaml; 6 | using Windows.UI.Xaml.Controls; 7 | using Windows.UI.Xaml.Navigation; 8 | 9 | namespace XAMLBehaviorsSample; 10 | 11 | /// 12 | /// Provides application-specific behavior to supplement the default Application class. 13 | /// 14 | sealed partial class App : Application 15 | { 16 | /// 17 | /// Initializes the singleton application object. This is the first line of authored code 18 | /// executed, and as such is the logical equivalent of main() or WinMain(). 19 | /// 20 | public App() 21 | { 22 | this.InitializeComponent(); 23 | this.Suspending += OnSuspending; 24 | } 25 | 26 | /// 27 | /// Invoked when the application is launched normally by the end user. Other entry points 28 | /// will be used such as when the application is launched to open a specific file. 29 | /// 30 | /// Details about the launch request and process. 31 | protected override void OnLaunched(LaunchActivatedEventArgs e) 32 | { 33 | 34 | #if DEBUG 35 | if (System.Diagnostics.Debugger.IsAttached) 36 | { 37 | this.DebugSettings.EnableFrameRateCounter = true; 38 | } 39 | #endif 40 | 41 | Frame rootFrame = Window.Current.Content as Frame; 42 | 43 | // Do not repeat app initialization when the Window already has content, 44 | // just ensure that the window is active 45 | if (rootFrame == null) 46 | { 47 | // Create a Frame to act as the navigation context and navigate to the first page 48 | rootFrame = new Frame(); 49 | 50 | rootFrame.NavigationFailed += OnNavigationFailed; 51 | 52 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) 53 | { 54 | //TODO: Load state from previously suspended application 55 | } 56 | 57 | // Place the frame in the current Window 58 | Window.Current.Content = rootFrame; 59 | } 60 | 61 | if (rootFrame.Content == null) 62 | { 63 | // When the navigation stack isn't restored navigate to the first page, 64 | // configuring the new page by passing required information as a navigation 65 | // parameter 66 | 67 | //if (DetectMobile()) 68 | //{ 69 | // rootFrame.Navigate(typeof(MainPage_Mobile), e.Arguments); 70 | //} 71 | //else 72 | //{ 73 | rootFrame.Navigate(typeof(MainPage), e.Arguments); 74 | // } 75 | } 76 | // Ensure the current window is active 77 | Window.Current.Activate(); 78 | } 79 | 80 | /// 81 | /// Invoked when Navigation to a certain page fails 82 | /// 83 | /// The Frame which failed navigation 84 | /// Details about the navigation failure 85 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e) 86 | { 87 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName); 88 | } 89 | 90 | /// 91 | /// Invoked when application execution is being suspended. Application state is saved 92 | /// without knowing whether the application will be terminated or resumed with the contents 93 | /// of memory still intact. 94 | /// 95 | /// The source of the suspend request. 96 | /// Details about the suspend request. 97 | private void OnSuspending(object sender, SuspendingEventArgs e) 98 | { 99 | var deferral = e.SuspendingOperation.GetDeferral(); 100 | //TODO: Save application state and stop any background activity 101 | deferral.Complete(); 102 | } 103 | 104 | private bool DetectMobile() 105 | { 106 | bool isHardwareButtonsAPIPresent = 107 | ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"); 108 | 109 | if (isHardwareButtonsAPIPresent) 110 | { 111 | return true; 112 | } 113 | else 114 | { 115 | return false; 116 | } 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | *.exe 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | build/ 23 | bld/ 24 | [Bb]in/ 25 | [Oo]bj/ 26 | out/ 27 | 28 | # Visual Studio 2015 cache/options directory 29 | .vs/ 30 | 31 | # MSTest test Results 32 | [Tt]est[Rr]esult*/ 33 | [Bb]uild[Ll]og.* 34 | 35 | # NUNIT 36 | *.VisualState.xml 37 | TestResult.xml 38 | 39 | # Build Results of an ATL Project 40 | [Dd]ebugPS/ 41 | [Rr]eleasePS/ 42 | dlldata.c 43 | 44 | # DNX 45 | project.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | 84 | # Visual Studio profiler 85 | *.psess 86 | *.vsp 87 | *.vspx 88 | 89 | # TFS 2012 Local Workspace 90 | $tf/ 91 | 92 | # Guidance Automation Toolkit 93 | *.gpState 94 | 95 | # ReSharper is a .NET coding add-in 96 | _ReSharper*/ 97 | *.[Rr]e[Ss]harper 98 | *.DotSettings.user 99 | 100 | # JustCode is a .NET coding add-in 101 | .JustCode 102 | 103 | # TeamCity is a build add-in 104 | _TeamCity* 105 | 106 | # DotCover is a Code Coverage Tool 107 | *.dotCover 108 | 109 | # NCrunch 110 | _NCrunch_* 111 | .*crunch*.local.xml 112 | 113 | # MightyMoose 114 | *.mm.* 115 | AutoTest.Net/ 116 | 117 | # Web workbench (sass) 118 | .sass-cache/ 119 | 120 | # Installshield output folder 121 | [Ee]xpress/ 122 | 123 | # DocProject is a documentation generator add-in 124 | DocProject/buildhelp/ 125 | DocProject/Help/*.HxT 126 | DocProject/Help/*.HxC 127 | DocProject/Help/*.hhc 128 | DocProject/Help/*.hhk 129 | DocProject/Help/*.hhp 130 | DocProject/Help/Html2 131 | DocProject/Help/html 132 | 133 | # Click-Once directory 134 | publish/ 135 | 136 | # Publish Web Output 137 | *.[Pp]ublish.xml 138 | *.azurePubxml 139 | ## TODO: Comment the next line if you want to checkin your 140 | ## web deploy settings but do note that will include unencrypted 141 | ## passwords 142 | #*.pubxml 143 | 144 | *.publishproj 145 | 146 | # NuGet Packages 147 | *.nupkg 148 | # The packages folder can be ignored because of Package Restore 149 | **/packages/* 150 | # except build/, which is used as an MSBuild target. 151 | !**/packages/build/ 152 | # Uncomment if necessary however generally it will be regenerated when needed 153 | #!**/packages/repositories.config 154 | # NuGet v3's project.json files produces more ignorable files 155 | *.nuget.props 156 | *.nuget.targets 157 | 158 | # Windows Azure Build Output 159 | csx/ 160 | *.build.csdef 161 | 162 | # Windows Store app package directory 163 | AppPackages/ 164 | 165 | # Visual Studio cache files 166 | # files ending in .cache can be ignored 167 | *.[Cc]ache 168 | # but keep track of directories ending in .cache 169 | !*.[Cc]ache/ 170 | 171 | # Others 172 | ClientBin/ 173 | [Ss]tyle[Cc]op.* 174 | ~$* 175 | *~ 176 | *.dbmdl 177 | *.dbproj.schemaview 178 | *.pfx 179 | *.publishsettings 180 | node_modules/ 181 | orleans.codegen.cs 182 | 183 | # RIA/Silverlight projects 184 | Generated_Code/ 185 | 186 | # Backup & report files from converting an old project file 187 | # to a newer Visual Studio version. Backup files are not needed, 188 | # because we have git ;-) 189 | _UpgradeReport_Files/ 190 | Backup*/ 191 | UpgradeLog*.XML 192 | UpgradeLog*.htm 193 | 194 | # SQL Server files 195 | *.mdf 196 | *.ldf 197 | 198 | # Business Intelligence projects 199 | *.rdl.data 200 | *.bim.layout 201 | *.bim_*.settings 202 | 203 | # Microsoft Fakes 204 | FakesAssemblies/ 205 | 206 | # Node.js Tools for Visual Studio 207 | .ntvs_analysis.dat 208 | 209 | # Visual Studio 6 build log 210 | *.plg 211 | 212 | # Visual Studio 6 workspace options file 213 | *.opt 214 | 215 | # LightSwitch generated files 216 | GeneratedArtifacts/ 217 | _Pvt_Extensions/ 218 | ModelManifest.xml 219 | **/MigrationBackup 220 | /src/BehaviorsSDKManaged/NuGet.config 221 | 222 | # VS Generated files 223 | /**/Generated Files -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.12.35506.116 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XAMLBehaviorsSample", "XAMLBehaviorsSample\XAMLBehaviorsSample.csproj", "{050C4B73-9A9F-469B-9FA7-FB481894391F}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Xaml.Interactivity", "..\..\src\BehaviorsSDKManaged\Microsoft.Xaml.Interactivity\Microsoft.Xaml.Interactivity.csproj", "{A338A7F2-9010-477B-8A6E-6C2B2495C33C}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Debug|ARM = Debug|ARM 14 | Debug|x64 = Debug|x64 15 | Debug|x86 = Debug|x86 16 | Release|Any CPU = Release|Any CPU 17 | Release|ARM = Release|ARM 18 | Release|x64 = Release|x64 19 | Release|x86 = Release|x86 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Debug|Any CPU.ActiveCfg = Debug|x86 23 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Debug|Any CPU.Build.0 = Debug|x86 24 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Debug|Any CPU.Deploy.0 = Debug|x86 25 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Debug|ARM.ActiveCfg = Debug|ARM 26 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Debug|ARM.Build.0 = Debug|ARM 27 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Debug|ARM.Deploy.0 = Debug|ARM 28 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Debug|x64.ActiveCfg = Debug|x64 29 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Debug|x64.Build.0 = Debug|x64 30 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Debug|x64.Deploy.0 = Debug|x64 31 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Debug|x86.ActiveCfg = Debug|x86 32 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Debug|x86.Build.0 = Debug|x86 33 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Debug|x86.Deploy.0 = Debug|x86 34 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Release|Any CPU.ActiveCfg = Release|x86 35 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Release|Any CPU.Build.0 = Release|x86 36 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Release|Any CPU.Deploy.0 = Release|x86 37 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Release|ARM.ActiveCfg = Release|ARM 38 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Release|ARM.Build.0 = Release|ARM 39 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Release|ARM.Deploy.0 = Release|ARM 40 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Release|x64.ActiveCfg = Release|x64 41 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Release|x64.Build.0 = Release|x64 42 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Release|x64.Deploy.0 = Release|x64 43 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Release|x86.ActiveCfg = Release|x86 44 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Release|x86.Build.0 = Release|x86 45 | {050C4B73-9A9F-469B-9FA7-FB481894391F}.Release|x86.Deploy.0 = Release|x86 46 | {A338A7F2-9010-477B-8A6E-6C2B2495C33C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 47 | {A338A7F2-9010-477B-8A6E-6C2B2495C33C}.Debug|Any CPU.Build.0 = Debug|Any CPU 48 | {A338A7F2-9010-477B-8A6E-6C2B2495C33C}.Debug|ARM.ActiveCfg = Debug|ARM 49 | {A338A7F2-9010-477B-8A6E-6C2B2495C33C}.Debug|ARM.Build.0 = Debug|ARM 50 | {A338A7F2-9010-477B-8A6E-6C2B2495C33C}.Debug|x64.ActiveCfg = Debug|x64 51 | {A338A7F2-9010-477B-8A6E-6C2B2495C33C}.Debug|x64.Build.0 = Debug|x64 52 | {A338A7F2-9010-477B-8A6E-6C2B2495C33C}.Debug|x86.ActiveCfg = Debug|x86 53 | {A338A7F2-9010-477B-8A6E-6C2B2495C33C}.Debug|x86.Build.0 = Debug|x86 54 | {A338A7F2-9010-477B-8A6E-6C2B2495C33C}.Release|Any CPU.ActiveCfg = Release|Any CPU 55 | {A338A7F2-9010-477B-8A6E-6C2B2495C33C}.Release|Any CPU.Build.0 = Release|Any CPU 56 | {A338A7F2-9010-477B-8A6E-6C2B2495C33C}.Release|ARM.ActiveCfg = Release|ARM 57 | {A338A7F2-9010-477B-8A6E-6C2B2495C33C}.Release|ARM.Build.0 = Release|ARM 58 | {A338A7F2-9010-477B-8A6E-6C2B2495C33C}.Release|x64.ActiveCfg = Release|x64 59 | {A338A7F2-9010-477B-8A6E-6C2B2495C33C}.Release|x64.Build.0 = Release|x64 60 | {A338A7F2-9010-477B-8A6E-6C2B2495C33C}.Release|x86.ActiveCfg = Release|x86 61 | {A338A7F2-9010-477B-8A6E-6C2B2495C33C}.Release|x86.Build.0 = Release|x86 62 | EndGlobalSection 63 | GlobalSection(SolutionProperties) = preSolution 64 | HideSolutionNode = FALSE 65 | EndGlobalSection 66 | GlobalSection(ExtensibilityGlobals) = postSolution 67 | SolutionGuid = {BAEA616E-866E-41F8-B6B8-ED0114DDB811} 68 | EndGlobalSection 69 | GlobalSection(SharedMSBuildProjectFiles) = preSolution 70 | ..\..\src\BehaviorsSDKManaged\Microsoft.Xaml.Interactivity.Shared\Microsoft.Xaml.Interactivity.Shared.projitems*{a338a7f2-9010-477b-8a6e-6c2b2495c33c}*SharedItemsImports = 4 71 | EndGlobalSection 72 | EndGlobal 73 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/IncrementalUpdateControl.xaml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | IncrementalUpdateBehavior attaches to the DataTemplate inside ListViewBase controls (i.e. ListView and GridView). 51 | It enables deferred rendering for specified elements in the ItemTemplate used by the view. 52 | In the sample, declaring elements in the GridView in certain phases defers updates until there is render time available, resulting in a smoother expeirence. 53 | 54 | 55 | 56 | <DataTemplate x:Key="GridViewItem"> 57 | <StackPanel> 58 | <Rectangle> 59 | <Interactivity:Interaction.Behaviors> 60 | <Interactivity:IncrementalUpdateBehavior Phase="2"/> 61 | </Interactivity:Interaction.Behaviors> 62 | </Rectangle> 63 | <TextBlock Text="{Binding Count}"> 64 | <Interactivity:Interaction.Behaviors> 65 | <Interactivity:IncrementalUpdateBehavior Phase="1"/> 66 | </Interactivity:Interaction.Behaviors> 67 | </TextBlock> 68 | </StackPanel> 69 | </DataTemplate> 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity/Resources/uk-UA/Strings.resw: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | text/microsoft-resx 5 | 6 | 7 | 2.0 8 | 9 | 10 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 11 | 12 | 13 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 14 | 15 | 16 | Неможливо знайти метод з ім'ям {0} в об'єкті типу {1}, який відповідав би очікуваному підпису. 17 | {0} is the name of the method that could not be found. {1} is the name of the type that was searched for the method. 18 | 19 | 20 | Неможливо прикріпити екземпляр поведінки до декількох об'єктів одночасно. 21 | 22 | 23 | Неможливо знайти подію з ім'ям {0} в типі {1}. 24 | {0} is the EventName property value specified by the user. {1} is the Type we are trying to find an event on. 25 | 26 | 27 | Неможливо знайти властивість з ім'ям {0} в типі {1}. 28 | {0} is the PropertyName property value specified by the user. {1} is the Type we are trying to find a property on. 29 | 30 | 31 | Неможливо призначити значення типу {0} властивості {1} типу {2}. Властивості {1} можна призначити тільки значення типу {2}. 32 | {0} is the type name of the illegal value, or "null" if value is null. {1} is the name of the property. {2} is the type of the property. 33 | 34 | 35 | Властивість {0}, яке визначається типом {1}, не надає заданий метод і, отже, не може бути змінено. 36 | {0} is the name of the property. {1} is the name of the type that defines the property. 37 | 38 | 39 | Подія {0} не підтримується. Для відгуку на дану подію рекомендується реалізувати користувальницьку поведінку IBehavior. 40 | {0} is the name of an event. 41 | 42 | 43 | Цільовий об'єкт {0} не визначає ніяких груп VisualStateGroups. 44 | {0} is an element name and could be an empty string. 45 | 46 | 47 | Властивість прив'язки типу {0} неможливо використовувати з оператором {1}. 48 | {0} is the type of the DataTriggerBehavior.Binding property specified by the user. {1} is one of the ComparisonConditionType enum values. 49 | 50 | 51 | Властивість прив'язки типу {0} і властивість значення типу {1} неможливо використовувати з оператором {2}. 52 | {0} is the type of the DataTriggerBehavior.Binding property specified by the user. {1} is the type of the DataTriggerBehavior.Value property specified by the user. {2} is one of the ComparisonConditionType enum values. 53 | 54 | 55 | Властивість значення типу {0} неможливо використовувати з оператором {1}. 56 | {1} is the type of the DataTriggerBehavior.Value property specified by the user. {1} is one of the ComparisonConditionType enum values. 57 | 58 | 59 | Неможливо додати екземпляр поведінки в колекцію BehaviorCollection більше одного разу. 60 | 61 | 62 | В колекції ActionCollection підтримуються тільки типи Action. 63 | 64 | 65 | В колекції BehaviorCollection підтримуються тільки типи Behavior. 66 | 67 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity/Resources/ru-RU/Strings.resw: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | text/microsoft-resx 5 | 6 | 7 | 2.0 8 | 9 | 10 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 11 | 12 | 13 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 14 | 15 | 16 | Невозможно найти метод с именем {0} в объекте типа {1}, который соответствовал бы ожидаемой подписи. 17 | {0} is the name of the method that could not be found. {1} is the name of the type that was searched for the method. 18 | 19 | 20 | Невозможно прикрепить экземпляр поведения к нескольким объектам одновременно. 21 | 22 | 23 | Невозможно найти событие с именем {0} в типе {1}. 24 | {0} is the EventName property value specified by the user. {1} is the Type we are trying to find an event on. 25 | 26 | 27 | Невозможно найти свойство с именем {0} в типе {1}. 28 | {0} is the PropertyName property value specified by the user. {1} is the Type we are trying to find a property on. 29 | 30 | 31 | Невозможно назначить значение типа {0} свойству {1} типа {2}. Свойству {1} можно назначить только значения типа {2}. 32 | {0} is the type name of the illegal value, or "null" if value is null. {1} is the name of the property. {2} is the type of the property. 33 | 34 | 35 | Свойство {0}, определяемое типом {1}, не предоставляет заданный метод и, следовательно, не может быть изменено. 36 | {0} is the name of the property. {1} is the name of the type that defines the property. 37 | 38 | 39 | Событие {0} не поддерживается. Для отклика на данное событие рекомендуется реализовать пользовательское поведение IBehavior. 40 | {0} is the name of an event. 41 | 42 | 43 | Целевой объект {0} не определяет никаких групп VisualStateGroups. 44 | {0} is an element name and could be an empty string. 45 | 46 | 47 | Свойство привязки типа {0} невозможно использовать с оператором {1}. 48 | {0} is the type of the DataTriggerBehavior.Binding property specified by the user. {1} is one of the ComparisonConditionType enum values. 49 | 50 | 51 | Свойство привязки типа {0} и свойство значения типа {1} невозможно использовать с оператором {2}. 52 | {0} is the type of the DataTriggerBehavior.Binding property specified by the user. {1} is the type of the DataTriggerBehavior.Value property specified by the user. {2} is one of the ComparisonConditionType enum values. 53 | 54 | 55 | Свойство значения типа {0} невозможно использовать с оператором {1}. 56 | {1} is the type of the DataTriggerBehavior.Value property specified by the user. {1} is one of the ComparisonConditionType enum values. 57 | 58 | 59 | Невозможно добавить экземпляр поведения в коллекцию BehaviorCollection более одного раза. 60 | 61 | 62 | В коллекции ActionCollection поддерживаются только типы IAction. 63 | 64 | 65 | В коллекции BehaviorCollection поддерживаются только типы IBehavior. 66 | 67 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity/Resources/it-IT/Strings.resw: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | text/microsoft-resx 5 | 6 | 7 | 2.0 8 | 9 | 10 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 11 | 12 | 13 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 14 | 15 | 16 | Impossibile trovare il metodo denominato {0} in un oggetto di tipo {1} corrispondente alla firma prevista. 17 | {0} is the name of the method that could not be found. {1} is the name of the type that was searched for the method. 18 | 19 | 20 | Impossibile associare l'istanza di un comportamento a più di un oggetto alla volta. 21 | 22 | 23 | Impossibile trovare un evento denominato {0} nel tipo {1}. 24 | {0} is the EventName property value specified by the user. {1} is the Type we are trying to find an event on. 25 | 26 | 27 | Impossibile trovare una proprietà denominata {0} nel tipo {1}. 28 | {0} is the PropertyName property value specified by the user. {1} is the Type we are trying to find a property on. 29 | 30 | 31 | Impossibile assegnare un valore di tipo {0} alla proprietà {1} di tipo {2}. Alla proprietà {1} possono essere assegnati solo valori di tipo {2}. 32 | {0} is the type name of the illegal value, or "null" if value is null. {1} is the name of the property. {2} is the type of the property. 33 | 34 | 35 | La proprietà {0} definita dal tipo {1} non espone un metodo set. Impossibile modificarla. 36 | {0} is the name of the property. {1} is the name of the type that defines the property. 37 | 38 | 39 | L'evento {0} non è supportato. Implementare un elemento IBehavior personalizzato per rispondere a questo evento. 40 | {0} is the name of an event. 41 | 42 | 43 | La destinazione {0} non definisce VisualStateGroups. 44 | {0} is an element name and could be an empty string. 45 | 46 | 47 | Impossibile utilizzare la proprietà Binding di tipo {0} con l'operatore {1}. 48 | {0} is the type of the DataTriggerBehavior.Binding property specified by the user. {1} is one of the ComparisonConditionType enum values. 49 | 50 | 51 | Impossibile utilizzare la proprietà Binding di tipo {0} e la proprietà Value di tipo {1} con l'operatore {2}. 52 | {0} is the type of the DataTriggerBehavior.Binding property specified by the user. {1} is the type of the DataTriggerBehavior.Value property specified by the user. {2} is one of the ComparisonConditionType enum values. 53 | 54 | 55 | Impossibile utilizzare la proprietà Value di tipo {0} con l'operatore {1}. 56 | {1} is the type of the DataTriggerBehavior.Value property specified by the user. {1} is one of the ComparisonConditionType enum values. 57 | 58 | 59 | Impossibile aggiungere l'istanza di un comportamento a BehaviorCollection più di una volta. 60 | 61 | 62 | Solo i tipi IAction sono supportati in ActionCollection. 63 | 64 | 65 | Solo i tipi IBehavior sono supportati in BehaviorCollection. 66 | 67 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity/Resources/es-ES/Strings.resw: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | text/microsoft-resx 5 | 6 | 7 | 2.0 8 | 9 | 10 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 11 | 12 | 13 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 14 | 15 | 16 | No se puede encontrar el método denominado {0} en el objeto de tipo {1} que coincida con la signatura esperada. 17 | {0} is the name of the method that could not be found. {1} is the name of the type that was searched for the method. 18 | 19 | 20 | No se puede adjuntar una instancia de Behavior a más de un objeto simultáneamente. 21 | 22 | 23 | No se puede encontrar un evento con el nombre {0} en el tipo {1}. 24 | {0} is the EventName property value specified by the user. {1} is the Type we are trying to find an event on. 25 | 26 | 27 | No se puede encontrar una propiedad con el nombre {0} en el tipo {1}. 28 | {0} is the PropertyName property value specified by the user. {1} is the Type we are trying to find a property on. 29 | 30 | 31 | No se puede asignar un valor del tipo {0} a la propiedad {1} del tipo {2}. A la propiedad {1} solo se le pueden asignar valores del tipo {2}. 32 | {0} is the type name of the illegal value, or "null" if value is null. {1} is the name of the property. {2} is the type of the property. 33 | 34 | 35 | La propiedad {0} definida por el tipo {1} no expone un método establecido y, por lo tanto, no se puede modificar. 36 | {0} is the name of the property. {1} is the name of the type that defines the property. 37 | 38 | 39 | No se admite el evento {0}. Considere implementar un IBehavior personalizado para responder a este evento. 40 | {0} is the name of an event. 41 | 42 | 43 | El destino {0} no define ningún objeto VisualStateGroup. 44 | {0} is an element name and could be an empty string. 45 | 46 | 47 | La propiedad Binding del tipo {0} no se puede usar con el operador {1}. 48 | {0} is the type of the DataTriggerBehavior.Binding property specified by the user. {1} is one of the ComparisonConditionType enum values. 49 | 50 | 51 | La propiedad Binding del tipo {0} y la propiedad Value del tipo {1} no se pueden usar con el operador {2}. 52 | {0} is the type of the DataTriggerBehavior.Binding property specified by the user. {1} is the type of the DataTriggerBehavior.Value property specified by the user. {2} is one of the ComparisonConditionType enum values. 53 | 54 | 55 | La propiedad Value del tipo {0} no se puede usar con el operador {1}. 56 | {1} is the type of the DataTriggerBehavior.Value property specified by the user. {1} is one of the ComparisonConditionType enum values. 57 | 58 | 59 | No se puede agregar una instancia de Behavior a un BehaviorCollection más de una vez. 60 | 61 | 62 | Solo se admiten tipos IAction en ActionCollection. 63 | 64 | 65 | Solo se admiten tipos IBehavior en BehaviorCollection. 66 | 67 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity/Resources/pt-BR/Strings.resw: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | text/microsoft-resx 5 | 6 | 7 | 2.0 8 | 9 | 10 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 11 | 12 | 13 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 14 | 15 | 16 | Não é possível encontrar o método de nome {0} no objeto de tipo {1} que corresponda a assinatura esperada. 17 | {0} is the name of the method that could not be found. {1} is the name of the type that was searched for the method. 18 | 19 | 20 | Não é possível anexar uma instância de Behavior a mais de um objeto simultaneamente. 21 | 22 | 23 | Não é possível encontrar um evento de nome {0} no tipo {1}. 24 | {0} is the EventName property value specified by the user. {1} is the Type we are trying to find an event on. 25 | 26 | 27 | Não é possível encontrar uma propriedade de nome {0} no tipo {1}. 28 | {0} is the PropertyName property value specified by the user. {1} is the Type we are trying to find a property on. 29 | 30 | 31 | Nao é possível atribuir um valor do tipo {0} à propriedade {1} de tipo {2}. A propriedade {1} pode receber somente valores do tipo {2}. 32 | {0} is the type name of the illegal value, or "null" if value is null. {1} is the name of the property. {2} is the type of the property. 33 | 34 | 35 | A propriedade {0} definido pelo tipo {1} não expõe um método set e, portanto, não pode ser modificado. 36 | {0} is the name of the property. {1} is the name of the type that defines the property. 37 | 38 | 39 | Evento {0} não é suportado. Considere a implementação de um IBehavior personalizado para responder a este evento. 40 | {0} is the name of an event. 41 | 42 | 43 | O destino {0} não define qualquer VisualStateGroups. 44 | {0} is an element name and could be an empty string. 45 | 46 | 47 | A propriedade Binding do tipo {0} não pode ser usada com o operador {2}. 48 | {0} is the type of the DataTriggerBehavior.Binding property specified by the user. {1} is one of the ComparisonConditionType enum values. 49 | 50 | 51 | A propriedade Binding do tipo {0} e a propriedade Value do tipo {1} não podem ser usadas com o operador {2}. 52 | {0} is the type of the DataTriggerBehavior.Binding property specified by the user. {1} is the type of the DataTriggerBehavior.Value property specified by the user. {2} is one of the ComparisonConditionType enum values. 53 | 54 | 55 | A propriedade de valor do tipo {0} não pode ser usada com o operador {1}. 56 | {1} is the type of the DataTriggerBehavior.Value property specified by the user. {1} is one of the ComparisonConditionType enum values. 57 | 58 | 59 | Não é possível adicionar uma instância de um behavior à um BehaviorCollection mais de uma vez. 60 | 61 | 62 | Somente tipos de IAction são suportados em um ActionCollection. 63 | 64 | 65 | Somente tipos de IBehavior são suportados em um BehaviorCollection. 66 | 67 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/ControlStoryboardControl.xaml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 18 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | ControlStoryboardAction represents an action that will change the state of the specified Storyboard when executed. 45 | In this example, clicking the button triggers the ControlStoryboardAction to toggle playing and pausing a storyboard that changes the size of the rectangle. 46 | 47 | 48 | 49 | <Button x:Name="button"> 50 | <Interactivity:Interaction.Behaviors> 51 | <Interactivity:EventTriggerBehavior EventName="Click"> 52 | <Interactivity:ControlStoryboardAction Storyboard="{StaticResource StoryboardSample}" ControlStoryboardOption="TogglePlayPause"/> 53 | </Interactions:EventTriggerBehavior> 54 | </Interactivity:Interaction.Behaviors> 55 | </Button> 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity/Resources/fr-FR/Strings.resw: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | text/microsoft-resx 5 | 6 | 7 | 2.0 8 | 9 | 10 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 11 | 12 | 13 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 14 | 15 | 16 | Impossible de trouver la méthode nommée {0} sur l'objet de type {1} qui correspond à la signature attendue. 17 | {0} is the name of the method that could not be found. {1} is the name of the type that was searched for the method. 18 | 19 | 20 | Une instance de Behavior ne peut pas être attachée à plus d'un objet à la fois. 21 | 22 | 23 | Impossible de trouver un événement nommé {0} sur le type {1}. 24 | {0} is the EventName property value specified by the user. {1} is the Type we are trying to find an event on. 25 | 26 | 27 | Impossible de trouver une propriété nommée {0} sur le type {1}. 28 | {0} is the PropertyName property value specified by the user. {1} is the Type we are trying to find a property on. 29 | 30 | 31 | Impossible d'attribuer une valeur de type {0} à la propriété {1} de type {2}. Seules des valeurs de type {2} peuvent être attribuées à la propriété {1}. 32 | {0} is the type name of the illegal value, or "null" if value is null. {1} is the name of the property. {2} is the type of the property. 33 | 34 | 35 | La propriété {0} définie par le type {1} n'expose pas une méthode set et ne peut, par conséquent, pas être modifiée. 36 | {0} is the name of the property. {1} is the name of the type that defines the property. 37 | 38 | 39 | L'événement {0} n'est pas pris en charge. Si possible, implémentez un type iBehavior personnalisé pour répondre à cet événement. 40 | {0} is the name of an event. 41 | 42 | 43 | La cible {0} ne définit pas de VisualStateGroups. 44 | {0} is an element name and could be an empty string. 45 | 46 | 47 | La propriété de liaison de type {0} ne peut pas être utilisée avec l'opérateur {1}. 48 | {0} is the type of the DataTriggerBehavior.Binding property specified by the user. {1} is one of the ComparisonConditionType enum values. 49 | 50 | 51 | La propriété de liaison de {0} la propriété de valeur de type {1} ne peuvent pas être utilisées avec l'opérateur {2}. 52 | {0} is the type of the DataTriggerBehavior.Binding property specified by the user. {1} is the type of the DataTriggerBehavior.Value property specified by the user. {2} is one of the ComparisonConditionType enum values. 53 | 54 | 55 | La propriété de valeur de type {0} ne peut pas être utilisée avec l'opérateur {1}. 56 | {1} is the type of the DataTriggerBehavior.Value property specified by the user. {1} is one of the ComparisonConditionType enum values. 57 | 58 | 59 | Impossible d'ajouter à plusieurs reprises une instance de Behavior à une BehaviorCollection. 60 | 61 | 62 | Seuls les types IAction sont pris en charge dans une ActionCollection. 63 | 64 | 65 | Seuls les types IBehavior sont pris en charge dans une BehaviorCollection. 66 | 67 | -------------------------------------------------------------------------------- /src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity/Resources/de-DE/Strings.resw: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | text/microsoft-resx 5 | 6 | 7 | 2.0 8 | 9 | 10 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 11 | 12 | 13 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 14 | 15 | 16 | Keine Methode mit der Bezeichnung {0} im Objekt vom Typ {1} gefunden, die mit der erwarteten Signatur übereinstimmt. 17 | {0} is the name of the method that could not be found. {1} is the name of the type that was searched for the method. 18 | 19 | 20 | Eine Instanz eines Verhaltens kann nicht mehreren Objekten gleichzeitig angefügt werden. 21 | 22 | 23 | Kein Ereignis mit der Bezeichnung {0} auf Typ {1} gefunden. 24 | {0} is the EventName property value specified by the user. {1} is the Type we are trying to find an event on. 25 | 26 | 27 | Keine Eigenschaft mit der Bezeichnung {0} auf Typ {1} gefunden. 28 | {0} is the PropertyName property value specified by the user. {1} is the Type we are trying to find a property on. 29 | 30 | 31 | Kann keinen Wert vom Typ {0} zu einer Eigenschaft {1} vom Typ {2} zuweisen. Die Eigenschaft {1} kann nur Werten vom Typ {2} zugewiesen werden. 32 | {0} is the type name of the illegal value, or "null" if value is null. {1} is the name of the property. {2} is the type of the property. 33 | 34 | 35 | Die vom Typ {1} definierte Eigenschaft {0} gibt keine Methode zum Festlegen an und kann daher nicht geändert werden. 36 | {0} is the name of the property. {1} is the name of the type that defines the property. 37 | 38 | 39 | Ereignis {0} ist nicht unterstützt. Erwägen Sie die Implementierung eines benutzerdefinierten IBehavior, um auf dieses Ereignis zu reagieren. 40 | {0} is the name of an event. 41 | 42 | 43 | Das Ziel {0} definiert keine VisualStateGroups. 44 | {0} is an element name and could be an empty string. 45 | 46 | 47 | Die Bindungseigenschaft vom Typ {0} kann nicht mit dem Operator {1} verwendet werden. 48 | {0} is the type of the DataTriggerBehavior.Binding property specified by the user. {1} is one of the ComparisonConditionType enum values. 49 | 50 | 51 | Die Bindungseigenschaft vom Typ {0} und die Werteigenschaft vom Typ {1} können nicht mit dem Operator {2} verwendet werden. 52 | {0} is the type of the DataTriggerBehavior.Binding property specified by the user. {1} is the type of the DataTriggerBehavior.Value property specified by the user. {2} is one of the ComparisonConditionType enum values. 53 | 54 | 55 | Die Werteigenschaft vom Typ {0} kann nicht mit dem Operator {1} verwendet werden. 56 | {1} is the type of the DataTriggerBehavior.Value property specified by the user. {1} is one of the ComparisonConditionType enum values. 57 | 58 | 59 | Eine Instanz eines Verhaltens kann einer BehaviorCollection höchstens einmal hinzugefügt werden. 60 | 61 | 62 | Nur IAction-Typen werden in einer ActionCollection unterstützt. 63 | 64 | 65 | Nur IBehavior-Typen werden in einer BehaviorCollection unterstützt. 66 | 67 | -------------------------------------------------------------------------------- /samples/CS/XAMLBehaviorsSample/DataTriggerControl.xaml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | DataTriggerBehavior performs an action when the data the behaviors is bound to meets a specified condition. 34 | In this example, when the bound data of the slider's value reaches above 50, the behavior triggers an action to change the color of the rectangle. 35 | 36 | 37 | 38 | <Rectangle x:Name="DataTriggerRectangle"> 39 | <Interactivity:Interaction.Behaviors> 40 | <Interactivity:DataTriggerBehavior Binding="{Binding Value, ElementName=slider}" ComparisonCondition="GreaterThan" Value="50"> 41 | <Interactivity:ChangePropertyAction TargetObject="{Binding ElementName=DataTriggerRectangle}" PropertyName="Fill" Value="{StaticResource PaleYellowBrush}"/> 42 | </Interactions:DataTriggerBehavior> 43 | <Interactivity:DataTriggerBehavior Binding="{Binding Value, ElementName=slider}" ComparisonCondition="LessThanOrEqual" Value="50"> 44 | <Interactivity:ChangePropertyAction TargetObject="{Binding ElementName=DataTriggerRectangle}" PropertyName="Fill" Value="{StaticResource RoyalBlueBrush}"/> 45 | </Interactions:DataTriggerBehavior> 46 | </Interactivity:Interaction.Behaviors> 47 | </Rectangle> 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | --------------------------------------------------------------------------------