@ -39,7 +39,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
@@ -39,7 +39,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
{
protected override XElement CreateParent ( )
{
return new XElement ( XName . Get ( "Border" , CompletionDataHelper . WpfXaml Namespace) ) ;
return new XElement ( XName . Get ( "Border" , currentWpf Namespace) ) ;
}
}
@ -47,8 +47,8 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
@@ -47,8 +47,8 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
{
protected override bool GroupInto ( XElement parent , IEnumerable < XElement > children )
{
XElement newParent = new XElement ( XName . Get ( "Grid" , CompletionDataHelper . WpfXaml Namespace) ) ;
XElement newItem = new XElement ( XName . Get ( "Border" , CompletionDataHelper . WpfXaml Namespace) , newParent ) ;
XElement newParent = new XElement ( XName . Get ( "Grid" , currentWpf Namespace) ) ;
XElement newItem = new XElement ( XName . Get ( "Border" , currentWpf Namespace) , newParent ) ;
newParent . Add ( children ) ;
parent . Add ( newItem ) ;
@ -64,8 +64,8 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
@@ -64,8 +64,8 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
{
protected override bool GroupInto ( XElement parent , IEnumerable < XElement > children )
{
XElement newParent = new XElement ( XName . Get ( "StackPanel" , CompletionDataHelper . WpfXaml Namespace) ) ;
XElement newItem = new XElement ( XName . Get ( "Border" , CompletionDataHelper . WpfXaml Namespace) , newParent ) ;
XElement newParent = new XElement ( XName . Get ( "StackPanel" , currentWpf Namespace) ) ;
XElement newItem = new XElement ( XName . Get ( "Border" , currentWpf Namespace) , newParent ) ;
newParent . SetAttributeValue ( "Orientation" , "Vertical" ) ;
@ -83,8 +83,8 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
@@ -83,8 +83,8 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
{
protected override bool GroupInto ( XElement parent , IEnumerable < XElement > children )
{
XElement newParent = new XElement ( XName . Get ( "StackPanel" , CompletionDataHelper . WpfXaml Namespace) ) ;
XElement newItem = new XElement ( XName . Get ( "Border" , CompletionDataHelper . WpfXaml Namespace) , newParent ) ;
XElement newParent = new XElement ( XName . Get ( "StackPanel" , currentWpf Namespace) ) ;
XElement newItem = new XElement ( XName . Get ( "Border" , currentWpf Namespace) , newParent ) ;
newParent . SetAttributeValue ( "Orientation" , "Horizontal" ) ;
@ -112,6 +112,8 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
@@ -112,6 +112,8 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
abstract class GroupIntoBase : XamlMenuCommand
{
protected string currentWpfNamespace ;
protected override bool Refactor ( ITextEditor editor , XDocument document )
{
if ( editor . SelectionLength = = 0 ) {
@ -127,6 +129,10 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
@@ -127,6 +129,10 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
if ( selectedItems . Any ( ) ) {
var parent = selectedItems . First ( ) . Parent ;
currentWpfNamespace = parent . GetCurrentNamespaces ( )
. First ( i = > CompletionDataHelper . WpfXamlNamespaces . Contains ( i ) ) ;
var items = selectedItems . Where ( i = > i . Parent = = parent ) ;
return GroupInto ( parent , items ) ;
@ -181,7 +187,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
@@ -181,7 +187,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
{
protected override XElement CreateParent ( )
{
return new XElement ( XName . Get ( "Grid" , CompletionDataHelper . WpfXaml Namespace) ) ;
return new XElement ( XName . Get ( "Grid" , currentWpf Namespace) ) ;
}
}
@ -189,7 +195,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
@@ -189,7 +195,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
{
protected override XElement CreateParent ( )
{
return new XElement ( XName . Get ( "Canvas" , CompletionDataHelper . WpfXaml Namespace) ) ;
return new XElement ( XName . Get ( "Canvas" , currentWpf Namespace) ) ;
}
}
@ -197,7 +203,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
@@ -197,7 +203,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
{
protected override XElement CreateParent ( )
{
return new XElement ( XName . Get ( "DockPanel" , CompletionDataHelper . WpfXaml Namespace) ) ;
return new XElement ( XName . Get ( "DockPanel" , currentWpf Namespace) ) ;
}
}
@ -205,7 +211,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
@@ -205,7 +211,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
{
protected override XElement CreateParent ( )
{
return new XElement ( XName . Get ( "UniformGrid" , CompletionDataHelper . WpfXaml Namespace) ) ;
return new XElement ( XName . Get ( "UniformGrid" , currentWpf Namespace) ) ;
}
}
@ -213,7 +219,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
@@ -213,7 +219,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
{
protected override XElement CreateParent ( )
{
return new XElement ( XName . Get ( "Viewbox" , CompletionDataHelper . WpfXaml Namespace) ) ;
return new XElement ( XName . Get ( "Viewbox" , currentWpf Namespace) ) ;
}
}
@ -221,7 +227,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
@@ -221,7 +227,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
{
protected override XElement CreateParent ( )
{
return new XElement ( XName . Get ( "WrapPanel" , CompletionDataHelper . WpfXaml Namespace) ) ;
return new XElement ( XName . Get ( "WrapPanel" , currentWpf Namespace) ) ;
}
}
@ -229,7 +235,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
@@ -229,7 +235,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
{
protected override XElement CreateParent ( )
{
var element = new XElement ( XName . Get ( "StackPanel" , CompletionDataHelper . WpfXaml Namespace) ) ;
var element = new XElement ( XName . Get ( "StackPanel" , currentWpf Namespace) ) ;
element . SetAttributeValue ( "Orientation" , "Vertical" ) ;
return element ;
}
@ -239,7 +245,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
@@ -239,7 +245,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
{
protected override XElement CreateParent ( )
{
var element = new XElement ( XName . Get ( "StackPanel" , CompletionDataHelper . WpfXaml Namespace) ) ;
var element = new XElement ( XName . Get ( "StackPanel" , currentWpf Namespace) ) ;
element . SetAttributeValue ( "Orientation" , "Horizontal" ) ;
return element ;
}
@ -249,8 +255,8 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
@@ -249,8 +255,8 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
{
protected override bool GroupInto ( XElement parent , IEnumerable < XElement > children )
{
XElement newParent = new XElement ( XName . Get ( "Grid" , CompletionDataHelper . WpfXaml Namespace) ) ;
XElement newItem = new XElement ( XName . Get ( "ScrollViewer" , CompletionDataHelper . WpfXaml Namespace) , newParent ) ;
XElement newParent = new XElement ( XName . Get ( "Grid" , currentWpf Namespace) ) ;
XElement newItem = new XElement ( XName . Get ( "ScrollViewer" , currentWpf Namespace) , newParent ) ;
newParent . Add ( children ) ;
parent . Add ( newItem ) ;
@ -266,8 +272,8 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
@@ -266,8 +272,8 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
{
protected override bool GroupInto ( XElement parent , IEnumerable < XElement > children )
{
XElement newParent = new XElement ( XName . Get ( "Grid" , CompletionDataHelper . WpfXaml Namespace) ) ;
XElement newItem = new XElement ( XName . Get ( "GroupBox" , CompletionDataHelper . WpfXaml Namespace) , newParent ) ;
XElement newParent = new XElement ( XName . Get ( "Grid" , currentWpf Namespace) ) ;
XElement newItem = new XElement ( XName . Get ( "GroupBox" , currentWpf Namespace) , newParent ) ;
newParent . Add ( children ) ;
parent . Add ( newItem ) ;