Content update - Add attached property snippet tests (user story 1878471) (#1224)

* Add snippet test and update type

* Add snippet test and update type

* Update to .NET to 6.0

* Update accessor signatures
This commit is contained in:
Tris Shores
2021-12-08 16:26:45 -08:00
committed by GitHub
parent 023dac5e24
commit 71675bec48
5 changed files with 41 additions and 13 deletions
@@ -1,5 +1,5 @@
using System.Windows;
using System.Windows.Controls;
using System.Diagnostics;
using System.Windows;
namespace CodeSampleCsharp
{
@@ -8,11 +8,20 @@ namespace CodeSampleCsharp
/// </summary>
public partial class MainWindow : Window
{
public MainWindow() => InitializeComponent();
public MainWindow()
{
InitializeComponent();
// Test get/set accessors.
Aquarium aquarium = new();
Aquarium.SetHasFish(aquarium, true);
bool hasFish = Aquarium.GetHasFish(aquarium);
Debug.WriteLine($"Has fish: {hasFish}");
}
}
//<RegisterAttachedProperty>
public class Aquarium : DependencyObject
public class Aquarium : UIElement
{
// Register an attached dependency property with the specified
// property name, property type, owner type, and property metadata.