w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
WPF - TreeView - How to programmatically extract the style of a TreeViewItem (selected style)

It sounds like you are trying to set the Style.Trigger too soon, before the template has been applied. If you apply the Trigger after the FrameWorkElement you are targeting has fully loaded you'll probably find that the ItemStyleContainer is no longer null.

http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.loaded.aspx

Implementing OnApplyTemplate for your FrameworkElement should hook you in after the ItemStyleContainer has been set as it is called after the Visual Tree has been rendered.

http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.onapplytemplate.aspx





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.