Search

Tuesday, April 7, 2015
0 comments

Bind Image in code file, Windows Store App

7:35 AMTuesday, April 7, 2015

Design Page

<Page
    x:Class="App1.ImageCode"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:App1"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Image x:Name="image1" HorizontalAlignment="Left" Height="246" Margin="113,131,0,0" VerticalAlignment="Top" Width="296"/>

    </Grid>
</Page>

// Code behind file


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
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.Media.Imaging;
using Windows.UI.Xaml.Navigation;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238

namespace App1
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class ImageCode : Page
    {
        public ImageCode()
        {
            this.InitializeComponent();
            BitmapImage bi = new BitmapImage();
            bi.UriSource = new Uri(this.BaseUri, "joli.jpg");
            image1.Source = bi;


        }
    }
}

Code Generate the following output

Bind Image in code file, Windows Store App

Protected by Copyscape Online Copyright Protection Software

0 comments :

Post a Comment

 
Toggle Footer
Top