'.NET프로그래밍'에 해당되는 글 690건

  1. 2009.12.09 Silverlight에서 CSS 접근
  2. 2009.12.08 Silverlight에서 HTML 접근
  3. 2009.12.08 로컬 커넥션
  4. 2009.12.08 Navigation Framework 사용
  5. 2009.12.08 Navigation Application
  6. 2009.12.08 다중 페이지 구성
  7. 2009.12.08 OOB(Out Of Browser)
  8. 2009.12.07 Image Deep Zoom
  9. 2009.12.07 Effect (효과)
  10. 2009.12.07 MouseDragElementBehavior


- 동적으로 스타일시트의 값 변경 가능





"RiaCssTestPage.html"에서 아래와 같이 코드를 수정하여 실버라이트 영역(사이즈)을 설정한다.





[RiaCssTestPage.html]


#silverlightControlHost {

                      height: 300px; width:300px; border:1px dotted red;

                      text-align:center;

    }

    </style>




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


<body>

    <form id="form1" runat="server" style="height:100%">

    <h3>실버라이트 영역</h3>

    <div id="silverlightControlHost">

        <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">

                                     <param name="source" value="ClientBin/RiaCss.xap"/>

                                     <param name="onError" value="onSilverlightError" />

                                     <param name="background" value="white" />

                                     <param name="minRuntimeVersion" value="3.0.40818.0" />

                                     <param name="autoUpgrade" value="true" />

                                     <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40818.0" style="text-decoration:none">

                                                      <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>

                                     </a>

                      </object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>

    </div>

   

    <h3>HTML 영역</h3>

    <div id="divHello" style="background-color:Yellow;">

        안녕하세요...

    </div>

   

    </form>

</body>

 







[MainPage.xaml]


<UserControl x:Class="RiaCss.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">

 

    <Canvas x:Name="LayoutRoot" Background="White">

        <Rectangle

            x:Name="greenRect" Width="100" Height="100" Canvas.Left="50" Canvas.Top="50" Fill="Green" />

        <Rectangle

            x:Name="blueRect" Width="100" Height="100" Canvas.Left="150" Canvas.Top="150" Fill="Blue" />

    </Canvas>

</UserControl>

 

 







[MainPage.xaml.cs]


using System;

using System.Collections.Generic;

using System.Linq;

using System.Net;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Animation;

using System.Windows.Shapes;

using System.Windows.Browser;

 

namespace RiaCss

{

    public partial class MainPage : UserControl

    {

        public MainPage()

        {

            InitializeComponent();

 

            greenRect.MouseEnter += new MouseEventHandler(greenRect_MouseEnter);

            blueRect.MouseEnter += new MouseEventHandler(blueRect_MouseEnter);

        }

 

        void blueRect_MouseEnter(object sender, MouseEventArgs e)

        {

            //[1] HTML 페이지에 접근

            HtmlDocument document = HtmlPage.Document;

            //[2] HTML 레이어(div) 접근

            if (document.GetElementById("divHello") != null)

            {

                //[3] 해당 요소 가져오기

                HtmlElement div = document.GetElementById("divHello");

                //[4] 새로운 스타일 적용

                div.SetStyleAttribute("backgroundColor", "blue");

            }

        }

 

        void greenRect_MouseEnter(object sender, MouseEventArgs e)

        {

            //[1] HTML 페이지에 접근

            HtmlDocument document = HtmlPage.Document;

            //[2] HTML 레이어(div) 접근

            if (document.GetElementById("divHello") != null)

            {

                //[3] 해당 요소 가져오기

                HtmlElement div = document.GetElementById("divHello");

                //[4] 새로운 스타일 적용

                div.SetStyleAttribute("backgroundColor", "green");

            }

        }

    }

}

 

 





























'.NET프로그래밍 > Silverlight 3.0' 카테고리의 다른 글

Silverlight에서 쿼리스트링 정보 얻기  (0) 2009.12.09
Silverlight에서 JavaScript 접근  (0) 2009.12.09
Silverlight에서 HTML 접근  (0) 2009.12.08
로컬 커넥션  (0) 2009.12.08
Navigation Framework 사용  (0) 2009.12.08
Posted by holland14
:



