Sign in to follow this  

[.net] XAML?

This topic is 4197 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Anyone know of a XAML type framework that works with .net 2.0 and XP? I've searched around a bit but I keep coming up with web related crap. Tim.

Share this post


Link to post
Share on other sites
If you're not afraid of beta software, consider using .NET Framework 3.0. It's available for both XP and Vista, and works with .NET 2.0 (I know, that sounds horribly confusing, but basically .NET 3.0 comes with the 2.0 compilers and libraries, and some additional libraries, one of which handles XAML).

Share this post


Link to post
Share on other sites
Quote:
Original post by mutex
If you're not afraid of beta software, consider using .NET Framework 3.0. It's available for both XP and Vista, and works with .NET 2.0 (I know, that sounds horribly confusing, but basically .NET 3.0 comes with the 2.0 compilers and libraries, and some additional libraries, one of which handles XAML).


The problem with that is distribution. AFAIK you can't distribute a XAML app without the target PC having the beta installed as well.

Share this post


Link to post
Share on other sites
Quite a good point. You could also try coding your own. I managed to write a XAML-like reader/writer in ~500 lines of C# code.

Share this post


Link to post
Share on other sites
Quote:
Original post by mutex
Quite a good point. You could also try coding your own. I managed to write a XAML-like reader/writer in ~500 lines of C# code.


I was afraid of that. [wink] MyXaml doesn't want to install, it complains about me not having .NET 2.0 installed even though I do.

Share this post


Link to post
Share on other sites
I just realized that you might be looking for something beyond XAML. XAML itself is just a serialization language, so the parser I wrote merely reads XML and constructs an object tree from it. If you're looking for XAML + UI objects (either a new library or winforms compatibility), then I don't know how difficult that would be :)

Share this post


Link to post
Share on other sites
http://vgdotnet.com/ works with MyXAML. I've been thinking about looking more closely at that combination, so please post your findings if you succeed in installing/using them!

Share this post


Link to post
Share on other sites
http://www.xamlon.com/

This has been around for quite a while and its a really nice framework for writing XAML apps in .NET 2.0.

*Scratch that, looks like they changed their product line to only be a web based product...

Share this post


Link to post
Share on other sites
WPF (codenamed "Avalon") is the new application-level graphics/UI API for Vista. You get low-level graphics objects like ImageBrush, DrawingContext, but also high-level UI objects like Button, TreeView, and ListView. XAML is simply the way to load all those objects from XML files; at the core it's simply this function:

static object System.Windows.Markup.XamlReader.Load(XmlReader reader)
You can't say it's the primary WPF language because all XAML has a C#, VB, IronPython, etc. counterpart; a good demonstration of this is in this article. The following two are equivalent:
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.BrushExamples.ImageBrushExample"
WindowTitle="ImageBrush Example"
Background="White">

<StackPanel>

<Canvas
Height="200" Width="300">
<Canvas.Background>
<ImageBrush ImageSource="sampleImages\Waterlilies.jpg" />
</Canvas.Background>
</Canvas>


</StackPanel>
</Page>

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;

namespace Microsoft.Samples.BrushExamples
{
public class ImageBrushExample : Page
{
public ImageBrushExample()
{
StackPanel mainPanel = new StackPanel();
canvasBackgroundExample(mainPanel);
this.Content = mainPanel;
}

private void canvasBackgroundExample(Panel mainPanel)
{
BitmapImage theImage = new BitmapImage
(new Uri("sampleImages\\Waterlilies.jpg", UriKind.Relative));

ImageBrush myImageBrush = new ImageBrush(theImage);

Canvas myCanvas = new Canvas();
myCanvas.Width = 300;
myCanvas.Height = 200;
myCanvas.Background = myImageBrush;

mainPanel.Children.Add(myCanvas);
}
}
}
XAML is also used by Windows Workflow Foundation.

[Edited by - mutex on June 17, 2006 1:53:02 PM]

Share this post


Link to post
Share on other sites
Depending on when your application ships, I would suggest going down the .Net 3 route also. .Net 3 is really .Net 2 with a bunch of new libraries and stuff, and it all will all integrate with Visual Studio 2005.

.Net 3 will ship when Vista does.

If you want something right now, then a 3rd party library or rolling your own is the only way to go. You can't redistribute Microsoft Beta stuff legitmately.

Share this post


Link to post
Share on other sites
XAML is an Xml that you use to describe the state of objects. During compilation XAML will be compiled into a binary format called BAML (XAML specifies a couple of shorthand commands/constructions and compiling it also allows some typechecking. During execution the BAML gets loaded into memory instead of running an 'ordinary' constructor.

This very fast for objects that contain a lot of child objects.

So XAML can be used by any app that knows how to parse XAML or BAML.

Cheers

Share this post


Link to post
Share on other sites

This topic is 4197 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this