private WallpaperSource GetResult() { return(new WallpaperSource { Query = this.Query, Source = Source.Wallhaven, WallhavenOptions = new WallhavenOptions { General = Convert.ToInt32(this.General), Anime = Convert.ToInt32(this.Anime), People = Convert.ToInt32(this.People), SFW = Convert.ToInt32(this.SFW), Sketchy = Convert.ToInt32(this.Sketchy), Resolution = string.Join(",", Resolutions.Where(x => x.IsSelected).Select(x => x.ObjectData)), Ratio = string.Join(",", Ratios.Where(x => x.IsSelected).Select(x => x.ObjectData)) } }); }
private void OnChecked(object sender, RoutedEventArgs e) { ComboBox comboBox = (ComboBox)ItemsControl.ItemsControlFromItemContainer(FindParent <ComboBoxItem>((CheckBox)sender)); BindingExpression bE = comboBox.GetBindingExpression(ComboBox.ItemsSourceProperty); StringBuilder sb = new StringBuilder(); if (bE.ResolvedSourcePropertyName == "Resolutions") { foreach (var selectableObject in Resolutions.Where(selectableObject => selectableObject.IsSelected)) { sb.AppendFormat("{0},", selectableObject.ObjectData); } } if (bE.ResolvedSourcePropertyName == "Ratios") { foreach (var selectableObject in Ratios.Where(selectableObject => selectableObject.IsSelected)) { sb.AppendFormat("{0},", selectableObject.ObjectData); } } comboBox.Text = sb.ToString().Trim().TrimEnd(','); }