- DOM 요소에 접근할 수 있는 API 제공





Silverlight에서 HTML에 접근하는 것을 실습하기 위해 "RiaHtmlTestPage.html"에서 아래와 같이 소스를 수정하여 실버라이트가 적용되는 영역(사이즈)을 설정한다.






[RiaHtmlTestPage.html]에서 해당부분만 소스코드 수정 및 코딩


#silverlightControlHost {

                      height: 200px; width:300px; border: 1px solid red;

                      text-align:center;

    }

    </style>

 


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


<body>

    <form id="form1" runat="server" style="height:100%">

    <h3>실버라이트 영역</h3>

    <div id="silverlightControlHost">

        <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">

                                     <param name="source" value="ClientBin/RiaHtml.xap"/>

                                     <param name="onError" value="onSilverlightError" />

                                     <param name="background" value="white" />

                                     <param name="minRuntimeVersion" value="3.0.40818.0" />

                                     <param name="autoUpgrade" value="true" />

                                     <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40818.0" style="text-decoration:none">

                                                      <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>

                                     </a>

                      </object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>

    </div>

    <h3>HTML 영역</h3>

    <input type="text" id="txtName" />

    </form>

</body>

 









[MainPage.xaml]


<UserControl x:Class="RiaHtml.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="White">

        <Button x:Name="btnGet" Content="HTML 텍스트박스에서 가져오기" />

    </Grid>

</UserControl>

 

 






[MainPage.xaml.cs]


using System;

using System.Collections.Generic;

using System.Linq;

using System.Net;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Animation;

using System.Windows.Shapes;

using System.Windows.Browser;

 

namespace RiaHtml

{

    public partial class MainPage : UserControl

    {

        public MainPage()

        {

            InitializeComponent();

 

            btnGet.Click += new RoutedEventHandler(btnGet_Click);

        }

 

        void btnGet_Click(object sender, RoutedEventArgs e)

        {

            //[1] HTML 페이지에 대한 정보 얻어오기

            HtmlDocument document = HtmlPage.Document;

            //[!] 예외처리 : 정확한 요소 이름이 기록되었을 때에만 Get/Set

            if (document.GetElementById("txtName") != null)

            {

                //[2] HTML 요소 접근

                HtmlElement txtName = document.GetElementById("txtName");

                //[3] 요소의 읽어오기 : HTML -> Silverlight

                string strName = txtName.GetProperty("value").ToString();

                MessageBox.Show("입력된 : " + strName);

                //[4] Silverlight에서 만들어진 정보를 해당 텍스트박스에 출력 : Silverlight -> HTML

                document.GetElementById("txtName").SetProperty("value", DateTime.Now.ToShortTimeString());

            }

        }

    }

}

 

 







[실행결과]













'.NET프로그래밍 > Silverlight 3.0' 카테고리의 다른 글

Silverlight에서 JavaScript 접근  (0) 2009.12.09
Silverlight에서 CSS 접근  (0) 2009.12.09
로컬 커넥션  (0) 2009.12.08
Navigation Framework 사용  (0) 2009.12.08
Navigation Application  (0) 2009.12.08
Posted by holland14
:


- 로컬 커넥션
    - 로컬 환경에서의 실버라이트 응용 프로그램간의 데이터 송수신

- LocalMessageSender 클래스
    - 로컬 인스턴스로 문자열을 보내주는 클래스
        - SendAsyc 메서드

- LocalMessageReceiver 클래스
    - 넘겨받은 문자열을 받아서 처리해주는 클래스
        - MessageReceived 이벤트
        - Listen() 메서드 : 문자열 받기 대기 상태로 전환







"새 프로젝트"만들기로 "RiaRiaLocalMessageSender"를 만들고 "MainPage.xaml"과 "MainPage.xaml.cs"에 다음과 같이 코딩한다.



[MainPage.xaml]


