I have an `XElement` and an `XPath` expression that selects a node from it. It works fine in the original program that I wrote it in but doesnt work if I paste it to another program. I've checked the references and import statements. What am i doing wrong?
I think the problem might be that the original program had the code within the class of a wpf window while it was moved to a abstract class where it doesnt work.
Dim X As XElement = _
<ModelVisual3 D x:Name="World" mlns="http://schemas.microso ft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microso ft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microso ft.com/expression/blend/2008" xmlns:mc="http://schemas.openxml formats.org/markup-compatibility/2006" mc:Ignorable="d "
>
<ModelVisual3 D x:Name="Ambient LightContainer" >
<ModelVisual3D. Content>
<AmbientLight x:Name="Ambient Light" Color="#FF7F7F7 F"/>
</ModelVisual3D.C ontent>
</ModelVisual3D>
<ModelVisual3 D x:Name="Default Group">
<ModelVisual3D. Content>
<GeometryModel3 D x:Name="Suzanne " d:Bounds="-1.3671879768371 6,-0.8515629768371 58,-0.984375,2.7343 7595367432,1.70 312595367432,1. 96875">
<GeometryModel3 D.Geometry>
<MeshGeometry 3D Positions="0.46 875,0.75781298,-0.24218801 0.4375,0.765625 ,-0.16406301 0.5,0.6875,-0.09375 0.5625,0.671875 ,-0.24218801 -0.5,0.6875,-0.09375 -0.4375,0.765625 ,-0.16406301 -0.46875,0.75781 298,-0.24218801 -0.5625,0.671875 ,-0.24218801 0.546875,0.5781 25,-0.054687999 0.625,0.5625,-0.24218801 -0.546875,0.5781 25,-0.054687999 -0.625,0.5625,-0.24218801 0.35156301,0.71 875,-0.03125
</GeometryModel3D .Geometry>
<GeometryModel3 D.Material>
<DiffuseMateria l Brush="#FFFFFFF F"/>
</GeometryModel3D .Material>
</GeometryModel3D >
</ModelVisual3D.C ontent>
<ModelVisual3D. Transform>
<Transform3DGro up>
<TranslateTrans form3D OffsetX="0" OffsetY="0" OffsetZ="0"/>
<ScaleTransform 3D ScaleX="1" ScaleY="1" ScaleZ="1"/>
<RotateTransfor m3D d:EulerAngles=" 0,0,0"/>
</Transform3DGrou p>
</ModelVisual3D.T ransform>
</ModelVisual3D>
</ModelVisual3D>
Dim XPath As String
XPath = "//Transform3DGrou p"
X.XPathSelectEl ement(XPath).Re move()
Console.WriteLi ne(X.ToString)
I think the problem might be that the original program had the code within the class of a wpf window while it was moved to a abstract class where it doesnt work.
Dim X As XElement = _
<ModelVisual3 D x:Name="World" mlns="http://schemas.microso ft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microso ft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microso ft.com/expression/blend/2008" xmlns:mc="http://schemas.openxml formats.org/markup-compatibility/2006" mc:Ignorable="d "
>
<ModelVisual3 D x:Name="Ambient LightContainer" >
<ModelVisual3D. Content>
<AmbientLight x:Name="Ambient Light" Color="#FF7F7F7 F"/>
</ModelVisual3D.C ontent>
</ModelVisual3D>
<ModelVisual3 D x:Name="Default Group">
<ModelVisual3D. Content>
<GeometryModel3 D x:Name="Suzanne " d:Bounds="-1.3671879768371 6,-0.8515629768371 58,-0.984375,2.7343 7595367432,1.70 312595367432,1. 96875">
<GeometryModel3 D.Geometry>
<MeshGeometry 3D Positions="0.46 875,0.75781298,-0.24218801 0.4375,0.765625 ,-0.16406301 0.5,0.6875,-0.09375 0.5625,0.671875 ,-0.24218801 -0.5,0.6875,-0.09375 -0.4375,0.765625 ,-0.16406301 -0.46875,0.75781 298,-0.24218801 -0.5625,0.671875 ,-0.24218801 0.546875,0.5781 25,-0.054687999 0.625,0.5625,-0.24218801 -0.546875,0.5781 25,-0.054687999 -0.625,0.5625,-0.24218801 0.35156301,0.71 875,-0.03125
</GeometryModel3D .Geometry>
<GeometryModel3 D.Material>
<DiffuseMateria l Brush="#FFFFFFF F"/>
</GeometryModel3D .Material>
</GeometryModel3D >
</ModelVisual3D.C ontent>
<ModelVisual3D. Transform>
<Transform3DGro up>
<TranslateTrans form3D OffsetX="0" OffsetY="0" OffsetZ="0"/>
<ScaleTransform 3D ScaleX="1" ScaleY="1" ScaleZ="1"/>
<RotateTransfor m3D d:EulerAngles=" 0,0,0"/>
</Transform3DGrou p>
</ModelVisual3D.T ransform>
</ModelVisual3D>
</ModelVisual3D>
Dim XPath As String
XPath = "//Transform3DGrou p"
X.XPathSelectEl ement(XPath).Re move()
Console.WriteLi ne(X.ToString)