public StencilView()
        {
            this.InitializeComponent();

            List <string> list = new List <string>()
            {
                "a", "a", "b", "b", "r", "t"
            };



            collecion            = new ObservableCollection <ISymbol>();
            collecion            = this.grid.Resources["symbolcollection"] as SymbolCollection;
            stencil.SymbolSource = collecion;
            //stencil.Constraints = StencilConstraints.Default;
            stencil.HeaderVisibility = Visibility.Collapsed;



            ilist = new List <string>();

            foreach (var item in stencil.SymbolSource as IEnumerable <object> )
            {
                ilist.Add((item as ISymbol).Key.ToString());
            }

            object duplicates = ilist.GroupBy(a => a).SelectMany(ab => ab.Skip(1).Take(1)).ToList();

            //        var dups = ilist.GroupBy(x => x)
            //           .Where(x => x.Count() > 1)
            //           .Select(x => x)
            //           .ToList();

            //        var xxx = ilist.Select((value, index) => new { value, index })
            //.Where(a => (duplicates as List<string>).Any(s => string.Equals(a.value, s)))
            //.Select(a => a.index);

            dupList = ilist.Select((value, index) => new { value, index })
                      .Where(a => (duplicates as List <string>).Any(s => string.Equals(a.value, s)))
                      .Select(a => a.value).ToList();

            var indexxx = ilist.Select((value, index) => new { value, index })
                          .Where(a => (duplicates as List <string>).Any(s => string.Equals(a.value, s)))
                          .Select(a => a.index).ToList();


            duplicatesWithIndices = ilist.Select((value, index) => new { value, index })
                                    .Where(a => (duplicates as List <string>).Any(s => string.Equals(a.value, s)))
                                    .Select(a => new DuplicateItemClass()
            {
                Name  = a.value,
                Index = a.index
            }).ToList();

            //duplicatesWithIndices = xxx.ToList();

            //        var duplicatesWithIndices = ilist.Select((Name, Index) => new { Name, Index })
            //.GroupBy(x => x.Name)
            //.Select(xg => new
            //{
            //    Name = xg.Key,
            //    Indices = xg.Select(x => x.Index)
            //})
            //.Where(x => x.Indices.Count() > 1);


            //this.stencil.Constraints = StencilConstraints.Default & ~StencilConstraints.Filters;

            SymbolFilterProvider all = new SymbolFilterProvider {
                SymbolFilter = All, Content = "Limited Symbols"
            };
            SymbolFilterProvider category = new SymbolFilterProvider {
                SymbolFilter = Filter, Content = "Category"
            };

            this.stencil.SymbolFilters = new SymbolFilters()
            {
                all,
                category
            };
            this.stencil.SelectedFilter = all;
            stencil.DoubleTapped       += stencil_DoubleTapped;
            //ComboBox box = new ComboBox();
            Binding bind = new Binding();

            bind.Path   = new PropertyPath("SelectedFilter");
            bind.Source = stencil;
            this.SetBinding(SelectedFilterProperty, bind);
            this.Loaded += StencilView_Loaded;
            this.stencil.Constraints = this.stencil.Constraints | StencilConstraints.ShowPreview;
        }
Beispiel #2
0
 //Filter event
 private bool SymbolFilter(SymbolFilterProvider sender, object symbol)
 {
     return(true);
 }
Beispiel #3
0
 /// <summary>
 /// The all.
 /// </summary>
 /// <param name="source">
 /// The source.
 /// </param>
 /// <param name="symbol">
 /// The symbol.
 /// </param>
 /// <returns>
 /// The <see cref="bool"/>.
 /// </returns>
 public bool All(SymbolFilterProvider source, object symbol)
 {
     return(true);
 }