private void line_Click(object sender, EventArgs e) { isEnabled = false; List <string> items = new List <string>(); items.Add(me.ligne); foreach (Ligne ligne_bus in bus.arrets.lignes) { if (!items.Contains(ligne_bus.ligne)) { items.Add(ligne_bus.ligne); } } ListPicker picker = new ListPicker() { Header = "Lignes", ItemsSource = items, Margin = new Thickness(12, 42, 24, 18), }; picker.SelectionChanged += input_Completed; picker.Loaded += picker_loaded; messageBox = new CustomMessageBox() { Caption = "Afficher une autre ligne", Message = "Sélectionnez une autre ligne dans la liste", Content = picker }; messageBox.Show(); }
private void AddFishorAngular(Dictionary <string, int> dic, ListPicker list, TextBlock tbl, TextBox tb) { StringBuilder longlines = new StringBuilder(); if (dic.ContainsKey(tb.Text)) { MessageBox.Show("List already contains this item"); } else { dic.Add(tb.Text, 0); Dictionary <string, int> .KeyCollection keyColl = dic.Keys; list.Items.Clear(); foreach (string s in keyColl) { list.Items.Add(s); } foreach (KeyValuePair <string, int> kvp in dic) { longlines.AppendLine(kvp.Key.ToString() + " Count: " + kvp.Value.ToString()); } tbl.Text = longlines.ToString(); } totalNumbers(); }
private string GetSenderKey(object sender) { ListPicker picker = sender as ListPicker; string key = string.Empty; switch (picker.Name) { case "LanguageMarketPicker": key = Constants.BING_LANGUAGE_MARKET; break; case "BingSearchOptionsPicker": key = Constants.BING_SEARCH_OPTIONS; break; case "BingSearchAspectPicker": key = Constants.BING_SEARCH_ASPECT; break; case "BingSearchSizePicker": key = Constants.BING_SEARCH_SIZE; break; case "BingSearchColorPicker": key = Constants.BING_SEARCH_COLOR; break; case "BingSearchStylePicker": key = Constants.BING_SEARCH_STYLE; break; case "BingSearchFacePicker": key = Constants.BING_SEARCH_FACE; break; case "BingSearchAdultPicker": key = Constants.BING_SEARCH_ADULT; break; } return(key); }
protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e) { ToggleSwitch tempToggleSwitch = (ToggleSwitch)this.FindName("EnableGPSToggleSwitch"); if (IsolatedStorageSettings.ApplicationSettings.Contains("enableGPS")) { IsolatedStorageSettings.ApplicationSettings["enableGPS"] = tempToggleSwitch.IsChecked; } else { IsolatedStorageSettings.ApplicationSettings.Add("enableGPS", tempToggleSwitch.IsChecked); } ListPicker tempListPicker = (ListPicker)this.FindName("DefaultLocationListPicker"); if (IsolatedStorageSettings.ApplicationSettings.Contains("defaultLocation")) { IsolatedStorageSettings.ApplicationSettings["defaultLocation"] = tempListPicker.SelectedItem; } else { IsolatedStorageSettings.ApplicationSettings.Add("defaultLocation", tempListPicker.SelectedItem); } base.OnNavigatedFrom(e); }
/// <summary> /// Find files with specified parameters and add them to a ListPicker /// </summary> /// <param name="fileList"></param> /// <param name="folderPath"></param> /// <param name="extension"></param> static public void findFilesAndAddToListpicker(ListPicker fileList, string folderPath, string extension) { if (fileList == null) { return;//Ignore wrongful listpickers } var isf = IsolatedStorageFile.GetUserStoreForApplication(); DirectoryInfo directoryInfo = new DirectoryInfo(folderPath); List <FileItems> fileItemsList = new List <FileItems>(); /*foreach (FileInfo fileInfo in directoryInfo.GetFiles("*" + extension)) * { * fileItemsList.Add(new FileItems() { Name = fileInfo.Name.Split('.')[0], FilePath = fileInfo.FullName }); * }*/ foreach (string fileName in isf.GetFileNames("*" + extension)) { fileItemsList.Add(new FileItems() { Name = fileName.Split('.')[0], FilePath = fileName }); } fileList.ItemsSource = fileItemsList; }
private void cboRegion_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (IsPostInit) { ListPicker oPicker = sender as ListPicker; LottoRegionMapping oLottoRegionMapping = oPicker.SelectedItem as LottoRegionMapping; // Load Lotto Game file for Selected State string sLotteryGameFileName = ""; if (LotteryGameConfigFiles.ContainsKey(oLottoRegionMapping.Region)) { sLotteryGameFileName = oLottoRegionMapping.FileName; } CurrentLotteryGameFileName = sLotteryGameFileName; // Load games in to dictionary definitions LottoGames = LottoAlgorithm.GetLotteryGames(sLotteryGameFileName); // Add Lotto Game Names to List Picker this.cboLottoGame.ItemsSource = LottoGames.RegionLottoGameDict.Values.ToList <LotteryGameRec>(); // Set list picker to selected Lotto Game cboLottoGame.SelectedIndex = 0; } } catch { } }
public void RadiusBoxDefault(ListPicker listPicker) { listPicker.BorderBrush = new System.Windows.Media.SolidColorBrush() { Color = ColorConverting.ConvertStringToColor("#FF1BA1E2") }; }
void lp_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (!cooldown) { ListPicker ctrl = (ListPicker)sender; foreach (Tweak tweak in Tweaks.tweaks) { if (tweak.title == (string)ctrl.Header) { if (tweak.keyType == Tweak.tweakType.str) { string val = ((SelectorTweak)ctrl.SelectedItem).Value; WP7RootToolsSDK.Registry.SetStringValue(tweak.getHyve(), tweak.getKeyName(), tweak.getValueName(), val); System.Diagnostics.Debug.WriteLine(val); } else { try { WP7RootToolsSDK.Registry.CreateKey(tweak.getHyve(), tweak.getKeyName()); } catch { } int val = ((SelectorTweak)ctrl.SelectedItem).IntValue; WP7RootToolsSDK.Registry.SetDWordValue(tweak.getHyve(), tweak.getKeyName(), tweak.getValueName(), (uint)val); if (tweak.rebootNeeded) { rbneeded(); } } } } } }
private void cboLottoGame_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (IsPostInit) { if (cboLottoGame.Items.Count > 0) { // Populate LottorGame data on screen ListPicker oLottoGame = sender as ListPicker; LotteryGameRec oPickerRec = oLottoGame.SelectedItem as LotteryGameRec; CurrentLotteryGame = LottoGames.RegionLottoGameDict[oPickerRec.GameName]; txtRegBallUB.Text = CurrentLotteryGame.LottoBallRegUB.ToString(); txtRegBallCount.Text = CurrentLotteryGame.LottoBallRegCount.ToString(); txtSpecialBallUB.Text = CurrentLotteryGame.LottoBallSpecialUB.ToString(); chkUseSpecialBall.IsChecked = CurrentLotteryGame.UseSpecialBall; txtRegBallOrderH2L.Text = CurrentLotteryGame.LottoBallRegOrderingH2LStr; txtSpecialBallOrderH2L.Text = CurrentLotteryGame.LottoBallSpecialOrderingH2LStr; btnUpdate.IsEnabled = false; } } } catch { } }
public void test(object sender, EventArgs e) { ListPicker picker = (ListPicker)sender; Debug.WriteLine(sender.ToString()); Debug.WriteLine(picker.Background.ToString()); }
private void calculate(String fromName) { foreach (string name in EnumHelper.GetEnumStrings <MeasurementType>()) { if (fromName.Equals(name, StringComparison.OrdinalIgnoreCase)) { TextBox inputTextBox = (TextBox)this.FindName("inputTextBox" + fromName); double input; if (double.TryParse(inputTextBox.Text, out input)) { TextBlock isAboutTextBlock = (TextBlock)this.FindName("isAboutTextBlock" + fromName); isAboutTextBlock.Visibility = System.Windows.Visibility.Visible; ListPicker fromListPicker = (ListPicker)this.FindName("fromListPicker" + fromName); ListPicker toListPicker = (ListPicker)this.FindName("toListPicker" + fromName); TextBlock resultTextBlock = (TextBlock)this.FindName("resultTextBlock" + fromName); resultTextBlock.Text = String.Format("{0:0.##}", (input * ((MeasurementUnit)fromListPicker.SelectedItem).Value) / ((MeasurementObject)toListPicker.SelectedItem).Value) + " " + ((MeasurementObject)toListPicker.SelectedItem).Name + "(s)"; resultTextBlock.Visibility = System.Windows.Visibility.Visible; } else { TextBlock isAboutTextBlock = (TextBlock)this.FindName("isAboutTextBlock" + fromName); isAboutTextBlock.Visibility = System.Windows.Visibility.Collapsed; TextBlock resultTextBlock = (TextBlock)this.FindName("resultTextBlock" + fromName); resultTextBlock.Visibility = System.Windows.Visibility.Collapsed; } break; } } }
/// <summary> /// Retrieve a list of paired bluetooth devices and add them to a listpicker. The appropriate /// handler for the listpicker item being changed is also attatched. /// </summary> /// <param name="deviceList">The lispicker that will contain the list od fevices</param> /// <param name="eventHandler">The handler that will respond to the listpicker selection being changed</param> static public async void getListOfBluetoothDevices(ListPicker deviceList) { try { List <DeviceItems> source = new List <DeviceItems>(); PeerFinder.AlternateIdentities["Bluetooth:Paired"] = ""; var findPeerResult = await PeerFinder.FindAllPeersAsync(); foreach (PeerInformation peerInformation in findPeerResult) { source.Add(new DeviceItems() { Name = peerInformation.DisplayName, hostName = peerInformation.HostName }); } deviceList.ItemsSource = source; } catch (Exception e) { Debug.WriteLine(e); } }
private void EditScale_Click(object sender, EventArgs e) { ListPickerOpened = true; ListPicker listPicker = (ListPicker)FindName("Picker"); listPicker.Open(); }
private void decrementCount(Dictionary <string, int> dic, ListPicker list, TextBlock tbl) { if (FishList.SelectedItem == null) { MessageBox.Show("Please select a fish"); } else { string tempname; StringBuilder longlines = new StringBuilder(); tempname = list.SelectedItem.ToString(); if (!dic.ContainsKey(tempname)) { dic.Add(tempname, 0); } dic[tempname]--; var ordered = dic.OrderByDescending(x => x.Value); foreach (KeyValuePair <string, int> kvp in ordered) { longlines.AppendLine(kvp.Key.ToString() + " Count: " + kvp.Value.ToString()); } tbl.Text = longlines.ToString(); } totalNumbers(); }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { if (isInitialized == true) { return; } // trace page navigation TraceHelper.AddMessage("Settings: Loaded"); Email.IsEnabled = !IsConnected; Password.IsEnabled = !IsConnected; accountOperationSuccessful = false; accountTextChanged = false; SettingsPanel.Children.Clear(); foreach (var setting in PhoneSettings.Settings.Keys) { // get the source list for the setting, along with any current value var phoneSetting = PhoneSettings.Settings[setting]; //var bindingList = (from l in list select new { Name = l }).ToList(); var bindingList = phoneSetting.Values; var value = PhoneSettingsHelper.GetPhoneSetting(App.ViewModel.PhoneClientFolder, setting); int selectedIndex = 0; if (value != null && bindingList.Any(ps => ps.Name == value)) { var selectedValue = bindingList.Single(ps => ps.Name == value); selectedIndex = bindingList.IndexOf(selectedValue); } var template = !String.IsNullOrEmpty(phoneSetting.DisplayTemplate) ? (DataTemplate)App.Current.Resources[phoneSetting.DisplayTemplate] : null; // create a new list picker for the setting var listPicker = new ListPicker() { Header = setting, Tag = setting, SelectedIndex = selectedIndex >= 0 ? selectedIndex : 0 }; listPicker.ItemsSource = bindingList; listPicker.DisplayMemberPath = "Name"; if (template != null) { listPicker.FullModeItemTemplate = template; } SettingsPanel.Children.Add(listPicker); } CreateUserButton.DataContext = this; CreateButtonLabel.DataContext = this; ConnectUserButton.DataContext = this; ConnectButtonLabel.DataContext = this; Email.LostFocus += new RoutedEventHandler(delegate { accountTextChanged = true; NotifyPropertyChanged("EnableButtons"); }); Password.LostFocus += new RoutedEventHandler(delegate { accountTextChanged = true; NotifyPropertyChanged("EnableButtons"); }); isInitialized = true; }
public void MatchListpicker(int intTime, ListPicker listpickerMinutes, ListPicker listPickerSeconds) { int intMinutes, intSeconds; SplitTime(intTime, out intMinutes, out intSeconds); MatchTime(intMinutes, listpickerMinutes); MatchTime(intSeconds, listPickerSeconds); }
void Start() { m_listPicker = new ListPicker(songs.Length); //DontDestroyOnLoad(gameObject); playRandomSong(); //audio.clip = m_listPicker.pickRandomIndex(); //audio.Play(); }
/// <summary> /// Override colors of a disabled picker /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void native_IsEnabledChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e) { ListPicker native = sender as ListPicker; if (native != null && !native.IsEnabled) { native.Foreground = RendererUtil.FromXamarinColorToWindowsBrush(BaseApp.TEXT_COLOR_DISABLED); native.BorderBrush = RendererUtil.FromXamarinColorToWindowsBrush(BaseApp.CONTROL_BORDER_COLOR_DISABLED); } }
public ThingPage() { InitializeComponent(); // Fields. _CommandTargetListPicker = (ListPicker)this.FindName("CommandTargetListPicker"); // Event handlers. ViewModel.CommandTargetRequested += new EventHandler <ThingViewModel.CommandTargetRequestedEventArgs>(ViewModel_CommandTargetRequested); }
public void MatchTime(int intTime, ListPicker mainListPicker) { foreach (ListPickerItem item in mainListPicker.Items) { if (intTime == GetTagAsTime(item)) { mainListPicker.SelectedItem = item; break; } } }
private void OrderBy_Click(object sender, EventArgs e) { StackPanel s = new StackPanel(); var Picker = new ListPicker(); Picker.SetValue(ListPicker.ItemCountThresholdProperty, 6); var PickerItems = new string[] { ProductSortingEnum.CreatedOn.ToString(), ProductSortingEnum.NameAsc.ToString(), ProductSortingEnum.NameDesc.ToString(), ProductSortingEnum.Position.ToString(), ProductSortingEnum.PriceAsc.ToString(), ProductSortingEnum.PriceDesc.ToString() }; Picker.ItemsSource = PickerItems; s.Children.Add(Picker); CustomMessageBox messageBox = new CustomMessageBox() { Caption = "Order By", Message = "Select the order you want the products to be displayed", LeftButtonContent = "Submit", Content = s, RightButtonContent = "Cancel" }; messageBox.Show(); messageBox.Dismissed += async(s1, e1) => { ProductSortingEnum Result = ProductSortingEnum.Position; if (e1.Result.Equals(CustomMessageBoxResult.LeftButton)) { foreach (ProductSortingEnum pse in Enum.GetValues(typeof(ProductSortingEnum))) { if (pse.ToString().Equals(Picker.SelectedItem.ToString())) { Result = pse; break; } } var Count = 0; foreach (PivotItem pivot in CategoryPivot.Items) { var Listbox = Helper.FindFirstElementInVisualTree <ListBox>(pivot); Listbox.Items.Clear(); if (Listbox.ItemTemplate.Equals(Application.Current.Resources["ProductCategoryTemplate"] as DataTemplate)) { var Prods = await api.CategoryProductsSortedFiltered(Categories[Count].Id, true, false, Result, 0, 0); foreach (ProductDTO p in Prods) { Listbox.Items.Add(new MainPage.ProductData { Id = p.Id, Description = p.Description, Image = Helper.ConvertToBitmapImage(p.Image.First()), ProductName = p.Name, Value = p.Price.ToString("0.0#") + " " + Currency }); } } Count++; } } }; }
public static object PickFromList(string windowTitle, object[] items) { using (ListPicker picker = new ListPicker(items)) { picker.Text = windowTitle; if (picker.ShowDialog() != DialogResult.OK) { return(null); } return(picker.SelectedItem); } }
private UIPickerViewModel SetActionPickerModel <T>(List <T> list) { var model = new ListPicker <T> (list); //returns selected value model.PickerChanged += (object sender, EventArgs e) => { var eve = (PickerChangedEventArgs)e; Console.WriteLine(eve.SelectedItem); }; return(model); }
public ListPickerRenderer( ListPicker listPicker) : base(listPicker) { this._comboBox = new ComboBox() { FontWeight = FontWeights.SemiLight, }; this._comboBox.SelectionChanged += ComboBox_SelectionChanged; this.SetNativeElement(this._comboBox); }
private void ImageDisplayCriteria_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (ListPickerInitialized) { ListPicker listPicker = sender as ListPicker; ListPickerItem selectedItem = listPicker.SelectedItem as ListPickerItem; string name = listPicker.Name.ToString(); string value = selectedItem.Name.ToString().ToLower(); UserPreference.UpdatePreference(name, value); } }
private void InitGesturesPicker(ListPicker picker, GestureAction action) { picker.ItemsSource = CreateGestureList(); picker.SelectedIndex = 0; for (int i = 0; i < picker.Items.Count; i++) { if (((GestureActionListPickerItem)picker.Items[i]).Action == action) { picker.SelectedIndex = i; break; } } }
/// <summary> /// Makes the list picker. /// </summary> /// <param name="setting">The setting.</param> /// <returns>ListPicker.</returns> private static ListPicker MakeListPicker(Setting setting) { var lpValue = new ListPicker { Header = String.Format((string)"{0}", (object)setting.FriendlyName.Trim()) }; var items = Enumerable.ToList <string>(setting.StringItem.Select(item => item.Value)); lpValue.ItemsSource = items; lpValue.SetBinding(ListPicker.SelectedItemProperty, new Binding("Value") { Mode = BindingMode.TwoWay, Source = setting }); return(lpValue); }
private void SetPickerSource(ListPicker picker, List <PickerItem> itemList, string selectKey) { PickerItem selectItem = null; foreach (PickerItem item in itemList) { if ((string)item.Key == selectKey) { selectItem = item; break; } } picker.ItemsSource = itemList; picker.SelectedItem = selectItem; }
/// <summary> /// Displays a CustomMessageBox with a ListPicker as content. /// </summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event information.</param> private void MessageBoxWithListPicker_Click(object sender, RoutedEventArgs e) { ListPicker listPicker = new ListPicker() { Header = "Snooze for:", ItemsSource = new string[] { "5 minutes", "10 minutes", "1 hour", "4 hours", "1 day" }, Margin = new Thickness(12, 42, 24, 18) }; CustomMessageBox messageBox = new CustomMessageBox() { Title = "Calendar", Caption = "Annual Company Product Fair 2012", Message = "Soccer Fields" + Environment.NewLine + "May 4, 2012 4:30-6:30 PM", Content = listPicker, LeftButtonContent = "snooze", RightButtonContent = "dismiss", IsFullScreen = (bool)FullScreenCheckBox.IsChecked }; messageBox.Dismissing += (s1, e1) => { if (listPicker.ListPickerMode == ListPickerMode.Expanded) { e1.Cancel = true; } }; messageBox.Dismissed += (s2, e2) => { switch (e2.Result) { case CustomMessageBoxResult.LeftButton: // Do something. break; case CustomMessageBoxResult.RightButton: case CustomMessageBoxResult.None: // Do something. break; default: break; } }; messageBox.Show(); }
public ListPickerRenderer( global::Android.Content.Context context, ListPicker listPicker) : base(context, listPicker) { this._nativeAdapter = new NativeListPickerAdapter(context); this._nativeListPicker = new AndroidListPicker(context) { Adapter = this._nativeAdapter, }; this._nativeListPicker.ItemSelected += NativeListPicker_ItemSelected; this.SetNativeElement(this._nativeListPicker); }
private async void ListPicker_ItemsPicked(ListPicker sender, ItemsPickedEventArgs args) { sender.ItemsPicked -= ListPicker_ItemsPicked; if (this.ItemsPickedCommand != null && args.Items != null && args.Items.Count > 0) { object parameter = this.ItemsPickedInputConverter != null ? this.ItemsPickedInputConverter.Convert(args, typeof(object), null, null) : args; await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { if (this.ItemsPickedCommand.CanExecute(parameter)) { this.ItemsPickedCommand.Execute(parameter); } }); } this.OnItemsPicked(args); }
public object Execute(object sender, object parameter) { var listPicker = new ListPicker(); listPicker.ItemsPicked += ListPicker_ItemsPicked; listPicker.Show(this.Title, this.ItemsSource, this.ItemTemplate, this.SelectedItem); return null; }
private void CreateValueEditor(ComboBox box) { var presenter = GetValuePresenterForCombo(box); presenter.Content = null; presenter.HorizontalAlignment = HorizontalAlignment.Stretch; if (box.SelectedItem != null) { var pd = (PropertyDefinition)box.SelectedItem; if (pd.PropertyType == PropertyDefinitionType.EnumDisplayName || pd.PropertyType == PropertyDefinitionType.EnumName || pd.PropertyType == PropertyDefinitionType.Property) { Binding b = new Binding(pd.Property.Name); b.Source = this.DataContext; b.Mode = BindingMode.TwoWay; if (pd.PropertyType == PropertyDefinitionType.Property) { if (pd.Property.Type == ManagementPackEntityPropertyTypes.datetime) { var dp = new DatePicker() { MinWidth = 200, SelectedDateFormat = DatePickerFormat.FullDateTime }; dp.SetBinding(DatePicker.SelectedDateProperty, b); presenter.Content = dp; } else if (pd.Property.Type == ManagementPackEntityPropertyTypes.@bool) { var cb = new CheckBox() { Content = pd.Property.Name }; cb.SetBinding(CheckBox.IsCheckedProperty, b); presenter.Content = cb; } else { var txt = new TextBox() { Text = "test", VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Stretch, MinWidth = 200 }; txt.SetBinding(TextBox.TextProperty, b); presenter.Content = txt; } } else { var lp = new ListPicker(); lp.ParentCategoryId = pd.Property.EnumType.Id; lp.SetBinding(ListPicker.SelectedItemProperty, b); presenter.Content = lp; } } } }