Beispiel #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);
        }
Beispiel #2
0
        private NodeReorderService GetReorderGridChildrenService()
        {
            var reorderService = new NodeReorderService {
                IsEnabled = Options.ReorderGridChildren
            };

            reorderService.ParentNodeNames.Add(new NameSelector("Grid", null));
            reorderService.ChildNodeNames.Add(new NameSelector(null, null));
            reorderService.SortByAttributes.Add(new SortBy("Grid.Row", null, true));
            reorderService.SortByAttributes.Add(new SortBy("Grid.Column", null, true));
            return(reorderService);
        }
Beispiel #3
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);
        }
Beispiel #4
0
        private NodeReorderService GetReorderCanvasChildrenService()
        {
            var reorderService = new NodeReorderService {
                IsEnabled = Options.ReorderCanvasChildren
            };

            reorderService.ParentNodeNames.Add(new NameSelector("Canvas", null));
            reorderService.ChildNodeNames.Add(new NameSelector(null, null));
            reorderService.SortByAttributes.Add(new SortBy("Canvas.Left", null, true));
            reorderService.SortByAttributes.Add(new SortBy("Canvas.Top", null, true));
            reorderService.SortByAttributes.Add(new SortBy("Canvas.Right", null, true));
            reorderService.SortByAttributes.Add(new SortBy("Canvas.Bottom", null, true));
            return(reorderService);
        }