Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
94
Creating template column programmatically
posted

Hi, I need to create template column programmatically. Is it possible to create template column programmatically without using XmlReader? I need event handler for template column control. So I don’t prefer XmlReader.

Parents
No Data
Reply
  • 40030
    Offline posted

    Hi, 

    So, the only other way would be to predefine the DataTemplate in a Resource Dictionary. However, this won't help with your EventHandler issue. 

    The best way to approach this would probably be through commands or bindings with converters. 

    However if thats not an option, i suppose you could use the CellControlAttached event and get a handle of the control and add an event handler. 

    Note:  the grid recycles all elements, so you should make sure to always unhook the event handler before attaching a new one. 

    -SteveZ

Children