protected override void OnApplyTemplate() { base.OnApplyTemplate(); _captureElement = GetTemplateChild(CaptureElementName) as CaptureElement; _webCamSelectorPopup = GetTemplateChild(WebCamSelectorPopupName) as Popup; _webCamSelector = GetTemplateChild(WebCamSelectorName) as Selector; _recordingIndicator = GetTemplateChild(RecordingIndicatorName) as LayoutPanel; _recordingAnimation = GetTemplateChild(RecordingAnimationName) as Storyboard; _countdownControl = GetTemplateChild(CountdownControlName) as CountdownControl; _flashAnimation = GetTemplateChild(FlashAnimationName) as Storyboard; }
/// <summary> /// Invoked whenever application code or internal processes (such as a rebuilding layout pass) call ApplyTemplate. /// In simplest terms, this means the method is called just before a UI element displays in your app. /// Override this method to influence the default post-template logic of a class. /// </summary> protected override void OnApplyTemplate() { base.OnApplyTemplate(); _captureElement = (CaptureElement)GetTemplateChild(CaptureElementName); if (MediaCapture != null) { _captureElement.Source = MediaCapture; } _webCamSelectorPopup = GetTemplateChild(WebCamSelectorPopupName) as Popup; _webCamSelector = GetTemplateChild(WebCamSelectorName) as Selector; _recordingIndicator = GetTemplateChild(RecordingIndicatorName) as LayoutPanel; _recordingAnimation = GetTemplateChild(RecordingAnimationName) as Storyboard; _countdownControl = GetTemplateChild(CountdownControlName) as CountdownControl; _flashAnimation = GetTemplateChild(FlashAnimationName) as Storyboard; }