473,800 Members | 2,523 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:myNam eSpace;assembly =MyAssembly">
<Structure ...>
<SimpleText ... />
</Structure>
</Root>
with a simple call like this :
outStream = new System.IO.FileS tream(@"c:\temp \essai.xaml",
System.IO.FileM ode.Create);
using (outStream)
{
System.Windows. Markup.XamlWrit er.Save(rootIns tance,
outStream);
}
BUT when I want to reverse the process (Create a RootInstance from xaml
file) with a call like this :
System.IO.FileS tream inStream = new
System.IO.FileS tream(@"c:\temp \essai.xaml",
System.IO.FileM ode.Open);
using (inStream)
{
return
(Root)System.Wi ndows.Markup.Xa mlReader.Load(i nStream);
}
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 2343
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.BamlRec ordManager.Trea tAsIAddChild) use this records
:

KnownTypes.Type s[0x113].and 0x113 ref a IAddChildIntern al, internal
interface witch derivates from public IAddChild interface !!

and so, TradAsIAddChild return false in

System.Windows. Markup.BamlReco rdReader.GetFla gsFromType(Type elementType)

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

thanks a lot for your help !
"azerty" <az****@aaaa.fr a écrit dans le message de news:
eP************* ***@TK2MSFTNGP0 4.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:myNam eSpace;assembly =MyAssembly">
<Structure ...>
<SimpleText ... />
</Structure>
</Root>
with a simple call like this :
outStream = new System.IO.FileS tream(@"c:\temp \essai.xaml",
System.IO.FileM ode.Create);
using (outStream)
{
System.Windows. Markup.XamlWrit er.Save(rootIns tance,
outStream);
}
BUT when I want to reverse the process (Create a RootInstance from xaml
file) with a call like this :
System.IO.FileS tream inStream = new
System.IO.FileS tream(@"c:\temp \essai.xaml",
System.IO.FileM ode.Open);
using (inStream)
{
return
(Root)System.Wi ndows.Markup.Xa mlReader.Load(i nStream);
}
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.fr a é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.BamlRec ordManager.Trea tAsIAddChild) use this
records :

KnownTypes.Type s[0x113].and 0x113 ref a IAddChildIntern al, internal
interface witch derivates from public IAddChild interface !!

and so, TradAsIAddChild return false in

System.Windows. Markup.BamlReco rdReader.GetFla gsFromType(Type elementType)

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

thanks a lot for your help !
"azerty" <az****@aaaa.fr a écrit dans le message de news:
eP************* ***@TK2MSFTNGP0 4.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:myNam eSpace;assembly =MyAssembly">
<Structure ...>
<SimpleText ... />
</Structure>
</Root>
with a simple call like this :
outStream = new System.IO.FileS tream(@"c:\temp \essai.xaml",
System.IO.FileM ode.Create);
using (outStream)
{
System.Windows. Markup.XamlWrit er.Save(rootIns tance,
outStream);
}
BUT when I want to reverse the process (Create a RootInstance from xaml
file) with a call like this :
System.IO.FileS tream inStream = new
System.IO.File Stream(@"c:\tem p\essai.xaml",
System.IO.FileM ode.Open);
using (inStream)
{
return
(Root)System.W indows.Markup.X amlReader.Load( inStream);
}
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
11964
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 streams. I ran the test for 50K, 100K, 500K iterations, where each iteration consists of sending an object from a client process to a server process, and the server process sends back an ack. Here are the results: .NET Remoting C++...
0
2507
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 serializing the object but there seems to be a problem serializing an array of objects. Any help will be appreciated "Cannot assign object of type System.Object to an object of type ElectronicWallet.C2PTest.PaymentItem." :...
4
2666
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 or win applications will be different? Or will future versions of VS.Net wrap up the XAML hence making it unnecessary for me to know or learn XAML? --
13
2474
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
1930
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 excited as you could put a lot of 3d effects in your apps. Who is with me in thinking that xaml is kind of green right now. Maybe tools will be added in the future that will make it an excellent technology but right now its not that great. There are...
6
5771
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
5728
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 World</Button> </StackPanel> If I compile the application normally, the XAML is converted to a .cs and then an application is built: on clicking the button "doit" gets called if it is code-behind or is embedded in an <x:codeblock within the XAML...
6
10121
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 in a trvStyle.xaml and then include it in both windows? Thanks in advance
4
17944
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: <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary
0
9690
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10501
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10273
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10250
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10032
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7574
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.