inline an image into XAML

is it possible to inline an image into a XAML document? possibly using a CDATA section ...

Thanks, casey

[117 byte] By [kcchesnut] at [2007-12-25]
# 1

just threw some code in :)

<Window x:Class="WindowsApplication1.Window1"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

Loaded="Window1_Loaded">

<StackPanel>

</StackPanel>

<x:Code>

<![CDATA[

void Window1_Loaded(object sender, RoutedEventArgs e)

{

this.Title="yoohoo";

TextBox tb = new TextBox();

tb.Text="hello world";

StackPanel sp= this.Content as StackPanel;

sp.Children.Add(tb);

Image myImage3 = new Image();

BitmapImage bi3 = new BitmapImage();

bi3.BeginInit();

bi3.UriSource = new Uri("test.PNG", UriKind.Relative);

bi3.EndInit();

myImage3.Stretch = Stretch.Fill;

myImage3.Source = bi3;

sp.Children.Add(myImage3);

}

]]>

</x:Code>

</Window>

lester-MSFT at 2007-8-31 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 2

no, i really need to know if i can inline image content ... for deployment reasons.

casey

kcchesnut at 2007-8-31 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 3
Actually you can use some graphical tools to convert the image into xaml, I've heard that Microsoft's Expression Graphical Designer can convert images into xaml.

Sheva

ZhouYong at 2007-8-31 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 4

There's no built-in way to have, say, a base64 hex representation of binary content, bitmap or otherwise. You can certainly roll your own in a code section, but that only works if your xaml is compiled, and if you're compiling you can simply attach the bitmap as a resource...

-Adam Smith [MS]

AdamSmithMS at 2007-8-31 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...

Visual Studio Orcas

Site Classified