<UserControl x:Class="RiaLocalMessageSender.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="White">

        <StackPanel>

            <TextBox x:Name="first"></TextBox>

            <TextBlock Text="+"></TextBlock>

            <TextBox x:Name="second"></TextBox>

            <Button x:Name="btnCalc" Content="다른 곳으로 전달해서 계산"></Button>

        </StackPanel>

    </Grid>

</UserControl>

 

 





[MainPage.xaml.cs]


using System;

using System.Collections.Generic;

using System.Linq;

using System.Net;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Animation;

using System.Windows.Shapes;

using System.Windows.Messaging;

 

namespace RiaLocalMessageSender

{

    public partial class MainPage : UserControl

    {

        // 로컬 네트워크로 데이터 전송

        private LocalMessageSender lms;

        public MainPage()

        {

            InitializeComponent();

            lms = new LocalMessageSender("Calc");

            lms.SendCompleted += new EventHandler<SendCompletedEventArgs>(lms_SendCompleted);

            this.btnCalc.Click += new RoutedEventHandler(btnCalc_Click);

        }

 

        void lms_SendCompleted(object sender, SendCompletedEventArgs e)

        {

            MessageBox.Show("로컬로 전송되었습니다.");

        }

 

        void btnCalc_Click(object sender, RoutedEventArgs e)

        {

            lms.SendAsync(first.Text + "," + second.Text); // 2개의 수를 콤마로 구분해서 전달(로컬로...)

        }

    }

}

 

 







다시 "새 프로젝트"만들기로 "RiaLocalMessageReceiver"를 만들고(여기서는 Visual Studio를 하나 더 열어서 "RiaLocalMessageReceiver"를 만들었다.) "MainPage.xaml"과 "MainPage.xaml.cs"에 다음과 같이 코딩한다.



[MainPage.xaml]


<UserControl x:Class="RiaLocalMessageReceiver.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="White">

        <TextBlock x:Name="result"></TextBlock>

    </Grid>

</UserControl>

 

 






[MainPage.xaml.cs]


using System;

using System.Collections.Generic;

using System.Linq;

using System.Net;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Animation;

using System.Windows.Shapes;

using System.Windows.Messaging;

 

namespace RiaLocalMessageReceiver

{

    public partial class MainPage : UserControl

    {

        // 로컬 네트워크에서 전송된 값을 받기

        private LocalMessageReceiver lmr;

        public MainPage()

        {

            InitializeComponent();

            lmr = new LocalMessageReceiver("Calc");

            lmr.MessageReceived += new EventHandler<MessageReceivedEventArgs>(lmr_MessageReceived);

            lmr.Listen(); // 대기(넘겨줄 때까지)

        }

 

        void lmr_MessageReceived(object sender, MessageReceivedEventArgs e)

        {

            string[] arr = e.Message.Split(','); // 3,5

            int first = Convert.ToInt32(arr[0]); // 3

            int second = Convert.ToInt32(arr[1]); // 5

            this.result.Text = (first + second).ToString(); // 8

        }

    }

}

 

 








* 여기서는 Visual Studio를 2개 열어서 실행하였으므로, "RiaRiaLocalMessageSender"프로젝트 파일과 "RiaLocalMessageReceiver"프로젝트 파일을 따로 열어서 실행(F5 / Ctl + F5)하여 결과를 확인해본다.








[실행결과]













'.NET프로그래밍 > Silverlight 3.0' 카테고리의 다른 글

Silverlight에서 CSS 접근  (0) 2009.12.09
Silverlight에서 HTML 접근  (0) 2009.12.08
Navigation Framework 사용  (0) 2009.12.08
Navigation Application  (0) 2009.12.08
다중 페이지 구성  (0) 2009.12.08
Posted by holland14
:



아래 그림과 같이 "새 프로젝트"를 만든다.





'솔루션 탐색기'에서 아래 그림과 같이 '새 폴더'를 추가하여 "Views"폴더를 생성하고, "Views"폴더 안에 "새 항목 추가"로 "Silverlight Page"형식으로 "Home.xaml / About.xaml / Board.xaml"파일을 추가하고 아래와 같이 코딩한다.











