locked
NonSerialized Grid. How? RRS feed

  • Question

  • Hi.

     

    I wonder if there is a possibility to give in xaml for example Grid control parameter "NonSerialized".

    string x = XamlWriter.Save( grid.Parent);

     

    Regards,

    Liriann

    Wednesday, January 26, 2011 1:22 PM

Answers

  • Hi Liriann,

    Based on my knowledge, there is not straightforward way to implement this feature.

    We could use NonSerializedAttribute to specify a object not to be serialized or in XML we could take advantage of XmlIgnoreAttribute property.

    In XAML, I am afraid we could workaround this by removing the "NonSerialized" objects and make a copy of it. Then after serialation you could get your certain objects "NonSerialized".

    Hope this information is helpful for you! If you still have any doubts or questions please feel free to let me know.

     

    Best regards


    Yves Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Yves.Z Friday, February 4, 2011 9:05 AM
    Tuesday, February 1, 2011 6:34 AM
  • Serializing a form can be problematic anyhow.

    You might find that it's simpler to just save the relevent data as xml and re-fill a form if you need to de-serialize later.  Depending on your purpose.

    • Marked as answer by Yves.Z Friday, February 4, 2011 9:05 AM
    Tuesday, February 1, 2011 8:33 AM

All replies

  • Hi Liriann,

    Based on my knowledge, there is not straightforward way to implement this feature.

    We could use NonSerializedAttribute to specify a object not to be serialized or in XML we could take advantage of XmlIgnoreAttribute property.

    In XAML, I am afraid we could workaround this by removing the "NonSerialized" objects and make a copy of it. Then after serialation you could get your certain objects "NonSerialized".

    Hope this information is helpful for you! If you still have any doubts or questions please feel free to let me know.

     

    Best regards


    Yves Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Yves.Z Friday, February 4, 2011 9:05 AM
    Tuesday, February 1, 2011 6:34 AM
  • Serializing a form can be problematic anyhow.

    You might find that it's simpler to just save the relevent data as xml and re-fill a form if you need to de-serialize later.  Depending on your purpose.

    • Marked as answer by Yves.Z Friday, February 4, 2011 9:05 AM
    Tuesday, February 1, 2011 8:33 AM