Example #1
0
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/MyToolkit.Extended;component/UI/Popups/ListPickerBox.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.list = ((MyToolkit.Controls.ExtendedListBox)(this.FindName("list")));
 }
Example #2
0
		protected async override void OnApplyTemplate()
		{
			base.OnApplyTemplate();

			list = (ExtendedListBox)GetTemplateChild("List");
			content = (ContentControl)GetTemplateChild("Content");

			list.ItemsSource = Items;
			list.SelectionChanged += OnSelectionChanged;
			if (initialItem != null)
				list.SelectedItem = initialItem;
			else
				list.SelectedIndex = initialIndex;

			if (PreloadPivots)
			{
				foreach (var item in Items)
				{
					content.Content = item.Content;
					await Task.Yield(); // TODO find better solution (evtl. hidden content presenter?)
				}
				content.Content = ((PivotItem)list.SelectedItem).Content;
			}
		}