[Home.xaml]


<navigation:Page x:Class="RiaNavigationFramework.Views.Home"

           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"

           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"

           d:DesignWidth="640" d:DesignHeight="480"

           Title="Home">

    <Grid x:Name="LayoutRoot">

        <ScrollViewer>

            <TextBlock Text="여기는 홈입니다." />

        </ScrollViewer>

    </Grid>

</navigation:Page>

 

 






[About.xaml]


<navigation:Page x:Class="RiaNavigationFramework.Views.About"

           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"

           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"

           d:DesignWidth="640" d:DesignHeight="480"

           Title="About Page">

    <Grid x:Name="LayoutRoot">

        <ScrollViewer>

            <TextBlock Text="여기는 About 페이지입니다." />

        </ScrollViewer>

    </Grid>

</navigation:Page>

 

 








[Board.xaml]


<navigation:Page x:Class="RiaNavigationFramework.Views.Board"

           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"

           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"

           d:DesignWidth="640" d:DesignHeight="480"

           Title="게시판">

    <Grid x:Name="LayoutRoot">

        <ScrollViewer>

            <TextBlock Text="여기는 게시판입니다." />

        </ScrollViewer>

    </Grid>

</navigation:Page>

 

 






[MainPage.xaml]


<UserControl x:Class="RiaNavigationFramework.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"

 

    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"

    xmlns:uriMapper="clr-namespace:System.Windows.Navigation;assembly=System.Windows.Controls.Navigation"

 

    mc:Ignorable="d"

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

 

    <Grid x:Name="LayoutRoot" Background="White">

        <Grid.RowDefinitions>

            <RowDefinition Height="Auto" />

            <RowDefinition Height="*" />

        </Grid.RowDefinitions>

 

        <!-- 메뉴 -->

        <StackPanel Grid.Row="0" Orientation="Horizontal">

            <HyperlinkButton Content="HOME" NavigateUri="/Views/Home.xaml" TargetName="ContentFrame"></HyperlinkButton>

            <HyperlinkButton Content="Board" NavigateUri="Board" TargetName="ContentFrame"></HyperlinkButton>

            <HyperlinkButton Content="About" NavigateUri="/Views/About.xaml" TargetName="ContentFrame"></HyperlinkButton>

        </StackPanel>

 

        <!-- Navigation Framework 사용해서 내용 출력 -->

        <navigation:Frame x:Name="ContentFrame" Source="/Views/Home.xaml" Grid.Row="1">

            <navigation:Frame.UriMapper>

                <uriMapper:UriMapper>

                    <!-- URI 줄여서 표기 : /Views/Board.xaml Board -->

                    <uriMapper:UriMapping Uri="Board" MappedUri="/Views/Board.xaml" />

                </uriMapper:UriMapper>

            </navigation:Frame.UriMapper>

        </navigation:Frame>

    </Grid>

</UserControl>

 

 










'.NET프로그래밍 > Silverlight 3.0' 카테고리의 다른 글

Silverlight에서 HTML 접근  (0) 2009.12.08
로컬 커넥션  (0) 2009.12.08
Navigation Application  (0) 2009.12.08
다중 페이지 구성  (0) 2009.12.08
OOB(Out Of Browser)  (0) 2009.12.08
Posted by holland14
:



"새 프로젝트"추가로 아래 그림과 같이 프로젝트를 하나 만든다.










아래그림과 같이 '솔루션 탐색기'에서 "Views"폴더에 '새 항목 추가'로 "Board.xaml"파일을 추가하고 "Board.xaml"와 "MainPage.xaml"를 아래와 같이 코딩한다.













[Board.xaml]


