--> 아래그림과 같이 '솔루션 탐색기'에서 "images"폴더를 만들고, "images"폴더안에 이미지파일인 "img.jpg"를 추가한다.









-------------------------------------------------------------------------------------




[MainPage.xaml]




<UserControl x:Class="RiaImage.MainPage"

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

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

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable="d"

    d:DesignHeight="300" d:DesignWidth="400">

 

    <Grid x:Name="LayoutRoot" Background="Silver" Height="300" Width="400">

        <Image Source="./images/img.jpg" Margin="30"

            Stretch="UniformToFill"></Image>

    </Grid>

</UserControl>

 

 

 


-------------------------------------------------------------------------------------

 


[실행결과]








-------------------------------------------------------------------------------------




** 참고 **

* DLL 파일에 이미지 포함시키는 방법

- 빌드시 이미지 속성에서 "리소스"로 설정
- <Images Source="/DLL명;component/이미지경로" />

샘플예제
<Image Source="/RiaImage;component/images/img.jpg"




[MainPage.xaml]


<UserControl x:Class="RiaImage.MainPage"

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

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

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable="d"

    d:DesignHeight="300" d:DesignWidth="400">

 

    <Grid x:Name="LayoutRoot" Background="Silver" Height="300" Width="400">

        <Image Source="/RiaImage;component/images/img.jpg" Margin="30"

            Stretch="UniformToFill"></Image>

    </Grid>

</UserControl>

 

 

 

 


-------------------------------------------------------------------------------------

 


[실행결과]








Posted by holland14
: