locked
Access a Flyout inside a DataTemplate

    Question

  • Hi, can you tell me please how to access a Flyout inside a DataTemplate (Windows 8.1) ?
    Saturday, March 1, 2014 1:10 PM

Answers

  • Hi Mnaouar,

    To access into to the DataTemplate, you need the help of VisualTreeHelper.

    Jerry Nixon has a blog named How to access a named control inside a XAML DataTemplate (using CSharp) , should help you find the target control. Hope this helps.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, March 3, 2014 1:49 AM
    Moderator
  • I have seen this blog before and i have based on his solution to find mine . Well, in my case i need first to find the control wich the flyout is attached by using VisualTreeHelper , after that i can access the flyout by using this method FlyoutBase.GetAttachedFlyout(myControl) and finally i can access any control inside the flyout by using the VisualTreeHelper and the content of the flyout.

    Thank you James :)

    Monday, March 3, 2014 3:28 PM

All replies

  • Hi Mnaouar,

    To access into to the DataTemplate, you need the help of VisualTreeHelper.

    Jerry Nixon has a blog named How to access a named control inside a XAML DataTemplate (using CSharp) , should help you find the target control. Hope this helps.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, March 3, 2014 1:49 AM
    Moderator
  • I have seen this blog before and i have based on his solution to find mine . Well, in my case i need first to find the control wich the flyout is attached by using VisualTreeHelper , after that i can access the flyout by using this method FlyoutBase.GetAttachedFlyout(myControl) and finally i can access any control inside the flyout by using the VisualTreeHelper and the content of the flyout.

    Thank you James :)

    Monday, March 3, 2014 3:28 PM