<navigation:Page x:Class="RiaNavigationApplicattion.Views.Board"

           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"

           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"

           d:DesignWidth="640" d:DesignHeight="480"

           Title="게시판">

    <Grid x:Name="LayoutRoot">

        <ScrollViewer x:Name="PageScrollViewer" Style="{StaticResource PageScrollViewerStyle}">

 

            <StackPanel x:Name="ContentStackPanel">

 

                <TextBlock x:Name="HeaderText" Style="{StaticResource HeaderTextStyle}"

                           Text="게시판"/>

                <TextBlock x:Name="ContentText" Style="{StaticResource ContentTextStyle}"

                           Text="게시판의 내용이 들어오는 ..."/>

 

            </StackPanel>

 

        </ScrollViewer>

    </Grid>

</navigation:Page>

 

 





[MainPage.xaml]


<UserControl

    x:Class="RiaNavigationApplicattion.MainPage"

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

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

    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"

    xmlns:uriMapper="clr-namespace:System.Windows.Navigation;assembly=System.Windows.Controls.Navigation"

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">

 

    <Grid x:Name="LayoutRoot" Style="{StaticResource LayoutRootGridStyle}">

 

        <Border x:Name="ContentBorder" Style="{StaticResource ContentBorderStyle}">

 

            <navigation:Frame x:Name="ContentFrame" Style="{StaticResource ContentFrameStyle}"

                              Source="/Home" Navigated="ContentFrame_Navigated" NavigationFailed="ContentFrame_NavigationFailed">

                <navigation:Frame.UriMapper>

                  <uriMapper:UriMapper>

                    <uriMapper:UriMapping Uri="" MappedUri="/Views/Home.xaml"/>

                    <uriMapper:UriMapping Uri="/{pageName}" MappedUri="/Views/{pageName}.xaml"/>

                  </uriMapper:UriMapper>

                </navigation:Frame.UriMapper>

            </navigation:Frame>

        </Border>

 

        <Grid x:Name="NavigationGrid" Style="{StaticResource NavigationGridStyle}">

 

            <Border x:Name="BrandingBorder" Style="{StaticResource BrandingBorderStyle}">

                <StackPanel x:Name="BrandingStackPanel" Style="{StaticResource BrandingStackPanelStyle}">

 

                    <ContentControl Style="{StaticResource LogoIcon}"/>

                    <TextBlock x:Name="ApplicationNameTextBlock" Style="{StaticResource ApplicationNameStyle}"

                               Text="Application Name"/>

 

                </StackPanel>

            </Border>

 

            <Border x:Name="LinksBorder" Style="{StaticResource LinksBorderStyle}">

                <StackPanel x:Name="LinksStackPanel" Style="{StaticResource LinksStackPanelStyle}">

 

                    <HyperlinkButton x:Name="Link1" Style="{StaticResource LinkStyle}"

                                     NavigateUri="/Home" TargetName="ContentFrame" Content="home"/>

                                                                                                                                                                

                    <Rectangle x:Name="Divider1" Style="{StaticResource DividerStyle}"/>

                                                                                       

                    <HyperlinkButton x:Name="Link2" Style="{StaticResource LinkStyle}"

                                     NavigateUri="/About" TargetName="ContentFrame" Content="about"/>

 

                    <Rectangle x:Name="Divider2" Style="{StaticResource DividerStyle}"/>

 

                    <HyperlinkButton x:Name="lnkBoard" Style="{StaticResource LinkStyle}"

                        NavigateUri="/Board" TargetName="ContentFrame" Content="게시판" />

 

                </StackPanel>

            </Border>

 

        </Grid>

 

    </Grid>

 

</UserControl>

 







.

[실행결과]










'.NET프로그래밍 > Silverlight 3.0' 카테고리의 다른 글

로컬 커넥션  (0) 2009.12.08
Navigation Framework 사용  (0) 2009.12.08
다중 페이지 구성  (0) 2009.12.08
OOB(Out Of Browser)  (0) 2009.12.08
Image Deep Zoom  (0) 2009.12.07
Posted by holland14
:




[FrmWrite.xaml]


<UserControl x:Class="RiaMultiPage.FrmWrite"

    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="White">

        <StackPanel>

            <TextBlock Text="여기는 글쓰기 페이지" FontSize="30"></TextBlock>

            <Button x:Name="btnList" Content="리스트 페이지로 이동" />

        </StackPanel>

    </Grid>

