I am SICK AND TIRED of WPF and all its "if thats dosen't work, try this" fucking fixes ALL THE TIME, well heres one the collection:
I have a Custom Control which uses some PART controls:
[TemplatePart(Name = "PART_TitleTextBox", Type = typeof(TextBox))]
[TemplatePart(Name = "PART_TitleIndexText", Type = typeof(Label))]
[TemplatePart(Name = "PART_TimeCodeInText", Type = typeof(TextBlock))]
[TemplatePart(Name = "PART_TimeCodeOutText", Type = typeof(TextBlock))]
[TemplatePart(Name = "PART_ApprovedImage", Type = typeof(Image))]
[TemplatePart(Name = "PART_CommentsImage", Type = typeof(Image))]
[TemplatePart(Name = "PART_BookmarkedImage", Type = typeof(Image))]
public class TitleBoxNew : Control
{
This control is overriding OnApplyTemplate:
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
InitializeEvents();
}
Which works well, most of the time.. I have added the control inside a custom tab control in a window and somehow OnApplyTemplate is never called for that control! WHY IS WPF SO FUCKING RANDOM!?