Exemplo n.º 1
0
		private void AddHandler(object sender, RoutedEventArgs e)
		{
			var newSet =
				new PropertyFilterSet()
				{
					DisplayName = "New Filter",
					IsDefault = false,
					IsEditCommand = false,
					Properties = new String[] { "prop1,prop2" },
				};
			ItemsSource.Add(newSet);

			// select this new item
			int index = ItemsSource.IndexOf(newSet);
			if (index >= 0)
			{
				filterSetList.SelectedIndex = index;
			}
		}
Exemplo n.º 2
0
        void AddHandler(object sender, RoutedEventArgs e)
        {
            var newSet =
                new PropertyFilterSet {
                DisplayName   = "New Filter",
                IsDefault     = false,
                IsEditCommand = false,
                Properties    = new[] { "prop1,prop2" }
            };

            ItemsSource.Add(newSet);

            // select this new item
            var index = ItemsSource.IndexOf(newSet);

            if (index >= 0)
            {
                filterSetList.SelectedIndex = index;
            }
        }
        /// <summary>
        /// Make a deep copy of the filter collection.
        /// This is used when heading into the Edit dialog, so the user is editing a copy of the
        /// filters, in case they cancel the dialog - we dont want to alter their live collection.
        /// </summary>
        public PropertyFilterSet[] CopyFilterSets(PropertyFilterSet[] source)
        {
            var ret = new List<PropertyFilterSet>();
            foreach (PropertyFilterSet src in source)
            {
                ret.Add
                (
                    new PropertyFilterSet
                    {
                        DisplayName = src.DisplayName,
                        IsDefault = src.IsDefault,
                        IsEditCommand = src.IsEditCommand,
                        Properties = (string[])src.Properties.Clone()
                    }
                );
            }

            return ret.ToArray();
        }