private void RefreshVisual(Property property) { if (updatingSource) { return; } int value = Convert.ToInt32(property.Value, CultureInfo.CurrentCulture); items = Enum.GetValues(property.PropertyType) .OfType <Enum>() .Select(x => Convert.ToInt32(x, CultureInfo.CurrentCulture)) .Where(x => x != 0) .Select(x => new FlagsEditorItem { Selected = 0 < (x & value), Value = Enum.GetName(property.PropertyType, x) }).ToList(); itemChangedWatcher = new ListItemChangedWatcher(items); itemChangedWatcher.Changed += new EventHandler(itemChangedWatcher_Changed); this.Flags.ItemsSource = items; }
private void RefreshVisual(Property property) { if (updatingSource) return; int value = Convert.ToInt32(property.Value, CultureInfo.CurrentCulture); items = Enum.GetValues(property.PropertyType) .OfType<Enum>() .Select(x => Convert.ToInt32(x, CultureInfo.CurrentCulture)) .Where(x => x != 0) .Select(x => new FlagsEditorItem { Selected = 0 < (x & value), Value = Enum.GetName(property.PropertyType, x) }).ToList(); itemChangedWatcher = new ListItemChangedWatcher(items); itemChangedWatcher.Changed += new EventHandler(itemChangedWatcher_Changed); this.Flags.ItemsSource = items; }