</UserControl>

 

 





[FrmWrite.xaml.cs]


using System;

using System.Collections.Generic;

using System.Linq;

using System.Net;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Animation;

using System.Windows.Shapes;

 

namespace RiaMultiPage

{

    public partial class FrmWrite : UserControl

    {

        public FrmWrite()

        {

            InitializeComponent();

            this.btnList.Click += new RoutedEventHandler(btnList_Click);

        }

 

        void btnList_Click(object sender, RoutedEventArgs e)

        {

            MainPage mp = this.Parent as MainPage; mp.Navigate(new FrmList());

        }

    }

}

 

 





[FrmList.xaml]


<UserControl x:Class="RiaMultiPage.FrmList"

    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="White">

        <StackPanel>

            <TextBlock Text="여기는 리스트 페이지" FontSize="30"></TextBlock>

            <Button x:Name="btnWrite" Content="글쓰기 페이지로 이동" />

        </StackPanel>

    </Grid>

</UserControl>

 

 





[FrmList.xaml.cs]


using System;

using System.Collections.Generic;

using System.Linq;

using System.Net;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Animation;

using System.Windows.Shapes;

 

namespace RiaMultiPage

{

    public partial class FrmList : UserControl

    {

        public FrmList()

        {

            InitializeComponent();

 

            this.btnWrite.Click += new RoutedEventHandler(btnWrite_Click);

        }

 

        void btnWrite_Click(object sender, RoutedEventArgs e)

        {

            // 메인 페이지(나의 부모) Navigate 메서드 호출

            MainPage mp = this.Parent as MainPage;

 

            // 이동 메서드 호출

            mp.Navigate(new FrmWrite());

        }

    }

}

 

 







[MainPage.xaml]


<UserControl x:Class="RiaMultiPage.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">

 

</UserControl>

 

 





[MainPage.xaml.cs]


using System;

using System.Collections.Generic;

using System.Linq;

using System.Net;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Animation;

using System.Windows.Shapes;

 

namespace RiaMultiPage

{

    /// <summary>

    /// 컨테이너 역할 : 다른 UserControl 인클루드 시켜주는 역할

    /// </summary>

    public partial class MainPage : UserControl

    {

        public MainPage()

        {

            InitializeComponent();

 

            //[!] 처음 로드시에는 FrmList.xaml 로드

            if (this.Content == null)

            {

                this.Content = new FrmList(); // 리스트 페이지를 기본으로...

            }

        }

 

        //[!] 페이지 이동 메서드

        public void Navigate(UserControl nextPage)

        {

            // 현재(MainPage) 내용을 새로운 UserControl 변경

            this.Content = nextPage;

        }

    }

}

 

 















'.NET프로그래밍 > Silverlight 3.0' 카테고리의 다른 글

Navigation Framework 사용  (0) 2009.12.08
Navigation Application  (0) 2009.12.08
OOB(Out Of Browser)  (0) 2009.12.08
Image Deep Zoom  (0) 2009.12.07
Effect (효과)  (0) 2009.12.07
Posted by holland14
:



[MainPage.xaml]


<UserControl x:Class="RiaOutOfBrowser.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="White">

        <Button x:Name="btnClock" Content="현재시간"></Button>

    </Grid>

</UserControl>

 

 




[MainPage.xaml.cs]


using System;

using System.Collections.Generic;

using System.Linq;

using System.Net;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Animation;

using System.Windows.Shapes;

 

namespace RiaOutOfBrowser

{

    public partial class MainPage : UserControl

    {

        public MainPage()

        {

            InitializeComponent();

 

            btnClock.Click += new RoutedEventHandler(btnClock_Click);

        }

 

        void btnClock_Click(object sender, RoutedEventArgs e)

        {

            MessageBox.Show(DateTime.Now.ToString(), "현재시간", MessageBoxButton.OK);

 

        }

    }

}

 

 







