Instance

Hi, I’m new to both GoXam and the forums, so first of all, hi to you all, it’s a pleasure…

I’ve been checking the demos, and the examples, the docs, etc, etc, and there’s one thing I don’t understand, and no amount of searching around the net has helped me out, so i’m hoping there’s a kind soul here that can enlighten me on this…

In the double tree demo, there’s a command for opening a stream for the xml file, and in it, there’s this line:

Demo.MainPage.Instance.GetStream(“DoubleTree”, “xml”)

I’m guessing that Demo is the project, but on mine, my MainPage doesn’t have any reference for instance, so the demo gives me an error…

Can someone give me a rundown on how I do this, how i can make that command work?

Thanks you in advance for your time on what might be the most basic thing in the world for you guys,

Kkutlesa

That’s part of the demo framework, not part of the individual sample apps. It’s just getting textual data, XML in this case, that is stored in the demo app as a resource. You can see the definition of GetStream in MainPage.xaml.cs.

The XAML and C# sources for each sample app are also stored in the demo as resources, using the same mechanism, so that the demo framework can show that code for each sample app.

Some of the samples also support saving and loading diagrams as XML. The demo framework has a standard place for that – a TextBox that allows users to edit the XML. That’s the other potential source for textual data.

But of course your application will want to get its data in its own manner. I would not expect you to use any part of the demo framework, although you can if you wish.

Cool, thanks a lot for your help…

Now I’ve got another question (seeing that I made this thread, I think i can turn it into a FAQ thread for myself hahahaha)

I used the example on the documentation to make buttons for collapsing/expanding a tree, works beautifully, but is there a way for the buttons to only show on nodes with descendants? Leaf objects also have the button though it’s useless for them, is there a way to change it so on leaf objects the button is hidden?

Again, thanks for your time,
Kkutlesa

That depends on whether or not the child nodes exist already.

For example, in the IncrementalTree sample, there has to be a button on each Node because whether or not there are children is unknown until the user clicks on the button. Clicking on the button is what generates new node data in the model. (The IncrementalTree sample uses a random number generator, but of course a real application would get the data from the real source.)

On the other hand, the VisualTree sample is working with a complete visual tree of elements. That’s why its Button’s Visibility is data-bound with a converter that looks to see if there really are any child elements in the visual tree.

Actually solved it, just bound the Visibility property of the button to the source data, that way i can make the button Collapsed for leaf nodes…

Thanks for your help,
Kkutlesa