inline an image into XAML
is it possible to inline an image into a XAML document? possibly using a CDATA section ...
Thanks, casey
is it possible to inline an image into a XAML document? possibly using a CDATA section ...
Thanks, casey
just threw some code in :)
<
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>Sheva
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]