473,394 Members | 1,751 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

IAddChild and XAML serialization process ?

Hello

I try to use xaml serializer framework to save in .xaml file my own
hierarchical graph of object.
The first step is done : I create my own file with something like this :
<Root
xmlns="clr-namespace:myNameSpace;assembly=MyAssembly">
<Structure ...>
<SimpleText ... />
</Structure>
</Root>
with a simple call like this :
outStream = new System.IO.FileStream(@"c:\temp\essai.xaml",
System.IO.FileMode.Create);
using (outStream)
{
System.Windows.Markup.XamlWriter.Save(rootInstance ,
outStream);
}
BUT when I want to reverse the process (Create a RootInstance from xaml
file) with a call like this :
System.IO.FileStream inStream = new
System.IO.FileStream(@"c:\temp\essai.xaml",
System.IO.FileMode.Open);
using (inStream)
{
return
(Root)System.Windows.Markup.XamlReader.Load(inStre am);
}
Root is created
Structure is created
SimpleText is created
BUT i have after this, an exception like "SimpleText can be added in
Structure" occurs !!
Structure and Root derive from Container class witch supports IEnumerable
and IAddChild interface !!
I don't know what I forgot somewhere ????
could you help me
thanks a lot for your help !

Dec 6 '06 #1
2 2310
After some research (with Reflector)

It's seems we can not use IAddChild interface in our own classes ???!

an internal method of the framework
(System.Windows.Markup.BamlRecordManager.TreatAsIA ddChild) use this records
:

KnownTypes.Types[0x113].and 0x113 ref a IAddChildInternal, internal
interface witch derivates from public IAddChild interface !!

and so, TradAsIAddChild return false in

System.Windows.Markup.BamlRecordReader.GetFlagsFro mType(Type elementType)

May be some one from Xaml developper team can help me !!!

thanks a lot for your help !
"azerty" <az****@aaaa.fra écrit dans le message de news:
eP****************@TK2MSFTNGP04.phx.gbl...
Hello

I try to use xaml serializer framework to save in .xaml file my own
hierarchical graph of object.
The first step is done : I create my own file with something like this :
<Root
xmlns="clr-namespace:myNameSpace;assembly=MyAssembly">
<Structure ...>
<SimpleText ... />
</Structure>
</Root>
with a simple call like this :
outStream = new System.IO.FileStream(@"c:\temp\essai.xaml",
System.IO.FileMode.Create);
using (outStream)
{
System.Windows.Markup.XamlWriter.Save(rootInstance ,
outStream);
}
BUT when I want to reverse the process (Create a RootInstance from xaml
file) with a call like this :
System.IO.FileStream inStream = new
System.IO.FileStream(@"c:\temp\essai.xaml",
System.IO.FileMode.Open);
using (inStream)
{
return
(Root)System.Windows.Markup.XamlReader.Load(inStre am);
}
Root is created
Structure is created
SimpleText is created
BUT i have after this, an exception like "SimpleText can be added in
Structure" occurs !!
Structure and Root derive from Container class witch supports IEnumerable
and IAddChild interface !!
I don't know what I forgot somewhere ????
could you help me
thanks a lot for your help !

Dec 6 '06 #2
news :

BUT if Structure or Root supports IList ! all work fine !!!!
>a question have no answers : how can I use IAddChild interface ???
"azerty" <az****@aaaa.fra écrit dans le message de news:
eP**************@TK2MSFTNGP03.phx.gbl...
After some research (with Reflector)

It's seems we can not use IAddChild interface in our own classes ???!

an internal method of the framework
(System.Windows.Markup.BamlRecordManager.TreatAsIA ddChild) use this
records :

KnownTypes.Types[0x113].and 0x113 ref a IAddChildInternal, internal
interface witch derivates from public IAddChild interface !!

and so, TradAsIAddChild return false in

System.Windows.Markup.BamlRecordReader.GetFlagsFro mType(Type elementType)

May be some one from Xaml developper team can help me !!!

thanks a lot for your help !
"azerty" <az****@aaaa.fra écrit dans le message de news:
eP****************@TK2MSFTNGP04.phx.gbl...
>Hello

I try to use xaml serializer framework to save in .xaml file my own
hierarchical graph of object.
The first step is done : I create my own file with something like this :
<Root
xmlns="clr-namespace:myNameSpace;assembly=MyAssembly">
<Structure ...>
<SimpleText ... />
</Structure>
</Root>
with a simple call like this :
outStream = new System.IO.FileStream(@"c:\temp\essai.xaml",
System.IO.FileMode.Create);
using (outStream)
{
System.Windows.Markup.XamlWriter.Save(rootInstance ,
outStream);
}
BUT when I want to reverse the process (Create a RootInstance from xaml
file) with a call like this :
System.IO.FileStream inStream = new
System.IO.FileStream(@"c:\temp\essai.xaml",
System.IO.FileMode.Open);
using (inStream)
{
return
(Root)System.Windows.Markup.XamlReader.Load(inStr eam);
}
Root is created
Structure is created
SimpleText is created
BUT i have after this, an exception like "SimpleText can be added in
Structure" occurs !!
Structure and Root derive from Container class witch supports IEnumerable
and IAddChild interface !!
I don't know what I forgot somewhere ????
could you help me
thanks a lot for your help !


Dec 6 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: ajou_king | last post by:
I was running some tests on my Win32 1GHZ processor to see how long it would take to transmit objects numerous times via TCP/IP using C# ..NET Remoting vs the C++ trustworthy method of binary...
0
by: umhlali | last post by:
I get the following exception when my VB.NET app calls a Java web service that returns an array of objects. The same call works for a single object though. So looks like there is no problem...
4
by: Thilaka | last post by:
Hi guys, Recently i read some articles on Longhorn & XAML. & From what i learnt the future for developing UIs lies in XAML. Does this mean that I've got to learn XAML as developing UIs for web...
13
by: Jeff | last post by:
How important is XAML? (or how important is it expected to become during the next 5 years?) Looking for informed opinions. Thanks!
3
by: Brent | last post by:
OK i downloaded the new/addon framework 3 and downloaded the VS 2005 addon. I started with XAML. So far im like mehhhhhhhh. Anyone else have the same opinion? When i first heard about xaml i got...
6
by: moondaddy | last post by:
will CodeDom create XAML windows or just regular windows forms? If so, how to I tell it to create a xaml window instead of a windows form? thanks -- moondaddy@noemail.noemail
0
by: =?Utf-8?B?WmlnZ3lTaG9ydA==?= | last post by:
I have a sample XAML file: <StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <Button Name="button2" Height="23" Width="300" Margin="31,37,0,0" Click="doit">Hello...
6
by: star-italia | last post by:
Hi, Is it possible to include a XAML file into another XAML file? For example If i have - Window1.xaml - Window2.xaml and both have a treeview with a custom Style, can i describe the style...
4
by: moondaddy | last post by:
I have a user control located in the following path: projectFolder/PropertyControls/myControl.xaml and in myControl.xaml I have a reference to a resource dictionary like this: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.