mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-04 09:06:04 +02:00
* Update article and code projects * Further edits * Fix links * Relocate article & snippets to wpf/properties folder * add toc and redirects * Add acrolinx comment and make a minor edit. * minor Co-authored-by: Andy De George (adegeo) <[email protected]>
49 lines
1.3 KiB
C#
49 lines
1.3 KiB
C#
using System.Windows;
|
|
using System.Windows.Controls;
|
|
|
|
namespace CodeSampleCsharp
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for MainWindow.xaml.
|
|
/// </summary>
|
|
public partial class MainWindow : Window
|
|
{
|
|
public MainWindow()
|
|
{
|
|
InitializeComponent();
|
|
|
|
// <ProceduralPropertySet>
|
|
Button myButton = new();
|
|
myButton.Width = 200.0;
|
|
// </ProceduralPropertySet>
|
|
|
|
// <ProceduralPropertyGet>
|
|
double whatWidth = myButton.Width;
|
|
// </ProceduralPropertyGet>
|
|
}
|
|
|
|
// <DefineDependencyProperty>
|
|
public static readonly DependencyProperty IsSpinningProperty = DependencyProperty.Register(
|
|
"IsSpinning", typeof(bool),
|
|
typeof(MainWindow)
|
|
);
|
|
|
|
public bool IsSpinning
|
|
{
|
|
get => (bool)GetValue(IsSpinningProperty);
|
|
set => SetValue(IsSpinningProperty, value);
|
|
}
|
|
// </DefineDependencyProperty>
|
|
}
|
|
|
|
// <OverrideMetadata>
|
|
public class SpinnerControl : ItemsControl
|
|
{
|
|
static SpinnerControl() => DefaultStyleKeyProperty.OverrideMetadata(
|
|
typeof(SpinnerControl),
|
|
new FrameworkPropertyMetadata(typeof(SpinnerControl))
|
|
);
|
|
}
|
|
// </OverrideMetadata>
|
|
}
|