/// <summary> /// When overridden in a derived class, is invoked whenever application code or internal processes call <see cref="M:System.Windows.FrameworkElement.ApplyTemplate"/>. /// </summary> public override void OnApplyTemplate() { _flashOn = (Template.Resources["FlashOn"] as Storyboard).Clone(); _flashOn.Completed += Flash_Completed; _flashOff = (Template.Resources["FlashOff"] as Storyboard).Clone(); _largeImage = GetTemplateChild("PART_LargeImage") as LargeImage; _largeNews = GetTemplateChild("PART_LargeNews") as LargeNews; _largeTweet = GetTemplateChild("PART_LargeTweet") as LargeTweet; _smallImage = GetTemplateChild("PART_SmallImage") as SmallImage; _smallNews = GetTemplateChild("PART_SmallNews") as SmallNews; _smallTweet = GetTemplateChild("PART_SmallTweet") as SmallTweet; base.OnApplyTemplate(); }
/// <summary> /// When overridden in a derived class, is invoked whenever application code or internal processes call <see cref="M:System.Windows.FrameworkElement.ApplyTemplate"/>. /// </summary> public override void OnApplyTemplate() { _smallImage = GetTemplateChild("PART_SmallImage") as SmallImage; _smallNews = GetTemplateChild("PART_SmallNews") as SmallNews; _smallTweet = GetTemplateChild("PART_SmallTweet") as SmallTweet; _banBtn = GetTemplateChild("PART_BanBtn") as SurfaceButton; _deleteBtn = GetTemplateChild("PART_DeleteBtn") as SurfaceButton; _banBtn.Click += AdminBtn_Click; _deleteBtn.Click += AdminBtn_Click; _breaking = (Template.Resources["Breaking"] as Storyboard).Clone(); _parentProxy = this.FindVisualParent <ItemProxy>(); if (_parentProxy != null) { _smallImage.Image.ImageLoaded += (sender, e) => _parentProxy.IsEnabled = true; } base.OnApplyTemplate(); }