Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 027b322

Browse files
Exposing Advisor as a dependency property
1 parent 2911b35 commit 027b322

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/GitHub.UI/Controls/AutoCompleteBox/AutoCompleteBox.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,34 @@ public IAutoCompleteAdvisor Advisor
740740
set;
741741
}
742742

743+
/// <summary>
744+
/// Identifies the
745+
/// <see cref="P:GitHub.UI.AutoCompleteBox.IAutoCompleteAdvisor" />
746+
/// dependency property.
747+
/// </summary>
748+
/// <value>The identifier for the
749+
/// <see cref="P:GitHub.UI.AutoCompleteBox.IAutoCompleteAdvisor" />
750+
/// dependency property.</value>
751+
public static readonly DependencyProperty AdvisorProperty =
752+
DependencyProperty.Register(
753+
"Advisor",
754+
typeof(IAutoCompleteAdvisor),
755+
typeof(AutoCompleteBox),
756+
new PropertyMetadata(null, OnAdvisorPropertyChanged));
757+
758+
/// <summary>
759+
/// AdvisorProperty property changed handler.
760+
/// </summary>
761+
/// <param name="d">AutoCompleteBox that changed its Advisor.</param>
762+
/// <param name="e">Event arguments.</param>
763+
private static void OnAdvisorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
764+
{
765+
var source = d as AutoCompleteBox;
766+
if (source == null) return;
767+
768+
source.Advisor = (IAutoCompleteAdvisor)e.NewValue;
769+
}
770+
743771
/// <summary>
744772
/// Builds the visual tree for the
745773
/// <see cref="GitHub.UI.AutoCompleteBox" /> control

0 commit comments

Comments
 (0)