예제 #1
0
        private NodeReorderService GetReorderSettersService()
        {
            var reorderService = new NodeReorderService();
            reorderService.ParentNodeNames.Add(new NameMatch("DataTrigger", null));
            reorderService.ParentNodeNames.Add(new NameMatch("MultiDataTrigger", null));
            reorderService.ParentNodeNames.Add(new NameMatch("MultiTrigger", null));
            reorderService.ParentNodeNames.Add(new NameMatch("Style", null));
            reorderService.ParentNodeNames.Add(new NameMatch("Trigger", null));
            reorderService.ChildNodeNames.Add(new NameMatch("Setter", "http://schemas.microsoft.com/winfx/2006/xaml/presentation"));

            switch (Options.ReorderSetters)
            {
                case ReorderSettersBy.None:
                    reorderService.IsEnabled = false;
                    break;
                case ReorderSettersBy.Property:
                    reorderService.SortByAttributes.Add(new SortAttribute("Property", null, false));
                    break;
                case ReorderSettersBy.TargetName:
                    reorderService.SortByAttributes.Add(new SortAttribute("TargetName", null, false));
                    break;
                case ReorderSettersBy.TargetNameThenProperty:
                    reorderService.SortByAttributes.Add(new SortAttribute("TargetName", null, false));
                    reorderService.SortByAttributes.Add(new SortAttribute("Property", null, false));
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }
            return reorderService;
        }
예제 #2
0
 private NodeReorderService GetReorderGridChildrenService()
 {
     var reorderService = new NodeReorderService { IsEnabled = Options.ReorderGridChildren };
     reorderService.ParentNodeNames.Add(new NameMatch("Grid", null));
     reorderService.ChildNodeNames.Add(new NameMatch(null, null));
     reorderService.SortByAttributes.Add(new SortAttribute("Grid.Row", null, true, x => x.Name.LocalName.Contains(".") ? "-2" : "-1"));
     reorderService.SortByAttributes.Add(new SortAttribute("Grid.Column", null, true, x => "-1"));
     return reorderService;
 }
예제 #3
0
 private NodeReorderService GetReorderCanvasChildrenService()
 {
     var reorderService = new NodeReorderService { IsEnabled = Options.ReorderCanvasChildren };
     reorderService.ParentNodeNames.Add(new NameMatch("Canvas", null));
     reorderService.ChildNodeNames.Add(new NameMatch(null, null));
     reorderService.SortByAttributes.Add(new SortAttribute("Canvas.Left", null, true, x => "-1"));
     reorderService.SortByAttributes.Add(new SortAttribute("Canvas.Top", null, true, x => "-1"));
     reorderService.SortByAttributes.Add(new SortAttribute("Canvas.Right", null, true, x => "-1"));
     reorderService.SortByAttributes.Add(new SortAttribute("Canvas.Bottom", null, true, x => "-1"));
     return reorderService;
 }