locked
How to set button's AutomationProperties.Name from code-behind ? RRS feed

  • Question

  • My button is having style "AppBarButtonStyle", I want to change it's AutomationProperties.Name from code-behind, how can I do this ?
    • Edited by Xyroid Monday, September 3, 2012 6:04 AM
    Monday, September 3, 2012 6:03 AM

Answers

  • Hi,

    You could try this:

    this.btn.SetValue(AutomationProperties.NameProperty, "this is a button.");

    Hope this helps


    Aaron Xue [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Xyroid Monday, September 3, 2012 7:21 AM
    Monday, September 3, 2012 7:06 AM