The type or namespace name could not be found (New to XAML)

So I'm trying to work a very simple dice app on a XAML document using Visual Studio 2012, but I can't figure out what to do with the error. I've tried adding using bitmapimage; but it still won't work.

Here are the errors I'm getting:

Error   1   Undefined namespace. The 'using' URI refers to a namespace 'DiceRoll' that could not be found.
Error   2   The type or namespace name 'BitmapImage' could not be found (are you missing a using directive or an assembly reference?)


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using BitmapImage;

// The Blank Page item template is documented at

namespace DiceRoll
    /// <summary> 
    /// Interaction logic for MainWindow.xaml 
    /// </summary> 
    public partial class MainPage : Page
        public MainPage()

        private void button1_Click(object sender, RoutedEventArgs e)
            Random num = new Random();
            int Number = num.Next(1, 7);
            BitmapImage Img = new BitmapImage(new Uri(@"DiceFaces\" + Number.ToString() + ".bmp", UriKind.Relative));

            textBlock1.Text = Number.ToString() + " Number";
            image1.Source = Img;




        <TextBlock Height="56" HorizontalAlignment="Left" Margin="275,134,0,0" Name="textBlock1"  VerticalAlignment="Top" Width="182" />
        <Button Content="Roll a Dice" Height="23" HorizontalAlignment="Left" Margin="194,151,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
        <Image Height="72" HorizontalAlignment="Left" Margin="195,56,0,0" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="74" />




using System.Windows.Media.Imaging.BitmapImage;

Instead of

using BitmapImage;

An easier way is to let Visual Studio do it for you : Right click on BitmapImage in your code -> resolve, and select the right namespace (there is generaly only one)

For the xaml, let Visual studio do it for you too, or :

<Page ...

Need Your Help

Javascript matrix addition of an arbitrary number of arrays' values, without using

javascript arrays math matrix angularjs

I'm trying to build a helper function for my AngularJS app (but the solution doesn't have to use angular.forEach). The function should take an arbitrary number of arrays with same length and add the

Hide a message box via assembly

assembly mfc ida

One really old program of mine has a message box of an error which keeps being displayed and I need to get rid of it. I've lost the source so I'm using assembly now:

Change the Width of a merged Table Cell in VBA (Word 2010)

vba word-vba word-2010

In MS Word 2010, changing the width of a merged cell is a bit tricksy.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.