From 2f01f850b24d91ff4a3353f0fb63a5522c2f54c7 Mon Sep 17 00:00:00 2001 From: Michael Hawker <24302614+michael-hawker@users.noreply.github.com> Date: Mon, 18 Nov 2024 17:39:07 -0800 Subject: [PATCH 1/6] Building samples solution in GitHub CI for validation --- .github/workflows/managed-build.yml | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/managed-build.yml b/.github/workflows/managed-build.yml index 21ede67..f30536e 100644 --- a/.github/workflows/managed-build.yml +++ b/.github/workflows/managed-build.yml @@ -38,3 +38,35 @@ jobs: name: msbuild_binlog_Release_x64 path: msbuild.binlog if-no-files-found: error + + samples-build: + runs-on: windows-latest + steps: + - name: Checkout XamlBehaviors.git + uses: actions/checkout@v4 + + - name: Install the .NET 9.0.100 SDK + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 9.0.100 + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v2 + + - name: Setup/Install NuGet 6.11.0 + uses: nuget/setup-nuget@v2 + with: + nuget-version: '6.11.0' + + - name: NuGet Restore BehaviorsSDKManaged.sln + run: nuget restore samples\CS\XAMLBehaviorsSample.sln + + - name: Build BehaviorsSDKManaged.sln + run: msbuild samples\CS\XAMLBehaviorsSample.sln /p:Configuration=Release -v:diag /bl + + - name: Upload MSBuild binary log + uses: actions/upload-artifact@v4 + with: + name: msbuild_samples_binlog_Release_x64 + path: msbuild.binlog + if-no-files-found: error From b53f37e8418dcaa2c11761cd7849ed54880d7bd6 Mon Sep 17 00:00:00 2001 From: Michael Hawker <24302614+michael-hawker@users.noreply.github.com> Date: Tue, 19 Nov 2024 17:22:06 -0800 Subject: [PATCH 2/6] Remove mobile pages, fix solution reference/deployment --- samples/CS/XAMLBehaviorsSample.sln | 35 +- ...CallMethodControl.DeviceFamily-Mobile.xaml | 68 ---- ...gePropertyControl.DeviceFamily-Mobile.xaml | 80 ---- ...StoryboardControl.DeviceFamily-Mobile.xaml | 82 ----- ...stomActionControl.DeviceFamily-Mobile.xaml | 64 ---- ...omBehaviorControl.DeviceFamily-Mobile.xaml | 61 ---- ...ataTriggerControl.DeviceFamily-Mobile.xaml | 73 ---- ...entTriggerControl.DeviceFamily-Mobile.xaml | 66 ---- .../GoToStateControl.DeviceFamily-Mobile.xaml | 341 ------------------ ...ntalUpdateControl.DeviceFamily-Mobile.xaml | 86 ----- ...okeCommandControl.DeviceFamily-Mobile.xaml | 94 ----- .../MainPage.DeviceFamily-Mobile.xaml | 105 ------ ...avigatePageSample.DeviceFamily-Mobile.xaml | 50 --- ...gateToPageControl.DeviceFamily-Mobile.xaml | 58 --- .../PlaySoundControl.DeviceFamily-Mobile.xaml | 79 ---- .../XAMLBehaviorsSample.csproj | 61 ---- 16 files changed, 10 insertions(+), 1393 deletions(-) delete mode 100644 samples/CS/XAMLBehaviorsSample/CallMethodControl.DeviceFamily-Mobile.xaml delete mode 100644 samples/CS/XAMLBehaviorsSample/ChangePropertyControl.DeviceFamily-Mobile.xaml delete mode 100644 samples/CS/XAMLBehaviorsSample/ControlStoryboardControl.DeviceFamily-Mobile.xaml delete mode 100644 samples/CS/XAMLBehaviorsSample/CustomActionControl.DeviceFamily-Mobile.xaml delete mode 100644 samples/CS/XAMLBehaviorsSample/CustomBehaviorControl.DeviceFamily-Mobile.xaml delete mode 100644 samples/CS/XAMLBehaviorsSample/DataTriggerControl.DeviceFamily-Mobile.xaml delete mode 100644 samples/CS/XAMLBehaviorsSample/EventTriggerControl.DeviceFamily-Mobile.xaml delete mode 100644 samples/CS/XAMLBehaviorsSample/GoToStateControl.DeviceFamily-Mobile.xaml delete mode 100644 samples/CS/XAMLBehaviorsSample/IncrementalUpdateControl.DeviceFamily-Mobile.xaml delete mode 100644 samples/CS/XAMLBehaviorsSample/InvokeCommandControl.DeviceFamily-Mobile.xaml delete mode 100644 samples/CS/XAMLBehaviorsSample/MainPage.DeviceFamily-Mobile.xaml delete mode 100644 samples/CS/XAMLBehaviorsSample/NavigatePageSample.DeviceFamily-Mobile.xaml delete mode 100644 samples/CS/XAMLBehaviorsSample/NavigateToPageControl.DeviceFamily-Mobile.xaml delete mode 100644 samples/CS/XAMLBehaviorsSample/PlaySoundControl.DeviceFamily-Mobile.xaml diff --git a/samples/CS/XAMLBehaviorsSample.sln b/samples/CS/XAMLBehaviorsSample.sln index 381fb57..c60e91b 100644 --- a/samples/CS/XAMLBehaviorsSample.sln +++ b/samples/CS/XAMLBehaviorsSample.sln @@ -1,19 +1,13 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30011.22 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35506.116 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XAMLBehaviorsSample", "XAMLBehaviorsSample\XAMLBehaviorsSample.csproj", "{050C4B73-9A9F-469B-9FA7-FB481894391F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Xaml.Interactions", "..\..\src\BehaviorsSDKManaged\Microsoft.Xaml.Interactions\Microsoft.Xaml.Interactions.csproj", "{A338A7F2-9010-477B-8A6E-6C2B2495C33C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Xaml.Interactivity", "..\..\src\BehaviorsSDKManaged\Microsoft.Xaml.Interactivity\Microsoft.Xaml.Interactivity.csproj", "{7FFC1385-C3E1-487C-9A81-DE48DD63ECB9}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Xaml.Interactivity", "..\..\src\BehaviorsSDKManaged\Microsoft.Xaml.Interactivity\Microsoft.Xaml.Interactivity.csproj", "{A338A7F2-9010-477B-8A6E-6C2B2495C33C}" EndProject Global - GlobalSection(SharedMSBuildProjectFiles) = preSolution - ..\..\src\BehaviorsSDKManaged\Microsoft.Xaml.Interactivity.Shared\Microsoft.Xaml.Interactivity.Shared.projitems*{7ffc1385-c3e1-487c-9a81-de48dd63ecb9}*SharedItemsImports = 4 - ..\..\src\BehaviorsSDKManaged\Microsoft.Xaml.Interactions.Shared\Microsoft.Xaml.Interactions.Shared.projitems*{a338a7f2-9010-477b-8a6e-6c2b2495c33c}*SharedItemsImports = 4 - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|ARM = Debug|ARM @@ -26,6 +20,8 @@ Global EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {050C4B73-9A9F-469B-9FA7-FB481894391F}.Debug|Any CPU.ActiveCfg = Debug|x86 + {050C4B73-9A9F-469B-9FA7-FB481894391F}.Debug|Any CPU.Build.0 = Debug|x86 + {050C4B73-9A9F-469B-9FA7-FB481894391F}.Debug|Any CPU.Deploy.0 = Debug|x86 {050C4B73-9A9F-469B-9FA7-FB481894391F}.Debug|ARM.ActiveCfg = Debug|ARM {050C4B73-9A9F-469B-9FA7-FB481894391F}.Debug|ARM.Build.0 = Debug|ARM {050C4B73-9A9F-469B-9FA7-FB481894391F}.Debug|ARM.Deploy.0 = Debug|ARM @@ -36,6 +32,8 @@ Global {050C4B73-9A9F-469B-9FA7-FB481894391F}.Debug|x86.Build.0 = Debug|x86 {050C4B73-9A9F-469B-9FA7-FB481894391F}.Debug|x86.Deploy.0 = Debug|x86 {050C4B73-9A9F-469B-9FA7-FB481894391F}.Release|Any CPU.ActiveCfg = Release|x86 + {050C4B73-9A9F-469B-9FA7-FB481894391F}.Release|Any CPU.Build.0 = Release|x86 + {050C4B73-9A9F-469B-9FA7-FB481894391F}.Release|Any CPU.Deploy.0 = Release|x86 {050C4B73-9A9F-469B-9FA7-FB481894391F}.Release|ARM.ActiveCfg = Release|ARM {050C4B73-9A9F-469B-9FA7-FB481894391F}.Release|ARM.Build.0 = Release|ARM {050C4B73-9A9F-469B-9FA7-FB481894391F}.Release|ARM.Deploy.0 = Release|ARM @@ -61,22 +59,6 @@ Global {A338A7F2-9010-477B-8A6E-6C2B2495C33C}.Release|x64.Build.0 = Release|x64 {A338A7F2-9010-477B-8A6E-6C2B2495C33C}.Release|x86.ActiveCfg = Release|x86 {A338A7F2-9010-477B-8A6E-6C2B2495C33C}.Release|x86.Build.0 = Release|x86 - {7FFC1385-C3E1-487C-9A81-DE48DD63ECB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7FFC1385-C3E1-487C-9A81-DE48DD63ECB9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7FFC1385-C3E1-487C-9A81-DE48DD63ECB9}.Debug|ARM.ActiveCfg = Debug|ARM - {7FFC1385-C3E1-487C-9A81-DE48DD63ECB9}.Debug|ARM.Build.0 = Debug|ARM - {7FFC1385-C3E1-487C-9A81-DE48DD63ECB9}.Debug|x64.ActiveCfg = Debug|x64 - {7FFC1385-C3E1-487C-9A81-DE48DD63ECB9}.Debug|x64.Build.0 = Debug|x64 - {7FFC1385-C3E1-487C-9A81-DE48DD63ECB9}.Debug|x86.ActiveCfg = Debug|x86 - {7FFC1385-C3E1-487C-9A81-DE48DD63ECB9}.Debug|x86.Build.0 = Debug|x86 - {7FFC1385-C3E1-487C-9A81-DE48DD63ECB9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7FFC1385-C3E1-487C-9A81-DE48DD63ECB9}.Release|Any CPU.Build.0 = Release|Any CPU - {7FFC1385-C3E1-487C-9A81-DE48DD63ECB9}.Release|ARM.ActiveCfg = Release|ARM - {7FFC1385-C3E1-487C-9A81-DE48DD63ECB9}.Release|ARM.Build.0 = Release|ARM - {7FFC1385-C3E1-487C-9A81-DE48DD63ECB9}.Release|x64.ActiveCfg = Release|x64 - {7FFC1385-C3E1-487C-9A81-DE48DD63ECB9}.Release|x64.Build.0 = Release|x64 - {7FFC1385-C3E1-487C-9A81-DE48DD63ECB9}.Release|x86.ActiveCfg = Release|x86 - {7FFC1385-C3E1-487C-9A81-DE48DD63ECB9}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -84,4 +66,7 @@ Global GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {BAEA616E-866E-41F8-B6B8-ED0114DDB811} EndGlobalSection + GlobalSection(SharedMSBuildProjectFiles) = preSolution + ..\..\src\BehaviorsSDKManaged\Microsoft.Xaml.Interactivity.Shared\Microsoft.Xaml.Interactivity.Shared.projitems*{a338a7f2-9010-477b-8a6e-6c2b2495c33c}*SharedItemsImports = 4 + EndGlobalSection EndGlobal diff --git a/samples/CS/XAMLBehaviorsSample/CallMethodControl.DeviceFamily-Mobile.xaml b/samples/CS/XAMLBehaviorsSample/CallMethodControl.DeviceFamily-Mobile.xaml deleted file mode 100644 index 9e388c6..0000000 --- a/samples/CS/XAMLBehaviorsSample/CallMethodControl.DeviceFamily-Mobile.xaml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - CallMethodAction represents an action which when triggered, calls a method on a specified object. - In this example, Pressing the button triggers the CallMethodAction to invoke a method that increments the number displayed. - - - - <Button x:Name="button"> - <Interactivity:Interaction.Behaviors> - <Interactions:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button}"> - <Interactions:CallMethodAction TargetObject="{Binding}" MethodName="IncrementCount"/> - </Interactions:EventTriggerBehavior> - </Interactivity:Interaction.Behaviors> -</Button> - - - - - - - - - - - - - - - - - - diff --git a/samples/CS/XAMLBehaviorsSample/ChangePropertyControl.DeviceFamily-Mobile.xaml b/samples/CS/XAMLBehaviorsSample/ChangePropertyControl.DeviceFamily-Mobile.xaml deleted file mode 100644 index a966510..0000000 --- a/samples/CS/XAMLBehaviorsSample/ChangePropertyControl.DeviceFamily-Mobile.xaml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - ChangePropertyAction represents an action that will change a specified property to a specified value when invoked. - In this example, clicking the button triggers the ChangePropertyAction that changes the color property of the rectangle. - - - - <Button x:Name="button1" Content="Yellow"> - <Interactivity:Interaction.Behaviors> - <Interactions:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button1}"> - <Interactions:ChangePropertyAction TargetObject="{Binding ElementName=DataTriggerRectangle}" PropertyName="Fill" Value="{StaticResource PaleYellowBrush}"/> - </Interactions:EventTriggerBehavior> - </Interactivity:Interaction.Behaviors> -</Button> - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/CS/XAMLBehaviorsSample/ControlStoryboardControl.DeviceFamily-Mobile.xaml b/samples/CS/XAMLBehaviorsSample/ControlStoryboardControl.DeviceFamily-Mobile.xaml deleted file mode 100644 index 86eb1a4..0000000 --- a/samples/CS/XAMLBehaviorsSample/ControlStoryboardControl.DeviceFamily-Mobile.xaml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ControlStoryboardAction represents an action that will change the state of the specified Storyboard when executed. - In this example, clicking the button triggers the ControlStoryboardAction to toggle playing and pausing a storyboard that changes the size of the rectangle. - - - - <Button x:Name="button"> - <Interactivity:Interaction.Behaviors> - <Interactions:EventTriggerBehavior EventName="Click"> - <Media:ControlStoryboardAction Storyboard="{StaticResource StoryboardSample}" ControlStoryboardOption="TogglePlayPause"/> - </Interactions:EventTriggerBehavior> - </Interactivity:Interaction.Behaviors> -</Button> - - - - - - - - - - - - - - - - - - - - diff --git a/samples/CS/XAMLBehaviorsSample/CustomActionControl.DeviceFamily-Mobile.xaml b/samples/CS/XAMLBehaviorsSample/CustomActionControl.DeviceFamily-Mobile.xaml deleted file mode 100644 index 4c5eea7..0000000 --- a/samples/CS/XAMLBehaviorsSample/CustomActionControl.DeviceFamily-Mobile.xaml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - This example illustrates a custom action that brings up a ContentDialog when the button is clicked. - - - - <Button x:Name="button"> - <Interactivity:Interaction.Behaviors> - <Interactions:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button}"> - <Behaviors:ContentDialogPopUp/> - </Interactions:EventTriggerBehavior> - </Interactivity:Interaction.Behaviors> -</Button> - - - - - - - - - - - - - - diff --git a/samples/CS/XAMLBehaviorsSample/CustomBehaviorControl.DeviceFamily-Mobile.xaml b/samples/CS/XAMLBehaviorsSample/CustomBehaviorControl.DeviceFamily-Mobile.xaml deleted file mode 100644 index 14931d5..0000000 --- a/samples/CS/XAMLBehaviorsSample/CustomBehaviorControl.DeviceFamily-Mobile.xaml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - Implementing a Custom Behavior for DragPositionBehavior allows controls to be moved around the canvas. - In this example, the shapes are able to be dragged around the page using a mouse drag. - - - - <Rectangle> - <Interactivity:Interaction.Behaviors> - <Behaviors:DragPositionBehavior/> - </Interactivity:Interaction.Behaviors> -</Rectangle> - - - - - - - - - - - - - - - - - - - diff --git a/samples/CS/XAMLBehaviorsSample/DataTriggerControl.DeviceFamily-Mobile.xaml b/samples/CS/XAMLBehaviorsSample/DataTriggerControl.DeviceFamily-Mobile.xaml deleted file mode 100644 index bd70241..0000000 --- a/samples/CS/XAMLBehaviorsSample/DataTriggerControl.DeviceFamily-Mobile.xaml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - DataTriggerBehavior performs an action when the data the behaviors is bound to meets a specified condition. - 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. - - - - <Rectangle x:Name="DataTriggerRectangle"> - <Interactivity:Interaction.Behaviors> - <Interactions:DataTriggerBehavior Binding="{Binding Value, ElementName=slider}" ComparisonCondition="GreaterThan" Value="50"> - <Interactions:ChangePropertyAction TargetObject="{Binding ElementName=DataTriggerRectangle}" PropertyName="Fill" Value="{StaticResource PaleYellowBrush}"/> - </Interactions:DataTriggerBehavior> - <Interactions:DataTriggerBehavior Binding="{Binding Value, ElementName=slider}" ComparisonCondition="LessThanOrEqual" Value="50"> - <Interactions:ChangePropertyAction TargetObject="{Binding ElementName=DataTriggerRectangle}" PropertyName="Fill" Value="{StaticResource RoyalBlueBrush}"/> - </Interactions:DataTriggerBehavior> - </Interactivity:Interaction.Behaviors> -</Rectangle> - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/CS/XAMLBehaviorsSample/EventTriggerControl.DeviceFamily-Mobile.xaml b/samples/CS/XAMLBehaviorsSample/EventTriggerControl.DeviceFamily-Mobile.xaml deleted file mode 100644 index 101fc6f..0000000 --- a/samples/CS/XAMLBehaviorsSample/EventTriggerControl.DeviceFamily-Mobile.xaml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - EventTriggerBehavior listens for a specific event on its source and executes an action when the event is fired. - 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. - - - - <Button x:Name="button"> - <Interactivity:Interaction.Behaviors> - <Interactions:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button}"> - <Interactions:ChangePropertyAction TargetObject="{Binding ElementName=DataTriggerRectangle}" PropertyName="Fill" Value="{StaticResource PaleYellowBrush}"/> - </Interactions:EventTriggerBehavior> - </Interactivity:Interaction.Behaviors> -</Button> - - - - - - - - - - - - - - - - diff --git a/samples/CS/XAMLBehaviorsSample/GoToStateControl.DeviceFamily-Mobile.xaml b/samples/CS/XAMLBehaviorsSample/GoToStateControl.DeviceFamily-Mobile.xaml deleted file mode 100644 index 8616799..0000000 --- a/samples/CS/XAMLBehaviorsSample/GoToStateControl.DeviceFamily-Mobile.xaml +++ /dev/null @@ -1,341 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - GoToStateAction represents an action that will transition a FrameworkElement (i.e. Button) to a specified VisualState when triggered. - In this example, clicking the below button will trigger the GoToStateAction to make the sample button transition into a disabled state. - - - - <CheckBox x:Name="checkBox"> - <Interactivity:Interaction.Behaviors> - <Interactions:DataTriggerBehavior Binding="{Binding IsChecked, ElementName=checkBox}" Value="True"> - <Interactions:GoToStateAction StateName="Disabled" TargetObject="{Binding ElementName=sampleStateButton}"/> - </Interactions:DataTriggerBehavior> - <Interactions:DataTriggerBehavior Binding="{Binding IsChecked, ElementName=checkBox}" Value="False"> - <Interactions:GoToStateAction StateName="Normal" TargetObject="{Binding ElementName=sampleStateButton}"/> - </Interactions:DataTriggerBehavior> - </Interactivity:Interaction.Behaviors> -</CheckBox> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/CS/XAMLBehaviorsSample/IncrementalUpdateControl.DeviceFamily-Mobile.xaml b/samples/CS/XAMLBehaviorsSample/IncrementalUpdateControl.DeviceFamily-Mobile.xaml deleted file mode 100644 index acd379e..0000000 --- a/samples/CS/XAMLBehaviorsSample/IncrementalUpdateControl.DeviceFamily-Mobile.xaml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IncrementalUpdateBehavior attaches to the DataTemplate inside ListViewBase controls (i.e. ListView and GridView). - It enables deferred rendering for specified elements in the ItemTemplate used by the view. - In the sample, declaring elements in the GridView in certain phases defers updates until there is render time available, resulting in a smoother expeirence. - - - - <DataTemplate x:Key="GridViewItem"> - <StackPanel> - <Rectangle> - <Interactivity:Interaction.Behaviors> - <Interactions:IncrementalUpdateBehavior Phase="2"/> - </Interactivity:Interaction.Behaviors> - </Rectangle> - <TextBlock Text="{Binding Count}"> - <Interactivity:Interaction.Behaviors> - <Interactions:IncrementalUpdateBehavior Phase="1"/> - </Interactivity:Interaction.Behaviors> - </TextBlock> - </StackPanel> -</DataTemplate> - - - - - - - - - - - - - - - - - diff --git a/samples/CS/XAMLBehaviorsSample/InvokeCommandControl.DeviceFamily-Mobile.xaml b/samples/CS/XAMLBehaviorsSample/InvokeCommandControl.DeviceFamily-Mobile.xaml deleted file mode 100644 index 9a1292a..0000000 --- a/samples/CS/XAMLBehaviorsSample/InvokeCommandControl.DeviceFamily-Mobile.xaml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - The InvokeCommandAction action executes a specified ICommand on a specified target object when invoked. - In this example there are several buttons set up with InvokeCommandAction attached to them. - When clicked, the action triggers an ICommand to increment the count or change the background color. - - - - <Button x:Name="button1"> - <Interactivity:Interaction.Behaviors> - <Interactions:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button1}"> - <Interactions:InvokeCommandAction Command="{Binding UpdateCountCommand}"/> - </Interactions:EventTriggerBehavior> - </Interactivity:Interaction.Behaviors> -</Button> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/CS/XAMLBehaviorsSample/MainPage.DeviceFamily-Mobile.xaml b/samples/CS/XAMLBehaviorsSample/MainPage.DeviceFamily-Mobile.xaml deleted file mode 100644 index 21302c7..0000000 --- a/samples/CS/XAMLBehaviorsSample/MainPage.DeviceFamily-Mobile.xaml +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/CS/XAMLBehaviorsSample/NavigateToPageControl.DeviceFamily-Mobile.xaml b/samples/CS/XAMLBehaviorsSample/NavigateToPageControl.DeviceFamily-Mobile.xaml deleted file mode 100644 index 6586e1a..0000000 --- a/samples/CS/XAMLBehaviorsSample/NavigateToPageControl.DeviceFamily-Mobile.xaml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - 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. - - - <Button x:Name="button"> - <Interactivity:Interaction.Behaviors> - <Interactions:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button}"> - <Interactions:NavigateToPageAction TargetPage="XAMLBehaviorsSample.NavigatePageSample"/> - </Interactions:EventTriggerBehavior> - </Interactivity:Interaction.Behaviors> -</Button> - - - - - - - - - - - diff --git a/samples/CS/XAMLBehaviorsSample/PlaySoundControl.DeviceFamily-Mobile.xaml b/samples/CS/XAMLBehaviorsSample/PlaySoundControl.DeviceFamily-Mobile.xaml deleted file mode 100644 index 218178b..0000000 --- a/samples/CS/XAMLBehaviorsSample/PlaySoundControl.DeviceFamily-Mobile.xaml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - PlaySoundAction represents an action that will play a sound to completion. In this example, clicking the button plays a sample sound. - - - - <Button x:Name="button1"> - <Interactivity:Interaction.Behaviors> - <Interactions:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button1}"> - <Media:PlaySoundAction Source="Assets/Ding.mp3" Volume="1"/> - </Interactions:EventTriggerBehavior> - </Interactivity:Interaction.Behaviors> -</Button> - - - - - - - - - - - - - - - - - - diff --git a/samples/CS/XAMLBehaviorsSample/XAMLBehaviorsSample.csproj b/samples/CS/XAMLBehaviorsSample/XAMLBehaviorsSample.csproj index 63f3617..1564c89 100644 --- a/samples/CS/XAMLBehaviorsSample/XAMLBehaviorsSample.csproj +++ b/samples/CS/XAMLBehaviorsSample/XAMLBehaviorsSample.csproj @@ -124,7 +124,6 @@ Designer - @@ -144,18 +143,10 @@ MSBuild:Compile Designer - - MSBuild:Compile - Designer - Designer MSBuild:Compile - - MSBuild:Compile - Designer - Designer MSBuild:Compile @@ -164,74 +155,38 @@ Designer MSBuild:Compile - - MSBuild:Compile - Designer - Designer MSBuild:Compile - - MSBuild:Compile - Designer - Designer MSBuild:Compile - - MSBuild:Compile - Designer - Designer MSBuild:Compile - - MSBuild:Compile - Designer - Designer MSBuild:Compile - - MSBuild:Compile - Designer - Designer MSBuild:Compile - - MSBuild:Compile - Designer - Designer MSBuild:Compile - - MSBuild:Compile - Designer - Designer MSBuild:Compile - - MSBuild:Compile - Designer - Designer MSBuild:Compile - - MSBuild:Compile - Designer - MSBuild:Compile Designer @@ -241,26 +196,14 @@ MSBuild:Compile PreserveNewest - - Designer - MSBuild:Compile - Designer MSBuild:Compile - - MSBuild:Compile - Designer - Designer MSBuild:Compile - - MSBuild:Compile - Designer - Designer MSBuild:Compile @@ -273,10 +216,6 @@ - - {a338a7f2-9010-477b-8a6e-6c2b2495c33c} - Microsoft.Xaml.Interactions - {7ffc1385-c3e1-487c-9a81-de48dd63ecb9} Microsoft.Xaml.Interactivity From c95e068c5f16ebb9e20630c3a7c84f8b6e16fab6 Mon Sep 17 00:00:00 2001 From: Michael Hawker <24302614+michael-hawker@users.noreply.github.com> Date: Tue, 19 Nov 2024 17:33:21 -0800 Subject: [PATCH 3/6] Unify Namespace for Samples Tested each one locally --- .../CallMethodControl.xaml | 12 +++++----- .../ChangePropertyControl.xaml | 18 +++++++------- .../ControlStoryboardControl.xaml | 13 +++++----- .../CustomActionControl.xaml | 8 +++---- .../CustomBehaviorControl.xaml | 2 +- .../DataTriggerControl.xaml | 22 ++++++++--------- .../EventTriggerControl.xaml | 12 +++++----- .../XAMLBehaviorsSample/GoToStateControl.xaml | 22 ++++++++--------- .../IncrementalUpdateControl.xaml | 10 ++++---- .../InvokeCommandControl.xaml | 24 +++++++++---------- .../NavigatePageSample.xaml | 8 +++---- .../NavigateToPageControl.xaml | 12 +++++----- .../XAMLBehaviorsSample/PlaySoundControl.xaml | 24 +++++++++---------- 13 files changed, 93 insertions(+), 94 deletions(-) diff --git a/samples/CS/XAMLBehaviorsSample/CallMethodControl.xaml b/samples/CS/XAMLBehaviorsSample/CallMethodControl.xaml index f6b5352..ca450af 100644 --- a/samples/CS/XAMLBehaviorsSample/CallMethodControl.xaml +++ b/samples/CS/XAMLBehaviorsSample/CallMethodControl.xaml @@ -5,7 +5,7 @@ xmlns:local="using:XAMLBehaviorsSample" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Interactions="using:Microsoft.Xaml.Interactions.Core" + xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" mc:Ignorable="d" d:DesignHeight="600" d:DesignWidth="800"> @@ -37,8 +37,8 @@ <Button x:Name="button"> <Interactivity:Interaction.Behaviors> - <Interactions:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button}"> - <Interactions:CallMethodAction TargetObject="{Binding}" MethodName="IncrementCount"/> + <Interactivity:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button}"> + <Interactivity:CallMethodAction TargetObject="{Binding}" MethodName="IncrementCount"/> </Interactions:EventTriggerBehavior> </Interactivity:Interaction.Behaviors> </Button> @@ -56,9 +56,9 @@ diff --git a/samples/CS/XAMLBehaviorsSample/ChangePropertyControl.xaml b/samples/CS/XAMLBehaviorsSample/ChangePropertyControl.xaml index 33d15ef..df64ded 100644 --- a/samples/CS/XAMLBehaviorsSample/ChangePropertyControl.xaml +++ b/samples/CS/XAMLBehaviorsSample/ChangePropertyControl.xaml @@ -5,7 +5,7 @@ xmlns:local="using:XAMLBehaviorsSample" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Interactions="using:Microsoft.Xaml.Interactions.Core" + xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" mc:Ignorable="d" d:DesignHeight="600" d:DesignWidth="800"> @@ -37,8 +37,8 @@ <Button x:Name="button1" Content="Yellow"> <Interactivity:Interaction.Behaviors> - <Interactions:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button1}"> - <Interactions:ChangePropertyAction TargetObject="{Binding ElementName=DataTriggerRectangle}" PropertyName="Fill" Value="{StaticResource PaleYellowBrush}"/> + <Interactivity:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button1}"> + <Interactivity:ChangePropertyAction TargetObject="{Binding ElementName=DataTriggerRectangle}" PropertyName="Fill" Value="{StaticResource PaleYellowBrush}"/> </Interactions:EventTriggerBehavior> </Interactivity:Interaction.Behaviors> </Button> @@ -60,16 +60,16 @@ diff --git a/samples/CS/XAMLBehaviorsSample/ControlStoryboardControl.xaml b/samples/CS/XAMLBehaviorsSample/ControlStoryboardControl.xaml index 32e6ee7..3877dbb 100644 --- a/samples/CS/XAMLBehaviorsSample/ControlStoryboardControl.xaml +++ b/samples/CS/XAMLBehaviorsSample/ControlStoryboardControl.xaml @@ -4,8 +4,7 @@ xmlns:local="using:XAMLBehaviorsSample" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Interactions="using:Microsoft.Xaml.Interactions.Core" - xmlns:Core="using:Microsoft.Xaml.Interactions.Core" xmlns:Media="using:Microsoft.Xaml.Interactions.Media" + xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" x:Class="XAMLBehaviorsSample.ControlStoryboardControl" mc:Ignorable="d" d:DesignHeight="600" @@ -49,8 +48,8 @@ <Button x:Name="button"> <Interactivity:Interaction.Behaviors> - <Interactions:EventTriggerBehavior EventName="Click"> - <Media:ControlStoryboardAction Storyboard="{StaticResource StoryboardSample}" ControlStoryboardOption="TogglePlayPause"/> + <Interactivity:EventTriggerBehavior EventName="Click"> + <Interactivity:ControlStoryboardAction Storyboard="{StaticResource StoryboardSample}" ControlStoryboardOption="TogglePlayPause"/> </Interactions:EventTriggerBehavior> </Interactivity:Interaction.Behaviors> </Button> @@ -71,9 +70,9 @@ diff --git a/samples/CS/XAMLBehaviorsSample/CustomActionControl.xaml b/samples/CS/XAMLBehaviorsSample/CustomActionControl.xaml index 4a8a86b..6b23599 100644 --- a/samples/CS/XAMLBehaviorsSample/CustomActionControl.xaml +++ b/samples/CS/XAMLBehaviorsSample/CustomActionControl.xaml @@ -5,7 +5,7 @@ xmlns:local="using:XAMLBehaviorsSample" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Interactions="using:Microsoft.Xaml.Interactions.Core" + xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Behaviors="using:XAMLBehaviorsSample" mc:Ignorable="d" d:DesignHeight="600" @@ -37,7 +37,7 @@ <Button x:Name="button"> <Interactivity:Interaction.Behaviors> - <Interactions:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button}"> + <Interactivity:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button}"> <Behaviors:ContentDialogPopUp/> </Interactions:EventTriggerBehavior> </Interactivity:Interaction.Behaviors> @@ -53,9 +53,9 @@ diff --git a/samples/CS/XAMLBehaviorsSample/CustomBehaviorControl.xaml b/samples/CS/XAMLBehaviorsSample/CustomBehaviorControl.xaml index afb344f..f5a6485 100644 --- a/samples/CS/XAMLBehaviorsSample/CustomBehaviorControl.xaml +++ b/samples/CS/XAMLBehaviorsSample/CustomBehaviorControl.xaml @@ -4,7 +4,7 @@ xmlns:local="using:XAMLBehaviorsSample" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Interactions="using:Microsoft.Xaml.Interactions.Core" + xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" x:Class="XAMLBehaviorsSample.CustomBehaviorControl" mc:Ignorable="d" d:DesignHeight="600" diff --git a/samples/CS/XAMLBehaviorsSample/DataTriggerControl.xaml b/samples/CS/XAMLBehaviorsSample/DataTriggerControl.xaml index 961b43b..e6b7273 100644 --- a/samples/CS/XAMLBehaviorsSample/DataTriggerControl.xaml +++ b/samples/CS/XAMLBehaviorsSample/DataTriggerControl.xaml @@ -4,7 +4,7 @@ xmlns:local="using:XAMLBehaviorsSample" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Interactions="using:Microsoft.Xaml.Interactions.Core" + xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" x:Class="XAMLBehaviorsSample.DataTriggerControl" mc:Ignorable="d" d:DesignHeight="600" @@ -37,11 +37,11 @@ <Rectangle x:Name="DataTriggerRectangle"> <Interactivity:Interaction.Behaviors> - <Interactions:DataTriggerBehavior Binding="{Binding Value, ElementName=slider}" ComparisonCondition="GreaterThan" Value="50"> - <Interactions:ChangePropertyAction TargetObject="{Binding ElementName=DataTriggerRectangle}" PropertyName="Fill" Value="{StaticResource PaleYellowBrush}"/> + <Interactivity:DataTriggerBehavior Binding="{Binding Value, ElementName=slider}" ComparisonCondition="GreaterThan" Value="50"> + <Interactivity:ChangePropertyAction TargetObject="{Binding ElementName=DataTriggerRectangle}" PropertyName="Fill" Value="{StaticResource PaleYellowBrush}"/> </Interactions:DataTriggerBehavior> - <Interactions:DataTriggerBehavior Binding="{Binding Value, ElementName=slider}" ComparisonCondition="LessThanOrEqual" Value="50"> - <Interactions:ChangePropertyAction TargetObject="{Binding ElementName=DataTriggerRectangle}" PropertyName="Fill" Value="{StaticResource RoyalBlueBrush}"/> + <Interactivity:DataTriggerBehavior Binding="{Binding Value, ElementName=slider}" ComparisonCondition="LessThanOrEqual" Value="50"> + <Interactivity:ChangePropertyAction TargetObject="{Binding ElementName=DataTriggerRectangle}" PropertyName="Fill" Value="{StaticResource RoyalBlueBrush}"/> </Interactions:DataTriggerBehavior> </Interactivity:Interaction.Behaviors> </Rectangle> @@ -55,12 +55,12 @@ - - - - - - + + + + + + diff --git a/samples/CS/XAMLBehaviorsSample/EventTriggerControl.xaml b/samples/CS/XAMLBehaviorsSample/EventTriggerControl.xaml index 9e63834..bb47162 100644 --- a/samples/CS/XAMLBehaviorsSample/EventTriggerControl.xaml +++ b/samples/CS/XAMLBehaviorsSample/EventTriggerControl.xaml @@ -5,7 +5,7 @@ xmlns:local="using:XAMLBehaviorsSample" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Interactions="using:Microsoft.Xaml.Interactions.Core" + xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" mc:Ignorable="d" d:DesignHeight="600" d:DesignWidth="800"> @@ -37,8 +37,8 @@ <Button x:Name="button"> <Interactivity:Interaction.Behaviors> - <Interactions:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button}"> - <Interactions:ChangePropertyAction TargetObject="{Binding ElementName=DataTriggerRectangle}" PropertyName="Fill" Value="{StaticResource PaleYellowBrush}"/> + <Interactivity:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button}"> + <Interactivity:ChangePropertyAction TargetObject="{Binding ElementName=DataTriggerRectangle}" PropertyName="Fill" Value="{StaticResource PaleYellowBrush}"/> </Interactions:EventTriggerBehavior> </Interactivity:Interaction.Behaviors> </Button> @@ -55,9 +55,9 @@ diff --git a/samples/CS/XAMLBehaviorsSample/GoToStateControl.xaml b/samples/CS/XAMLBehaviorsSample/GoToStateControl.xaml index 49d7409..eb9823c 100644 --- a/samples/CS/XAMLBehaviorsSample/GoToStateControl.xaml +++ b/samples/CS/XAMLBehaviorsSample/GoToStateControl.xaml @@ -5,7 +5,7 @@ xmlns:local="using:XAMLBehaviorsSample" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Interactions="using:Microsoft.Xaml.Interactions.Core" + xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" mc:Ignorable="d" d:DesignHeight="600" d:DesignWidth="800"> @@ -37,11 +37,11 @@ <CheckBox x:Name="checkBox"> <Interactivity:Interaction.Behaviors> - <Interactions:DataTriggerBehavior Binding="{Binding IsChecked, ElementName=checkBox}" Value="True"> - <Interactions:GoToStateAction StateName="Disabled" TargetObject="{Binding ElementName=sampleStateButton}"/> + <Interactivity:DataTriggerBehavior Binding="{Binding IsChecked, ElementName=checkBox}" Value="True"> + <Interactivity:GoToStateAction StateName="Disabled" TargetObject="{Binding ElementName=sampleStateButton}"/> </Interactions:DataTriggerBehavior> - <Interactions:DataTriggerBehavior Binding="{Binding IsChecked, ElementName=checkBox}" Value="False"> - <Interactions:GoToStateAction StateName="Normal" TargetObject="{Binding ElementName=sampleStateButton}"/> + <Interactivity:DataTriggerBehavior Binding="{Binding IsChecked, ElementName=checkBox}" Value="False"> + <Interactivity:GoToStateAction StateName="Normal" TargetObject="{Binding ElementName=sampleStateButton}"/> </Interactions:DataTriggerBehavior> </Interactivity:Interaction.Behaviors> </CheckBox> @@ -324,12 +324,12 @@ - - - - - - + + + + + + diff --git a/samples/CS/XAMLBehaviorsSample/IncrementalUpdateControl.xaml b/samples/CS/XAMLBehaviorsSample/IncrementalUpdateControl.xaml index febdb60..a6c33a9 100644 --- a/samples/CS/XAMLBehaviorsSample/IncrementalUpdateControl.xaml +++ b/samples/CS/XAMLBehaviorsSample/IncrementalUpdateControl.xaml @@ -5,7 +5,7 @@ xmlns:local="using:XAMLBehaviorsSample" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Interactions="using:Microsoft.Xaml.Interactions.Core" + xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" mc:Ignorable="d" d:DesignHeight="600" d:DesignWidth="800"> @@ -15,12 +15,12 @@ - + - + @@ -57,12 +57,12 @@ <StackPanel> <Rectangle> <Interactivity:Interaction.Behaviors> - <Interactions:IncrementalUpdateBehavior Phase="2"/> + <Interactivity:IncrementalUpdateBehavior Phase="2"/> </Interactivity:Interaction.Behaviors> </Rectangle> <TextBlock Text="{Binding Count}"> <Interactivity:Interaction.Behaviors> - <Interactions:IncrementalUpdateBehavior Phase="1"/> + <Interactivity:IncrementalUpdateBehavior Phase="1"/> </Interactivity:Interaction.Behaviors> </TextBlock> </StackPanel> diff --git a/samples/CS/XAMLBehaviorsSample/InvokeCommandControl.xaml b/samples/CS/XAMLBehaviorsSample/InvokeCommandControl.xaml index e8f9291..9a1c8d7 100644 --- a/samples/CS/XAMLBehaviorsSample/InvokeCommandControl.xaml +++ b/samples/CS/XAMLBehaviorsSample/InvokeCommandControl.xaml @@ -4,7 +4,7 @@ xmlns:local="using:XAMLBehaviorsSample" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Interactions="using:Microsoft.Xaml.Interactions.Core" + xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" x:Class="XAMLBehaviorsSample.InvokeCommandControl" mc:Ignorable="d" d:DesignHeight="600" @@ -38,8 +38,8 @@ <Button x:Name="button1"> <Interactivity:Interaction.Behaviors> - <Interactions:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button1}"> - <Interactions:InvokeCommandAction Command="{Binding UpdateCountCommand}"/> + <Interactivity:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button1}"> + <Interactivity:InvokeCommandAction Command="{Binding UpdateCountCommand}"/> </Interactions:EventTriggerBehavior> </Interactivity:Interaction.Behaviors> </Button> @@ -66,25 +66,25 @@ diff --git a/samples/CS/XAMLBehaviorsSample/NavigatePageSample.xaml b/samples/CS/XAMLBehaviorsSample/NavigatePageSample.xaml index c51f022..4145f8c 100644 --- a/samples/CS/XAMLBehaviorsSample/NavigatePageSample.xaml +++ b/samples/CS/XAMLBehaviorsSample/NavigatePageSample.xaml @@ -4,7 +4,7 @@ xmlns:local="using:XAMLBehaviorsSample" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Interactions="using:Microsoft.Xaml.Interactions.Core" + xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" x:Class="XAMLBehaviorsSample.NavigatePageSample" mc:Ignorable="d"> @@ -40,9 +40,9 @@ diff --git a/samples/CS/XAMLBehaviorsSample/NavigateToPageControl.xaml b/samples/CS/XAMLBehaviorsSample/NavigateToPageControl.xaml index 7e9a7de..7060a18 100644 --- a/samples/CS/XAMLBehaviorsSample/NavigateToPageControl.xaml +++ b/samples/CS/XAMLBehaviorsSample/NavigateToPageControl.xaml @@ -4,7 +4,7 @@ xmlns:local="using:XAMLBehaviorsSample" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Interactions="using:Microsoft.Xaml.Interactions.Core" + xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" x:Class="XAMLBehaviorsSample.NavigateToPageControl" mc:Ignorable="d" d:DesignHeight="600" @@ -34,8 +34,8 @@ <Button x:Name="button"> <Interactivity:Interaction.Behaviors> - <Interactions:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button}"> - <Interactions:NavigateToPageAction TargetPage="XAMLBehaviorsSample.NavigatePageSample"/> + <Interactivity:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button}"> + <Interactivity:NavigateToPageAction TargetPage="XAMLBehaviorsSample.NavigatePageSample"/> </Interactions:EventTriggerBehavior> </Interactivity:Interaction.Behaviors> </Button> @@ -50,9 +50,9 @@ diff --git a/samples/CS/XAMLBehaviorsSample/PlaySoundControl.xaml b/samples/CS/XAMLBehaviorsSample/PlaySoundControl.xaml index 8645998..7a7bdf7 100644 --- a/samples/CS/XAMLBehaviorsSample/PlaySoundControl.xaml +++ b/samples/CS/XAMLBehaviorsSample/PlaySoundControl.xaml @@ -4,7 +4,7 @@ xmlns:local="using:XAMLBehaviorsSample" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Interactions="using:Microsoft.Xaml.Interactions.Core" xmlns:Media="using:Microsoft.Xaml.Interactions.Media" + xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" x:Class="XAMLBehaviorsSample.PlaySoundControl" mc:Ignorable="d" d:DesignHeight="600" @@ -36,8 +36,8 @@ <Button x:Name="button1"> <Interactivity:Interaction.Behaviors> - <Interactions:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button1}"> - <Media:PlaySoundAction Source="Assets/Ding.mp3" Volume="1"/> + <Interactivity:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button1}"> + <Interactivity:PlaySoundAction Source="Assets/Ding.mp3" Volume="1"/> </Interactions:EventTriggerBehavior> </Interactivity:Interaction.Behaviors> </Button> @@ -53,23 +53,23 @@ From 80ed924bc5aac9a64e0fae10e62a8001a4321ea9 Mon Sep 17 00:00:00 2001 From: Michael Hawker <24302614+michael-hawker@users.noreply.github.com> Date: Tue, 19 Nov 2024 17:37:20 -0800 Subject: [PATCH 4/6] Update NuGet dependency and remove old pfx cert info not needed --- samples/CS/XAMLBehaviorsSample/XAMLBehaviorsSample.csproj | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/samples/CS/XAMLBehaviorsSample/XAMLBehaviorsSample.csproj b/samples/CS/XAMLBehaviorsSample/XAMLBehaviorsSample.csproj index 1564c89..f4e458f 100644 --- a/samples/CS/XAMLBehaviorsSample/XAMLBehaviorsSample.csproj +++ b/samples/CS/XAMLBehaviorsSample/XAMLBehaviorsSample.csproj @@ -17,8 +17,6 @@ true 512 {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - XAMLBehaviorsSample_TemporaryKey.pfx - A59F5EC5577FD12DC7C715F9B786ED18FE397750 win10-x86;win10-x86-aot;win10-x64;win10-x64-aot @@ -223,7 +221,7 @@ - 6.2.10 + 6.2.14 From 62421c9988af07a424a6c4671ee5508dda73a39c Mon Sep 17 00:00:00 2001 From: Michael Hawker <24302614+michael-hawker@users.noreply.github.com> Date: Tue, 19 Nov 2024 17:42:51 -0800 Subject: [PATCH 5/6] Update all Sample C# files to file-scoped namespaces (and clean-up usings) --- samples/CS/XAMLBehaviorsSample/App.xaml.cs | 183 +++++++------- .../CallMethodControl.xaml.cs | 54 ++-- .../ChangePropertyControl.xaml.cs | 26 +- .../XAMLBehaviorsSample/ContentDialogPopUp.cs | 31 +-- .../ContentDialogSample.xaml.cs | 34 +-- .../ControlStoryboardControl.xaml.cs | 26 +- .../CustomActionControl.xaml.cs | 26 +- .../CustomBehaviorControl.xaml.cs | 26 +- .../DataTriggerControl.xaml.cs | 26 +- .../DragPositionBehavior.cs | 118 +++++---- .../EventTriggerControl.xaml.cs | 26 +- .../GoToStateControl.xaml.cs | 26 +- .../IncrementalUpdateControl.xaml.cs | 55 ++-- .../InvokeCommandControl.xaml.cs | 114 ++++----- .../CS/XAMLBehaviorsSample/MainPage.xaml.cs | 236 +++++++++--------- .../NavigatePageSample.xaml.cs | 32 +-- .../NavigateToPageControl.xaml.cs | 26 +- .../PlaySoundControl.xaml.cs | 26 +- .../XAMLBehaviorsSample.csproj | 1 + 19 files changed, 419 insertions(+), 673 deletions(-) diff --git a/samples/CS/XAMLBehaviorsSample/App.xaml.cs b/samples/CS/XAMLBehaviorsSample/App.xaml.cs index 8409e0e..490c625 100644 --- a/samples/CS/XAMLBehaviorsSample/App.xaml.cs +++ b/samples/CS/XAMLBehaviorsSample/App.xaml.cs @@ -1,129 +1,118 @@ using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; using Windows.ApplicationModel; using Windows.ApplicationModel.Activation; -using Windows.Foundation; -using Windows.Foundation.Collections; using Windows.Foundation.Metadata; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; -namespace XAMLBehaviorsSample +namespace XAMLBehaviorsSample; + +/// +/// Provides application-specific behavior to supplement the default Application class. +/// +sealed partial class App : Application { /// - /// Provides application-specific behavior to supplement the default Application class. + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). /// - sealed partial class App : Application + public App() { - /// - /// Initializes the singleton application object. This is the first line of authored code - /// executed, and as such is the logical equivalent of main() or WinMain(). - /// - public App() - { - this.InitializeComponent(); - this.Suspending += OnSuspending; - } + this.InitializeComponent(); + this.Suspending += OnSuspending; + } - /// - /// Invoked when the application is launched normally by the end user. Other entry points - /// will be used such as when the application is launched to open a specific file. - /// - /// Details about the launch request and process. - protected override void OnLaunched(LaunchActivatedEventArgs e) - { + /// + /// Invoked when the application is launched normally by the end user. Other entry points + /// will be used such as when the application is launched to open a specific file. + /// + /// Details about the launch request and process. + protected override void OnLaunched(LaunchActivatedEventArgs e) + { #if DEBUG - if (System.Diagnostics.Debugger.IsAttached) - { - this.DebugSettings.EnableFrameRateCounter = true; - } + if (System.Diagnostics.Debugger.IsAttached) + { + this.DebugSettings.EnableFrameRateCounter = true; + } #endif - Frame rootFrame = Window.Current.Content as Frame; - - // Do not repeat app initialization when the Window already has content, - // just ensure that the window is active - if (rootFrame == null) - { - // Create a Frame to act as the navigation context and navigate to the first page - rootFrame = new Frame(); - - rootFrame.NavigationFailed += OnNavigationFailed; + Frame rootFrame = Window.Current.Content as Frame; - if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) - { - //TODO: Load state from previously suspended application - } + // Do not repeat app initialization when the Window already has content, + // just ensure that the window is active + if (rootFrame == null) + { + // Create a Frame to act as the navigation context and navigate to the first page + rootFrame = new Frame(); - // Place the frame in the current Window - Window.Current.Content = rootFrame; - } + rootFrame.NavigationFailed += OnNavigationFailed; - if (rootFrame.Content == null) + if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { - // When the navigation stack isn't restored navigate to the first page, - // configuring the new page by passing required information as a navigation - // parameter + //TODO: Load state from previously suspended application + } - //if (DetectMobile()) - //{ - // rootFrame.Navigate(typeof(MainPage_Mobile), e.Arguments); - //} - //else - //{ - rootFrame.Navigate(typeof(MainPage), e.Arguments); - // } - } - // Ensure the current window is active - Window.Current.Activate(); + // Place the frame in the current Window + Window.Current.Content = rootFrame; } - /// - /// Invoked when Navigation to a certain page fails - /// - /// The Frame which failed navigation - /// Details about the navigation failure - void OnNavigationFailed(object sender, NavigationFailedEventArgs e) + if (rootFrame.Content == null) { - throw new Exception("Failed to load Page " + e.SourcePageType.FullName); - } + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter - /// - /// Invoked when application execution is being suspended. Application state is saved - /// without knowing whether the application will be terminated or resumed with the contents - /// of memory still intact. - /// - /// The source of the suspend request. - /// Details about the suspend request. - private void OnSuspending(object sender, SuspendingEventArgs e) + //if (DetectMobile()) + //{ + // rootFrame.Navigate(typeof(MainPage_Mobile), e.Arguments); + //} + //else + //{ + rootFrame.Navigate(typeof(MainPage), e.Arguments); + // } + } + // Ensure the current window is active + Window.Current.Activate(); + } + + /// + /// Invoked when Navigation to a certain page fails + /// + /// The Frame which failed navigation + /// Details about the navigation failure + void OnNavigationFailed(object sender, NavigationFailedEventArgs e) + { + throw new Exception("Failed to load Page " + e.SourcePageType.FullName); + } + + /// + /// Invoked when application execution is being suspended. Application state is saved + /// without knowing whether the application will be terminated or resumed with the contents + /// of memory still intact. + /// + /// The source of the suspend request. + /// Details about the suspend request. + private void OnSuspending(object sender, SuspendingEventArgs e) + { + var deferral = e.SuspendingOperation.GetDeferral(); + //TODO: Save application state and stop any background activity + deferral.Complete(); + } + + private bool DetectMobile() + { + bool isHardwareButtonsAPIPresent = + ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"); + + if (isHardwareButtonsAPIPresent) { - var deferral = e.SuspendingOperation.GetDeferral(); - //TODO: Save application state and stop any background activity - deferral.Complete(); + return true; } - - private bool DetectMobile() + else { - bool isHardwareButtonsAPIPresent = - ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"); - - if (isHardwareButtonsAPIPresent) - { - return true; - } - else - { - return false; - } + return false; } } } diff --git a/samples/CS/XAMLBehaviorsSample/CallMethodControl.xaml.cs b/samples/CS/XAMLBehaviorsSample/CallMethodControl.xaml.cs index 348814b..6634ece 100644 --- a/samples/CS/XAMLBehaviorsSample/CallMethodControl.xaml.cs +++ b/samples/CS/XAMLBehaviorsSample/CallMethodControl.xaml.cs @@ -1,45 +1,29 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; +using System.ComponentModel; using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; -// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236 +namespace XAMLBehaviorsSample; -namespace XAMLBehaviorsSample +public sealed partial class CallMethodControl : UserControl, INotifyPropertyChanged { - public sealed partial class CallMethodControl : UserControl, INotifyPropertyChanged - { - public int Count { get; set; } + public int Count { get; set; } - public CallMethodControl() - { - this.InitializeComponent(); - this.DataContext = this; - Count = 0; - } + public CallMethodControl() + { + this.InitializeComponent(); + this.DataContext = this; + Count = 0; + } - public event PropertyChangedEventHandler PropertyChanged; + public event PropertyChangedEventHandler PropertyChanged; - public void IncrementCount() - { - Count++; - OnPropertyChanged(nameof(Count)); - } + public void IncrementCount() + { + Count++; + OnPropertyChanged(nameof(Count)); + } - private void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + private void OnPropertyChanged(string propertyName) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } diff --git a/samples/CS/XAMLBehaviorsSample/ChangePropertyControl.xaml.cs b/samples/CS/XAMLBehaviorsSample/ChangePropertyControl.xaml.cs index 7e277f0..f2bc338 100644 --- a/samples/CS/XAMLBehaviorsSample/ChangePropertyControl.xaml.cs +++ b/samples/CS/XAMLBehaviorsSample/ChangePropertyControl.xaml.cs @@ -1,27 +1,11 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; +using Windows.UI.Xaml.Controls; -// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236 +namespace XAMLBehaviorsSample; -namespace XAMLBehaviorsSample +public sealed partial class ChangePropertyControl : UserControl { - public sealed partial class ChangePropertyControl : UserControl + public ChangePropertyControl() { - public ChangePropertyControl() - { - this.InitializeComponent(); - } + this.InitializeComponent(); } } diff --git a/samples/CS/XAMLBehaviorsSample/ContentDialogPopUp.cs b/samples/CS/XAMLBehaviorsSample/ContentDialogPopUp.cs index d4d6c5b..88c8412 100644 --- a/samples/CS/XAMLBehaviorsSample/ContentDialogPopUp.cs +++ b/samples/CS/XAMLBehaviorsSample/ContentDialogPopUp.cs @@ -1,27 +1,22 @@ using Microsoft.Xaml.Interactivity; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Windows.UI.Xaml; -namespace XAMLBehaviorsSample +namespace XAMLBehaviorsSample; + +class ContentDialogPopUp : DependencyObject, IAction { - class ContentDialogPopUp : DependencyObject, IAction - { - ContentDialogSample samplecd; + ContentDialogSample samplecd; - public object Execute(object sender, object parameter) - { - samplecd = new ContentDialogSample(); - ShowCD(); - return null; - } + public object Execute(object sender, object parameter) + { + samplecd = new ContentDialogSample(); + ShowCD(); + return null; + } - public async void ShowCD() - { - await samplecd.ShowAsync(); - } + public async void ShowCD() + { + await samplecd.ShowAsync(); } } diff --git a/samples/CS/XAMLBehaviorsSample/ContentDialogSample.xaml.cs b/samples/CS/XAMLBehaviorsSample/ContentDialogSample.xaml.cs index 6510243..4639b8c 100644 --- a/samples/CS/XAMLBehaviorsSample/ContentDialogSample.xaml.cs +++ b/samples/CS/XAMLBehaviorsSample/ContentDialogSample.xaml.cs @@ -1,32 +1,16 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; +using Windows.UI.Xaml.Controls; -// The Content Dialog item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 +namespace XAMLBehaviorsSample; -namespace XAMLBehaviorsSample +public sealed partial class ContentDialogSample : ContentDialog { - public sealed partial class ContentDialogSample : ContentDialog + public ContentDialogSample() { - public ContentDialogSample() - { - this.InitializeComponent(); - } + this.InitializeComponent(); + } - private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) - { - this.Hide(); - } + private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) + { + this.Hide(); } } diff --git a/samples/CS/XAMLBehaviorsSample/ControlStoryboardControl.xaml.cs b/samples/CS/XAMLBehaviorsSample/ControlStoryboardControl.xaml.cs index 9d915b7..89814e4 100644 --- a/samples/CS/XAMLBehaviorsSample/ControlStoryboardControl.xaml.cs +++ b/samples/CS/XAMLBehaviorsSample/ControlStoryboardControl.xaml.cs @@ -1,27 +1,11 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; +using Windows.UI.Xaml.Controls; -// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236 +namespace XAMLBehaviorsSample; -namespace XAMLBehaviorsSample +public sealed partial class ControlStoryboardControl : UserControl { - public sealed partial class ControlStoryboardControl : UserControl + public ControlStoryboardControl() { - public ControlStoryboardControl() - { - this.InitializeComponent(); - } + this.InitializeComponent(); } } diff --git a/samples/CS/XAMLBehaviorsSample/CustomActionControl.xaml.cs b/samples/CS/XAMLBehaviorsSample/CustomActionControl.xaml.cs index 5de83a9..083fa75 100644 --- a/samples/CS/XAMLBehaviorsSample/CustomActionControl.xaml.cs +++ b/samples/CS/XAMLBehaviorsSample/CustomActionControl.xaml.cs @@ -1,27 +1,11 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; +using Windows.UI.Xaml.Controls; -// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236 +namespace XAMLBehaviorsSample; -namespace XAMLBehaviorsSample +public sealed partial class CustomActionControl : UserControl { - public sealed partial class CustomActionControl : UserControl + public CustomActionControl() { - public CustomActionControl() - { - this.InitializeComponent(); - } + this.InitializeComponent(); } } diff --git a/samples/CS/XAMLBehaviorsSample/CustomBehaviorControl.xaml.cs b/samples/CS/XAMLBehaviorsSample/CustomBehaviorControl.xaml.cs index 7371163..8c2a268 100644 --- a/samples/CS/XAMLBehaviorsSample/CustomBehaviorControl.xaml.cs +++ b/samples/CS/XAMLBehaviorsSample/CustomBehaviorControl.xaml.cs @@ -1,27 +1,11 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; +using Windows.UI.Xaml.Controls; -// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236 +namespace XAMLBehaviorsSample; -namespace XAMLBehaviorsSample +public sealed partial class CustomBehaviorControl : UserControl { - public sealed partial class CustomBehaviorControl : UserControl + public CustomBehaviorControl() { - public CustomBehaviorControl() - { - this.InitializeComponent(); - } + this.InitializeComponent(); } } diff --git a/samples/CS/XAMLBehaviorsSample/DataTriggerControl.xaml.cs b/samples/CS/XAMLBehaviorsSample/DataTriggerControl.xaml.cs index 9f228cb..699ddb3 100644 --- a/samples/CS/XAMLBehaviorsSample/DataTriggerControl.xaml.cs +++ b/samples/CS/XAMLBehaviorsSample/DataTriggerControl.xaml.cs @@ -1,27 +1,11 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; +using Windows.UI.Xaml.Controls; -// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236 +namespace XAMLBehaviorsSample; -namespace XAMLBehaviorsSample +public sealed partial class DataTriggerControl : UserControl { - public sealed partial class DataTriggerControl : UserControl + public DataTriggerControl() { - public DataTriggerControl() - { - this.InitializeComponent(); - } + this.InitializeComponent(); } } diff --git a/samples/CS/XAMLBehaviorsSample/DragPositionBehavior.cs b/samples/CS/XAMLBehaviorsSample/DragPositionBehavior.cs index 5439995..ae03bb6 100644 --- a/samples/CS/XAMLBehaviorsSample/DragPositionBehavior.cs +++ b/samples/CS/XAMLBehaviorsSample/DragPositionBehavior.cs @@ -1,83 +1,77 @@ using Microsoft.Xaml.Interactivity; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Windows.Foundation; using Windows.UI.Xaml; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; -namespace XAMLBehaviorsSample +namespace XAMLBehaviorsSample; + +public class DragPositionBehavior : DependencyObject, IBehavior { - public class DragPositionBehavior : DependencyObject, IBehavior + public DependencyObject AssociatedObject { - public DependencyObject AssociatedObject - { - get; - set; - } + get; + set; + } - public void Attach(DependencyObject associatedObject) + public void Attach(DependencyObject associatedObject) + { + if ((associatedObject != AssociatedObject) && !Windows.ApplicationModel.DesignMode.DesignModeEnabled) { - if ((associatedObject != AssociatedObject) && !Windows.ApplicationModel.DesignMode.DesignModeEnabled) + AssociatedObject = associatedObject; + var fe = AssociatedObject as FrameworkElement; + if (fe != null) { - AssociatedObject = associatedObject; - var fe = AssociatedObject as FrameworkElement; - if (fe != null) - { - fe.PointerPressed += fe_PointerPressed; - fe.PointerReleased += fe_PointerReleased; - } + fe.PointerPressed += fe_PointerPressed; + fe.PointerReleased += fe_PointerReleased; } } + } - UIElement parent = null; - Point prevPoint; - int pointerId = -1; - void fe_PointerPressed(object sender, PointerRoutedEventArgs e) - { - var fe = AssociatedObject as FrameworkElement; - parent = (UIElement)fe.Parent; + UIElement parent = null; + Point prevPoint; + int pointerId = -1; + void fe_PointerPressed(object sender, PointerRoutedEventArgs e) + { + var fe = AssociatedObject as FrameworkElement; + parent = (UIElement)fe.Parent; - if (!(fe.RenderTransform is TranslateTransform)) - fe.RenderTransform = new TranslateTransform(); - prevPoint = e.GetCurrentPoint(parent).Position; - parent.PointerMoved += move; - pointerId = (int)e.Pointer.PointerId; - } + if (!(fe.RenderTransform is TranslateTransform)) + fe.RenderTransform = new TranslateTransform(); + prevPoint = e.GetCurrentPoint(parent).Position; + parent.PointerMoved += move; + pointerId = (int)e.Pointer.PointerId; + } - private void move(object o, PointerRoutedEventArgs args) - { - if (args.Pointer.PointerId != pointerId) - return; + private void move(object o, PointerRoutedEventArgs args) + { + if (args.Pointer.PointerId != pointerId) + return; - var fe = AssociatedObject as FrameworkElement; - var pos = args.GetCurrentPoint(parent).Position; - var tr = (TranslateTransform)fe.RenderTransform; - tr.X += pos.X - prevPoint.X; - tr.Y += pos.Y - prevPoint.Y; - prevPoint = pos; - } - void fe_PointerReleased(object sender, PointerRoutedEventArgs e) - { - var fe = AssociatedObject as FrameworkElement; - if (e.Pointer.PointerId != pointerId) - return; - parent.PointerMoved -= move; - pointerId = -1; - } - public void Detach() + var fe = AssociatedObject as FrameworkElement; + var pos = args.GetCurrentPoint(parent).Position; + var tr = (TranslateTransform)fe.RenderTransform; + tr.X += pos.X - prevPoint.X; + tr.Y += pos.Y - prevPoint.Y; + prevPoint = pos; + } + void fe_PointerReleased(object sender, PointerRoutedEventArgs e) + { + var fe = AssociatedObject as FrameworkElement; + if (e.Pointer.PointerId != pointerId) + return; + parent.PointerMoved -= move; + pointerId = -1; + } + public void Detach() + { + var fe = AssociatedObject as FrameworkElement; + if (fe != null) { - var fe = AssociatedObject as FrameworkElement; - if (fe != null) - { - fe.PointerPressed -= fe_PointerPressed; - fe.PointerReleased -= fe_PointerReleased; - } - parent = null; - AssociatedObject = null; + fe.PointerPressed -= fe_PointerPressed; + fe.PointerReleased -= fe_PointerReleased; } + parent = null; + AssociatedObject = null; } } diff --git a/samples/CS/XAMLBehaviorsSample/EventTriggerControl.xaml.cs b/samples/CS/XAMLBehaviorsSample/EventTriggerControl.xaml.cs index 5f7a2a5..b127453 100644 --- a/samples/CS/XAMLBehaviorsSample/EventTriggerControl.xaml.cs +++ b/samples/CS/XAMLBehaviorsSample/EventTriggerControl.xaml.cs @@ -1,27 +1,11 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; +using Windows.UI.Xaml.Controls; -// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236 +namespace XAMLBehaviorsSample; -namespace XAMLBehaviorsSample +public sealed partial class EventTriggerControl : UserControl { - public sealed partial class EventTriggerControl : UserControl + public EventTriggerControl() { - public EventTriggerControl() - { - this.InitializeComponent(); - } + this.InitializeComponent(); } } diff --git a/samples/CS/XAMLBehaviorsSample/GoToStateControl.xaml.cs b/samples/CS/XAMLBehaviorsSample/GoToStateControl.xaml.cs index 4d133b5..9c5b837 100644 --- a/samples/CS/XAMLBehaviorsSample/GoToStateControl.xaml.cs +++ b/samples/CS/XAMLBehaviorsSample/GoToStateControl.xaml.cs @@ -1,27 +1,11 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; +using Windows.UI.Xaml.Controls; -// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236 +namespace XAMLBehaviorsSample; -namespace XAMLBehaviorsSample +public sealed partial class GoToStateControl : UserControl { - public sealed partial class GoToStateControl : UserControl + public GoToStateControl() { - public GoToStateControl() - { - this.InitializeComponent(); - } + this.InitializeComponent(); } } diff --git a/samples/CS/XAMLBehaviorsSample/IncrementalUpdateControl.xaml.cs b/samples/CS/XAMLBehaviorsSample/IncrementalUpdateControl.xaml.cs index 6a5d9d0..5deb1ea 100644 --- a/samples/CS/XAMLBehaviorsSample/IncrementalUpdateControl.xaml.cs +++ b/samples/CS/XAMLBehaviorsSample/IncrementalUpdateControl.xaml.cs @@ -1,47 +1,32 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; +using System.Collections.Generic; using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; -// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236 +namespace XAMLBehaviorsSample; -namespace XAMLBehaviorsSample +public sealed partial class IncrementalUpdateControl : UserControl { - public sealed partial class IncrementalUpdateControl : UserControl + public List Items; + public IncrementalUpdateControl() { - public List Items; - public IncrementalUpdateControl() + this.InitializeComponent(); + Items = new List(); + gridViewSample.ItemsSource = Items; + for(int i = 1; i <= 100; i++) { - this.InitializeComponent(); - Items = new List(); - gridViewSample.ItemsSource = Items; - for(int i = 1; i <= 100; i++) - { - Items.Add(new ItemSample(i)); - } + Items.Add(new ItemSample(i)); } } +} - public class ItemSample +public class ItemSample +{ + public int Count { get; set; } + public ItemSample() { - public int Count { get; set; } - public ItemSample() - { - Count = 0; - } - public ItemSample(int i) - { - Count = i; - } + Count = 0; + } + public ItemSample(int i) + { + Count = i; } } diff --git a/samples/CS/XAMLBehaviorsSample/InvokeCommandControl.xaml.cs b/samples/CS/XAMLBehaviorsSample/InvokeCommandControl.xaml.cs index a6bc0d0..9720176 100644 --- a/samples/CS/XAMLBehaviorsSample/InvokeCommandControl.xaml.cs +++ b/samples/CS/XAMLBehaviorsSample/InvokeCommandControl.xaml.cs @@ -1,88 +1,74 @@ using System; -using System.Collections.Generic; using System.ComponentModel; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; using System.Windows.Input; -using Windows.Foundation; -using Windows.Foundation.Collections; using Windows.UI; -using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; -// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236 +namespace XAMLBehaviorsSample; -namespace XAMLBehaviorsSample +public sealed partial class InvokeCommandControl : UserControl, INotifyPropertyChanged { - public sealed partial class InvokeCommandControl : UserControl, INotifyPropertyChanged + public int Count { get; set; } + public event PropertyChangedEventHandler PropertyChanged; + public SolidColorBrush darkgreybrush; + public SolidColorBrush pinkbrush; + + public class SampleCommand : ICommand { - public int Count { get; set; } - public event PropertyChangedEventHandler PropertyChanged; - public SolidColorBrush darkgreybrush; - public SolidColorBrush pinkbrush; + public event EventHandler CanExecuteChanged; - public class SampleCommand : ICommand + public bool CanExecute(object parameter) { - public event EventHandler CanExecuteChanged; - - public bool CanExecute(object parameter) - { - return true; - } + return true; + } - public void Execute(object parameter) - { - CanExecuteChanged(null, null); - } + public void Execute(object parameter) + { + CanExecuteChanged(null, null); } + } - public ICommand UpdateCountCommand { get; set; } - public ICommand UpdateGreyCommand { get; set; } - public ICommand UpdatePinkCommand { get; set; } + public ICommand UpdateCountCommand { get; set; } + public ICommand UpdateGreyCommand { get; set; } + public ICommand UpdatePinkCommand { get; set; } - public InvokeCommandControl() - { - this.InitializeComponent(); - UpdateCountCommand = new SampleCommand(); - UpdateGreyCommand = new SampleCommand(); - UpdatePinkCommand = new SampleCommand(); + public InvokeCommandControl() + { + this.InitializeComponent(); + UpdateCountCommand = new SampleCommand(); + UpdateGreyCommand = new SampleCommand(); + UpdatePinkCommand = new SampleCommand(); - this.UpdateCountCommand.CanExecuteChanged += UpdateCountCommand_CanExecuteChanged; - this.UpdateGreyCommand.CanExecuteChanged += UpdateGreyCommand_CanExecuteChanged; - this.UpdatePinkCommand.CanExecuteChanged += UpdatePinkCommand_CanExecuteChanged; + this.UpdateCountCommand.CanExecuteChanged += UpdateCountCommand_CanExecuteChanged; + this.UpdateGreyCommand.CanExecuteChanged += UpdateGreyCommand_CanExecuteChanged; + this.UpdatePinkCommand.CanExecuteChanged += UpdatePinkCommand_CanExecuteChanged; - this.DataContext = this; - darkgreybrush = new SolidColorBrush(); - darkgreybrush.Color = Color.FromArgb(255, 51, 51, 50); - pinkbrush = new SolidColorBrush(); - pinkbrush.Color = Color.FromArgb(255, 233, 95, 91); - } + this.DataContext = this; + darkgreybrush = new SolidColorBrush(); + darkgreybrush.Color = Color.FromArgb(255, 51, 51, 50); + pinkbrush = new SolidColorBrush(); + pinkbrush.Color = Color.FromArgb(255, 233, 95, 91); + } - private void UpdateCountCommand_CanExecuteChanged(object sender, EventArgs e) - { - Count++; - OnPropertyChanged(nameof(Count)); - } + private void UpdateCountCommand_CanExecuteChanged(object sender, EventArgs e) + { + Count++; + OnPropertyChanged(nameof(Count)); + } - private void UpdateGreyCommand_CanExecuteChanged(object sender, EventArgs e) - { - border.Background = darkgreybrush; - } + private void UpdateGreyCommand_CanExecuteChanged(object sender, EventArgs e) + { + border.Background = darkgreybrush; + } - private void UpdatePinkCommand_CanExecuteChanged(object sender, EventArgs e) - { - border.Background = pinkbrush; - } + private void UpdatePinkCommand_CanExecuteChanged(object sender, EventArgs e) + { + border.Background = pinkbrush; + } - private void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + private void OnPropertyChanged(string propertyName) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } diff --git a/samples/CS/XAMLBehaviorsSample/MainPage.xaml.cs b/samples/CS/XAMLBehaviorsSample/MainPage.xaml.cs index 5ba0142..551f1e9 100644 --- a/samples/CS/XAMLBehaviorsSample/MainPage.xaml.cs +++ b/samples/CS/XAMLBehaviorsSample/MainPage.xaml.cs @@ -1,151 +1,139 @@ using System; -using System.Collections.Generic; -using System.IO; using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; -// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409 +namespace XAMLBehaviorsSample; -namespace XAMLBehaviorsSample +/// +/// An empty page that can be used on its own or navigated to within a Frame. +/// +public sealed partial class MainPage : Page { - /// - /// An empty page that can be used on its own or navigated to within a Frame. - /// - public sealed partial class MainPage : Page + DataTriggerControl _datatrigger; + EventTriggerControl _eventtrigger; + IncrementalUpdateControl _incrementaltrigger; + + CallMethodControl _callmethodaction; + GoToStateControl _gotostateaction; + ChangePropertyControl _changepropertyaction; + ControlStoryboardControl _controlstoryboardaction; + PlaySoundControl _playsoundaction; + NavigateToPageControl _navigatetopageaction; + InvokeCommandControl _invokecommandaction; + + CustomBehaviorControl _custombehavioraction; + CustomActionControl _customactionaction; + + public MainPage() { - DataTriggerControl _datatrigger; - EventTriggerControl _eventtrigger; - IncrementalUpdateControl _incrementaltrigger; - - CallMethodControl _callmethodaction; - GoToStateControl _gotostateaction; - ChangePropertyControl _changepropertyaction; - ControlStoryboardControl _controlstoryboardaction; - PlaySoundControl _playsoundaction; - NavigateToPageControl _navigatetopageaction; - InvokeCommandControl _invokecommandaction; - - CustomBehaviorControl _custombehavioraction; - CustomActionControl _customactionaction; - - public MainPage() - { - this.InitializeComponent(); - - _datatrigger = new DataTriggerControl(); - _eventtrigger = new EventTriggerControl(); - _incrementaltrigger = new IncrementalUpdateControl(); - - _callmethodaction = new CallMethodControl(); - _gotostateaction = new GoToStateControl(); - _changepropertyaction = new ChangePropertyControl(); - _controlstoryboardaction = new ControlStoryboardControl(); - _playsoundaction = new PlaySoundControl(); - _navigatetopageaction = new NavigateToPageControl(); - _invokecommandaction = new InvokeCommandControl(); - - _custombehavioraction = new CustomBehaviorControl(); - _customactionaction = new CustomActionControl(); - } + this.InitializeComponent(); + + _datatrigger = new DataTriggerControl(); + _eventtrigger = new EventTriggerControl(); + _incrementaltrigger = new IncrementalUpdateControl(); + + _callmethodaction = new CallMethodControl(); + _gotostateaction = new GoToStateControl(); + _changepropertyaction = new ChangePropertyControl(); + _controlstoryboardaction = new ControlStoryboardControl(); + _playsoundaction = new PlaySoundControl(); + _navigatetopageaction = new NavigateToPageControl(); + _invokecommandaction = new InvokeCommandControl(); + + _custombehavioraction = new CustomBehaviorControl(); + _customactionaction = new CustomActionControl(); + } - private bool CheckLastPage(Type desiredPage) - { - var lastPage = Frame.BackStack.LastOrDefault(); - return (lastPage != null && lastPage.SourcePageType.Equals(desiredPage)) ? true : false; - } + private bool CheckLastPage(Type desiredPage) + { + var lastPage = Frame.BackStack.LastOrDefault(); + return (lastPage != null && lastPage.SourcePageType.Equals(desiredPage)) ? true : false; + } - protected override void OnNavigatedTo(NavigationEventArgs e) - { - base.OnNavigatedTo(e); - - if(CheckLastPage(typeof (NavigatePageSample))) - { - pivot.SelectedIndex = 1; - ActionsContent.Children.Clear(); - ActionsContent.Children.Add(_navigatetopageaction); - } - } + protected override void OnNavigatedTo(NavigationEventArgs e) + { + base.OnNavigatedTo(e); - private void DataTriggerButton_Click(object sender, RoutedEventArgs e) + if(CheckLastPage(typeof (NavigatePageSample))) { - BehaviorsContent.Children.Clear(); - BehaviorsContent.Children.Add(_datatrigger); + pivot.SelectedIndex = 1; + ActionsContent.Children.Clear(); + ActionsContent.Children.Add(_navigatetopageaction); } + } - private void EventTriggerButton_Click(object sender, RoutedEventArgs e) - { - _eventtrigger = new EventTriggerControl(); - BehaviorsContent.Children.Clear(); - BehaviorsContent.Children.Add(_eventtrigger); - } + private void DataTriggerButton_Click(object sender, RoutedEventArgs e) + { + BehaviorsContent.Children.Clear(); + BehaviorsContent.Children.Add(_datatrigger); + } - private void IncrementalUpdateButton_Click(object sender, RoutedEventArgs e) - { - BehaviorsContent.Children.Clear(); - BehaviorsContent.Children.Add(_incrementaltrigger); - } + private void EventTriggerButton_Click(object sender, RoutedEventArgs e) + { + _eventtrigger = new EventTriggerControl(); + BehaviorsContent.Children.Clear(); + BehaviorsContent.Children.Add(_eventtrigger); + } - private void CallMethodButton_Click(object sender, RoutedEventArgs e) - { - ActionsContent.Children.Clear(); - ActionsContent.Children.Add(_callmethodaction); - } + private void IncrementalUpdateButton_Click(object sender, RoutedEventArgs e) + { + BehaviorsContent.Children.Clear(); + BehaviorsContent.Children.Add(_incrementaltrigger); + } - private void ChangePropertyButton_Click(object sender, RoutedEventArgs e) - { - ActionsContent.Children.Clear(); - ActionsContent.Children.Add(_changepropertyaction); - } + private void CallMethodButton_Click(object sender, RoutedEventArgs e) + { + ActionsContent.Children.Clear(); + ActionsContent.Children.Add(_callmethodaction); + } - private void ControlStoryboardButton_Click(object sender, RoutedEventArgs e) - { - ActionsContent.Children.Clear(); - ActionsContent.Children.Add(_controlstoryboardaction); - } + private void ChangePropertyButton_Click(object sender, RoutedEventArgs e) + { + ActionsContent.Children.Clear(); + ActionsContent.Children.Add(_changepropertyaction); + } - private void PlaySoundButton_Click(object sender, RoutedEventArgs e) - { - ActionsContent.Children.Clear(); - ActionsContent.Children.Add(_playsoundaction); - } + private void ControlStoryboardButton_Click(object sender, RoutedEventArgs e) + { + ActionsContent.Children.Clear(); + ActionsContent.Children.Add(_controlstoryboardaction); + } - private void GoToStateButton_Click(object sender, RoutedEventArgs e) - { - ActionsContent.Children.Clear(); - ActionsContent.Children.Add(_gotostateaction); - } + private void PlaySoundButton_Click(object sender, RoutedEventArgs e) + { + ActionsContent.Children.Clear(); + ActionsContent.Children.Add(_playsoundaction); + } - private void InvokeCommandButton_Click(object sender, RoutedEventArgs e) - { - ActionsContent.Children.Clear(); - ActionsContent.Children.Add(_invokecommandaction); - } + private void GoToStateButton_Click(object sender, RoutedEventArgs e) + { + ActionsContent.Children.Clear(); + ActionsContent.Children.Add(_gotostateaction); + } - private void NavigateToPageButton_Click(object sender, RoutedEventArgs e) - { - ActionsContent.Children.Clear(); - ActionsContent.Children.Add(_navigatetopageaction); - } + private void InvokeCommandButton_Click(object sender, RoutedEventArgs e) + { + ActionsContent.Children.Clear(); + ActionsContent.Children.Add(_invokecommandaction); + } - private void CustomBehavior_Click(object sender, RoutedEventArgs e) - { - CustomContent.Children.Clear(); - CustomContent.Children.Add(_custombehavioraction); - } + private void NavigateToPageButton_Click(object sender, RoutedEventArgs e) + { + ActionsContent.Children.Clear(); + ActionsContent.Children.Add(_navigatetopageaction); + } - private void CustomAction_Click(object sender, RoutedEventArgs e) - { - CustomContent.Children.Clear(); - CustomContent.Children.Add(_customactionaction); - } + private void CustomBehavior_Click(object sender, RoutedEventArgs e) + { + CustomContent.Children.Clear(); + CustomContent.Children.Add(_custombehavioraction); + } + + private void CustomAction_Click(object sender, RoutedEventArgs e) + { + CustomContent.Children.Clear(); + CustomContent.Children.Add(_customactionaction); } } diff --git a/samples/CS/XAMLBehaviorsSample/NavigatePageSample.xaml.cs b/samples/CS/XAMLBehaviorsSample/NavigatePageSample.xaml.cs index 2ab893c..52f2eb0 100644 --- a/samples/CS/XAMLBehaviorsSample/NavigatePageSample.xaml.cs +++ b/samples/CS/XAMLBehaviorsSample/NavigatePageSample.xaml.cs @@ -1,30 +1,14 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; +using Windows.UI.Xaml.Controls; -// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 +namespace XAMLBehaviorsSample; -namespace XAMLBehaviorsSample +/// +/// An empty page that can be used on its own or navigated to within a Frame. +/// +public sealed partial class NavigatePageSample : Page { - /// - /// An empty page that can be used on its own or navigated to within a Frame. - /// - public sealed partial class NavigatePageSample : Page + public NavigatePageSample() { - public NavigatePageSample() - { - this.InitializeComponent(); - } + this.InitializeComponent(); } } diff --git a/samples/CS/XAMLBehaviorsSample/NavigateToPageControl.xaml.cs b/samples/CS/XAMLBehaviorsSample/NavigateToPageControl.xaml.cs index a24fd94..39e009f 100644 --- a/samples/CS/XAMLBehaviorsSample/NavigateToPageControl.xaml.cs +++ b/samples/CS/XAMLBehaviorsSample/NavigateToPageControl.xaml.cs @@ -1,27 +1,11 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; +using Windows.UI.Xaml.Controls; -// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236 +namespace XAMLBehaviorsSample; -namespace XAMLBehaviorsSample +public sealed partial class NavigateToPageControl : UserControl { - public sealed partial class NavigateToPageControl : UserControl + public NavigateToPageControl() { - public NavigateToPageControl() - { - this.InitializeComponent(); - } + this.InitializeComponent(); } } diff --git a/samples/CS/XAMLBehaviorsSample/PlaySoundControl.xaml.cs b/samples/CS/XAMLBehaviorsSample/PlaySoundControl.xaml.cs index 5081d09..5eedd3e 100644 --- a/samples/CS/XAMLBehaviorsSample/PlaySoundControl.xaml.cs +++ b/samples/CS/XAMLBehaviorsSample/PlaySoundControl.xaml.cs @@ -1,27 +1,11 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; +using Windows.UI.Xaml.Controls; -// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236 +namespace XAMLBehaviorsSample; -namespace XAMLBehaviorsSample +public sealed partial class PlaySoundControl : UserControl { - public sealed partial class PlaySoundControl : UserControl + public PlaySoundControl() { - public PlaySoundControl() - { - this.InitializeComponent(); - } + this.InitializeComponent(); } } diff --git a/samples/CS/XAMLBehaviorsSample/XAMLBehaviorsSample.csproj b/samples/CS/XAMLBehaviorsSample/XAMLBehaviorsSample.csproj index f4e458f..34dece8 100644 --- a/samples/CS/XAMLBehaviorsSample/XAMLBehaviorsSample.csproj +++ b/samples/CS/XAMLBehaviorsSample/XAMLBehaviorsSample.csproj @@ -18,6 +18,7 @@ 512 {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} win10-x86;win10-x86-aot;win10-x64;win10-x64-aot + 12.0 true From c6dd32c6b56c09ff29f8a72b954fa7ff8f92024e Mon Sep 17 00:00:00 2001 From: Michael Hawker <24302614+michael-hawker@users.noreply.github.com> Date: Wed, 20 Nov 2024 13:58:38 -0800 Subject: [PATCH 6/6] Update CI workflow stepe names for Samples --- .github/workflows/managed-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/managed-build.yml b/.github/workflows/managed-build.yml index f30536e..c4961bf 100644 --- a/.github/workflows/managed-build.yml +++ b/.github/workflows/managed-build.yml @@ -58,10 +58,10 @@ jobs: with: nuget-version: '6.11.0' - - name: NuGet Restore BehaviorsSDKManaged.sln + - name: NuGet Restore XAMLBehaviorsSample.sln run: nuget restore samples\CS\XAMLBehaviorsSample.sln - - name: Build BehaviorsSDKManaged.sln + - name: Build XAMLBehaviorsSample.sln run: msbuild samples\CS\XAMLBehaviorsSample.sln /p:Configuration=Release -v:diag /bl - name: Upload MSBuild binary log