public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/Map;component/Settings.xaml", System.UriKind.Relative)); this.btSave_AB = ((Microsoft.Phone.Shell.ApplicationBarIconButton)(this.FindName("btSave_AB"))); this.btCancel_AB = ((Microsoft.Phone.Shell.ApplicationBarIconButton)(this.FindName("btCancel_AB"))); this.btDefault_AB = ((Microsoft.Phone.Shell.ApplicationBarIconButton)(this.FindName("btDefault_AB"))); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel"))); this.rdbtLangUS = ((System.Windows.Controls.RadioButton)(this.FindName("rdbtLangUS"))); this.rdbtLangVN = ((System.Windows.Controls.RadioButton)(this.FindName("rdbtLangVN"))); this.cbx3DObjects = ((System.Windows.Controls.CheckBox)(this.FindName("cbx3DObjects"))); this.sldPitchLevel = ((System.Windows.Controls.Slider)(this.FindName("sldPitchLevel"))); this.sldZoomLevel = ((System.Windows.Controls.Slider)(this.FindName("sldZoomLevel"))); this.cbxAutoHeading = ((System.Windows.Controls.CheckBox)(this.FindName("cbxAutoHeading"))); this.tbtnBackup = ((Microsoft.Phone.Controls.Primitives.ToggleSwitchButton)(this.FindName("tbtnBackup"))); }
/// <summary> /// Gets all the template parts and initializes the corresponding state. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); if (!_wasContentSet && GetBindingExpression(ContentProperty) == null) { SetDefaultContent(); } if (_toggleButton != null) { _toggleButton.Checked -= OnChecked; _toggleButton.Unchecked -= OnUnchecked; _toggleButton.Indeterminate -= OnIndeterminate; _toggleButton.Click -= OnClick; } _toggleButton = GetTemplateChild(SwitchPart) as ToggleSwitchButton; if (_toggleButton != null) { _toggleButton.Checked += OnChecked; _toggleButton.Unchecked += OnUnchecked; _toggleButton.Indeterminate += OnIndeterminate; _toggleButton.Click += OnClick; _toggleButton.IsChecked = IsChecked; } IsEnabledChanged += delegate { ChangeVisualState(true); }; var content = this.GetTemplateChild("Content") as ContentControl; ChangeVisualState(false); }