0
私が作成しているようなクラス:デシリアライズ、間違った値
[XmlRoot(ElementName = "Control", Namespace = "http://schemas.microsoft.com/VisualStudio/2011/storyboarding/stencilDocument"),Serializable]
public class ControlStencilXML
{
[XmlAttribute("ReferenceName")]
public string ReferenceName;
[XmlAttribute("DisplayName")]
public string DisplayName;
[XmlAttribute("Revision")]
public int Revision;
[XmlAttribute("IsBackground")]
public bool IsBackground;
[XmlAttribute("DefaultInsertionPoint")]
public string DefaultInsertionPoint;
[XmlAttribute("IsAnimated")]
public bool IsAnimated;
[XmlAttribute("KeyWords")]
public string KeyWords;
[XmlAttribute("ToolTip")]
public string ToolTip;
[XmlElement("ShapeLayouts")]
public List<ShapeLayout> ShapeLayouts;
}
[XmlRoot(ElementName = "ShapeLayout", Namespace = "http://schemas.microsoft.com/VisualStudio/2011/storyboarding/stencilDocument")]
public class ShapeLayout
{
[XmlAttribute("Name")]
string Name;
[XmlAttribute("HorizontalAlignment")]
string HorizontalAlignment;
[XmlAttribute("VerticalAlignment")]
string VerticalAlignment;
}
XLM私はデシリアライズしたい:
<?xml version="1.0" encoding="utf-8"?>
<Control ReferenceName="System.Storyboarding.Common.CheckBoxChecked" DisplayName="Checkbox (checked)" ToolTip="Checked checkbox with a text label" Revision="1" IsBackground="false" DefaultInsertionPoint="Default" Keywords="Toggle, Phone" IsAnimated="false" xmlns="http://schemas.microsoft.com/VisualStudio/2011/storyboarding/stencilDocument">
<ShapeLayouts>
<ShapeLayout Name="Check" HorizontalAlignment="Left" VerticalAlignment="Center" />
<ShapeLayout Name="CheckBox" HorizontalAlignment="Left" VerticalAlignment="Center" />
<ShapeLayout Name="Content" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
</ShapeLayouts>
</Control>
私は、問題をデシリアライズしようとしているときにエラーはありません最初のShapeLayoutオブジェクトだけを取得していて、その値はすべてnullに等しいということです。私はどこで間違いを犯したのですか?それを修正するには?
が働いて、どうもありがとうございました。私はShapeLayoutフィールドの可視性も一般に変更しました。 – buks