'솔루션 탐색기'에서 "해당 프로젝트에 마우스 우클릭 - 속성(Properties)"창 들어가서 아래와 같이 체크하고 다시빌드하기












"속성창" 위의 그림과 같이 설정하고 '다시빌드'한 후 아래그림과 같이 실행한다.











--> '바탕화면'에 바로가기가 설치된 화면.












--> OOB설정한 것을 삭제하고 싶으면 아래 그림과 같이 하면된다.(삭제가 쉽다.)
















'.NET프로그래밍 > Silverlight 3.0' 카테고리의 다른 글

Navigation Application  (0) 2009.12.08
다중 페이지 구성  (0) 2009.12.08
Image Deep Zoom  (0) 2009.12.07
Effect (효과)  (0) 2009.12.07
MouseDragElementBehavior  (0) 2009.12.07
Posted by holland14
:



아래그림과 같이 "Microsoft Expression"폴더의 "Deep Zoom Composer"를 실행한다. (그리고 실행할 때는 로컬이 아닌 반드시 "웹서버"에서 실행해야 실행된다.)









* Import - Add Image로 사용할 이미지 불러오기






* Compose - 불러온 이미지로 레이아웃 설정






* Export - Export 옵션 설정한 후 Export















'.NET프로그래밍 > Silverlight 3.0' 카테고리의 다른 글

다중 페이지 구성  (0) 2009.12.08
OOB(Out Of Browser)  (0) 2009.12.08
Effect (효과)  (0) 2009.12.07
MouseDragElementBehavior  (0) 2009.12.07
FluidMoveBehavior  (0) 2009.12.07
Posted by holland14
:



[MainPage.xaml]


<UserControl x:Class="RiaEffect.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="White">

        <StackPanel>

            <Button Content="기본버튼" Margin="10" Width="100" />

            <Button Content="블러효과" Margin="10" Width="100">

                <Button.Effect>

                    <BlurEffect Radius="2"></BlurEffect>

                </Button.Effect>

            </Button>

            <Button Content="드롭쉐도우효과" Margin="10" Width="100">

                <Button.Effect>

                    <DropShadowEffect Color="red" Opacity="0.8" BlurRadius="3"></DropShadowEffect>

                </Button.Effect>

            </Button>

        </StackPanel>

    </Grid>

</UserControl>

 

 













'.NET프로그래밍 > Silverlight 3.0' 카테고리의 다른 글

OOB(Out Of Browser)  (0) 2009.12.08
Image Deep Zoom  (0) 2009.12.07
MouseDragElementBehavior  (0) 2009.12.07
FluidMoveBehavior  (0) 2009.12.07
PlaySoundAction  (0) 2009.12.07
Posted by holland14
:



[FrmMouseDragElementBehavior.xaml]



<UserControl

    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"

    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:il="clr-namespace:Microsoft.Expression.Interactivity.Layout;assembly=Microsoft.Expression.Interactions" x:Class="RiaBehavior.FrmMouseDragElementBehavior"

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

    <Grid x:Name="LayoutRoot" Background="White">

 

              <Rectangle Fill="#FFD62222" Stroke="Black" Height="63" HorizontalAlignment="Left" Margin="47,57,0,0" VerticalAlignment="Top" Width="108">

                               <i:Interaction.Behaviors>

                                                 <il:MouseDragElementBehavior/>

                               </i:Interaction.Behaviors>

              </Rectangle>

              <Button Height="65" Margin="198,0,90,78" VerticalAlignment="Bottom" Content="Button">

                               <i:Interaction.Behaviors>

                                                 <il:MouseDragElementBehavior/>

                               </i:Interaction.Behaviors>

              </Button>

 

    </Grid>

</UserControl>

 

 



















'.NET프로그래밍 > Silverlight 3.0' 카테고리의 다른 글

Image Deep Zoom  (0) 2009.12.07
Effect (효과)  (0) 2009.12.07
FluidMoveBehavior  (0) 2009.12.07
PlaySoundAction  (0) 2009.12.07
HyperlinkAction  (0) 2009.12.07
Posted by holland14
: