1

I have a WPF .NET 3.5 app that draws transparent tile layers on top of one another using an ImageDrawing and DrawingGroup.

I'm trying to convert this for Windows 8 using Metro.

Microsoft's porting overview at http://msdn.microsoft.com/en-us/library/windows/apps/hh465136.aspx suggests changing System.Windows namespace references to Windows.UI.Xaml. This helped with most things, but I haven't found ImageDrawing and DrawingGroup and didn't find any mention of them in Windows.UI.Xaml.

Do they exist in Metro? If so, where, or if not, what can I use to accomplish an equivalent task?

Here's an example code I'm using:

    Windows.UI.Xaml.Controls.Image img = mapGrid.Children.Cast<Windows.UI.Xaml.Controls.Image>().First(e => Grid.GetRow(e) == 2 && Grid.GetColumn(e) == 4);

    if (img != null)
    {
        Uri back = new Uri("tiles/green.png", UriKind.RelativeOrAbsolute);
        Windows.UI.Xaml.Media.ImageDrawing background = new Windows.UI.Xaml.Media.ImageDrawing(new Windows.UI.Xaml.Media.Imaging.BitmapImage(back), new Rect(0, 0, 32, 32));
        Windows.UI.Xaml.Media.DrawingGroup myDrawingGroup = new Windows.UI.Xaml.Media.DrawingGroup();
        myDrawingGroup.Children.Add(background);
        // Add one or more foreground tiles here, removed for brevity.
    }

Fully qualified namespaces for clarity (I hope).

3
  • Nope. No ImageDrawing, DrawingGroups or many other features in Metro
    – Denis
    Apr 10, 2012 at 17:43
  • Any recommended way to render transparent images stacked on top of each other in the same location? Apr 10, 2012 at 20:38
  • 1
    if that is all you need then just put multiple image controls inside a Grid.
    – Denis
    Apr 10, 2012 at 23:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.