File tree Expand file tree Collapse file tree
hub/apps/develop/windows-integration Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -92,6 +92,43 @@ protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs ar
9292}
9393```
9494
95+ ### Implement a helper property for tracking the Copilot Key pressed state
96+
97+ ``` csharp
98+ public event PropertyChangedEventHandler ? PropertyChanged ;
99+
100+ private void OnPropertyChanged ([CallerMemberName ] string propertyName = " State" )
101+ {
102+ PropertyChanged ? .Invoke (this , new PropertyChangedEventArgs (propertyName ));
103+ }
104+
105+
106+ public void SetState (string state )
107+ {
108+ State = state ;
109+ }
110+
111+ private string _state ;
112+ public string State
113+ {
114+ get => _state ;
115+ set
116+ {
117+ if (_state != value )
118+ {
119+ _state = value ;
120+ OnPropertyChanged ();
121+ }
122+ }
123+ }
124+ ```
125+
126+ ``` xaml
127+ <StackPanel Orientation =" Horizontal" HorizontalAlignment =" Center" VerticalAlignment =" Center" >
128+ <TextBlock Name =" KeyStateText" Text =" {x:Bind State, Mode=OneWay}" />
129+ </StackPanel >
130+ ```
131+
95132## Handle fast path invocation
96133
97134``` xml
@@ -403,42 +440,6 @@ ref Guid riid,
403440 [Out (), MarshalAs (UnmanagedType .Interface )] out IPropertyStore propertyStore );
404441```
405442
406- ### Implement a helper property for tracking the Copilot Key pressed state
407-
408- ``` csharp
409- public event PropertyChangedEventHandler ? PropertyChanged ;
410-
411- private void OnPropertyChanged ([CallerMemberName ] string propertyName = " State" )
412- {
413- PropertyChanged ? .Invoke (this , new PropertyChangedEventArgs (propertyName ));
414- }
415-
416-
417- public void SetState (string state )
418- {
419- State = state ;
420- }
421-
422- private string _state ;
423- public string State
424- {
425- get => _state ;
426- set
427- {
428- if (_state != value )
429- {
430- _state = value ;
431- OnPropertyChanged ();
432- }
433- }
434- }
435- ```
436-
437- ``` xaml
438- <StackPanel Orientation =" Horizontal" HorizontalAlignment =" Center" VerticalAlignment =" Center" >
439- <TextBlock Name =" KeyStateText" Text =" {x:Bind State, Mode=OneWay}" />
440- </StackPanel >
441- ```
442443
443444### Register a Window to receive callbacks
444445
You can’t perform that action at this time.
0 commit comments