private void UpdateAdorner()
{
if (!string.IsNullOrEmpty(m_ComboBox.Text) ||
m_ComboBox.IsFocused ||
m_ComboBox.IsKeyboardFocused ||
m_ComboBox.IsKeyboardFocusWithin ||
m_ComboBox.SelectedIndex != -1 ||
m_ComboBox.SelectedItem != null)
{
// Hide the Watermark Label if the adorner layer is visible
m_ComboBox.ToolTip = GetLabel(m_ComboBox);
m_ComboBox.TryRemoveAdorners<TextBlockAdorner>();
}
else
{
// Show the Watermark Label if the adorner layer is visible
m_ComboBox.ToolTip = null;
m_ComboBox.TryAddAdorner<TextBlockAdorner>(m_TextBlockAdorner);
}
}