티스토리 툴바




Microsoft MVP 행사때 들었던 ASP.NET MVC 관련 세션...
이때만해도 Microsoft ASP.NET MVC에는 큰 관심을 갖고 있지 않았다. 3년이 지난 지금 내가 ASP.NET MVC를 개발
하리라곤 생각지도 못했다

그저 새로운 주제라서 세션을 들었을 뿐이었다. MVC 개념은 이미 나온지 한참 되었지만 Microsoft에서 ASP.NET에
MVC 패턴을 도입한 것은 오래 되지 않았다.

꾸준하게 몇 번의 버전업이 되고 현재는 ASP.NET MVC 3까지 나온상태이다. Visual Studio 2010에 추가해서 개발할
수 있도록 되어 있다.

이럴줄 알았으면 ASP.NET MVC가 발표되고 몇 해가 지났는데 진즉에 관심이라도 갖고 있었으면 좋았거늘... 다소 늦은
감이 있다.







ASP.NET MVC 세션을 진행했던 왼쪽부터 Phil Haack, Scott Hanselman 이다.
시간이 갈수록 개발 패러다임도 계속 바뀌는 것 같고 그 속도에 발을 맞추기 못하는 것 같다. 아무래도 개발자로서의 역량이나
열정등이 많이 떨어졌다.

디자인과 코드의 완벽한 분리 그리고 즉 예전부터 강조되었던 코드의 재사용성과 블럭(객체, 모듈, 비지니스 서비스, 도메인 등....)의
느슨한 결합을 통한 유연성 있는 개발을 할 수 있는 구조로 계속 변해 가는 것 같다.












ASP.NET 의 아버지? Scott Guthrie 이분은 정말 Microsoft에서 없어서는 안될 핵심중의 핵심이라 할 수 있다.
이때만해도 Silverlight와 WPF에 가장 큰 관심이 있었던지라 다른 분야는 생각하지 않았다.
2008년도만 해도 Silverlight는 떠오르는 기술중에 하나였다. 현재는 Silverlight 4가 나와 있는 상태고 Silverlight 5도
얼마전부터 이야기가 나오기 시작했다.

그런데 Silverlight와 WPF는 요즘 Microsoft의 서자(庶子)가 되버린 느낌이 든다.

Microsoft가 하도 많은 기술들을 쏟아 내면서 삽질을 하면서 몇 몇의 기술들은 그대로 사장되버리는 경우가 종종
있었다. Microsoft가 모바일 시장을 개척해 놓고도 거지같은 윈도우 모바일 OS 때문에 소비자들에게 외면을 받으
면서 시장을 애플과 안드로이드 진영에 모두 잠식당한 상태이다. 그런와중에 Silverlight 플랫폼을 핵심으로 하는
새로운 모바일 OS인 Windows Mobile 7 을 최근에 선보였다. 과연 이미 들어와 있는 다른 OS들을 따돌리고 다시 옛날에
잃어버린 시장을 되찾을 수 있을지 앞으로의 모바일 시장에서 관전포인트가 될 것이다.

Windows Mobile 7 을 계기로 Silverlight의 주가를 높일 수 있을지도 크 관심거리이다.






Silverlight에 대해 열정적으로 강의하는 Scott Guthrie














두서 없이 앝은 지식같지 않은 지식으로 이것저것 깨작거렸다.

PS) 시애틀이란 도시는 내게 큰 희망과 충격을 동시에 안겨준 도시이다. 정말 내가 부족한 것이 많다는 것과
앞으로 내가 무엇을 해야 할지 알게 해준 고마운 도시이다.(참고:시애틀의 마지막 여정) 그만큼 애착이
많이 가는 도시이다. 10년동안 꿈꿨고 어렵게 개발자가 되어 길다면 길고 짧다고 생각하면 짧은 시간이었지만
개발자로서의 삶을 살 수 있었다.

앞으로 얼마나 더 이 일을 할지는 모르지만... 그리 길지는 않을 것이라 생각한다. 그래서 더 지금의 시간들이
나에게 한순간 순간마나 소중할 수 밖에 없는 것이다. 이 일이 끝날때쯤 난 다시 시애틀로 발걸음을 향하고 있
을 것이다. 뜨거운 열정을 안겨준 고맙고 소중한 시애틀에서 자전거 세계일주의 시작을 고할것이다.



저작자 표시 비영리 변경 금지
크리에이티브 커먼즈 라이선스
Creative Commons License
http://www.taedi.kr/trackback/634 관련글 쓰기

새벽부터 PDC 2008에 관한 기사와 블로그 글들이 쏟아지고 있습니다. 아!! 이제 또 정신 못차리게 되겠구나, 바빠지겠구나 라는 생각이 듭니다. ^^

Microsoft® Silverlight™ Tools for Visual Studio 2008 SP1 정식 버전이 최종 릴리즈 되었습니다. 다운로드는 여기에서 받으세요, 영문판만 발표된 것 같은데 각 언어권별로 같이 릴리즈 되었네요, 그런데 한글판은 아직 출시안된 것 같습니다. 한글판은 좀 기달려야 할 것 같습니다. (철수네 소프트웨어 세상 블로그를 참고하세요)

또. Toolkit release & Themes도 같이 발표되었습니다. 기존 WPF와 ASP.NET AJAX에 있었던 좋은 컨트롤들이 포함되어 발표되었습니다.

사용자 삽입 이미지


발표된 Toolkit 안에 포함된 컨트롤입니다.

  • AutoCompleteBox
  • Chart
  • DockPanel
  • Label
  • Expander
  • TreeView
  • UpDown
  • ViewBox
  • WrapPanel
  • ImplicitStyleManager


이와관련해서 공도님이 정성스럽게 정리를 해주셨습니다. 또 Jesse Liberty의 블로그에 소스코드까지 첨부되어서
자세히 분석되어져 있습니다.

실버라이트도 개발툴과 런타임이 최종적으로 정식 릴리즈 되었으니 시장에서 플래시와의 대대적인 한판싸움은 피할 수 없게 된 것 같습니다. 뭐 서로 상생해 가면서 발전할 수 있다면 더욱 좋은 것이겠지요. 실버라이트의 시장에서의 파급효과가 얼마나 커질지 앞으로가 주목됩니다.

크리에이티브 커먼즈 라이선스
Creative Commons License
http://www.taedi.kr/trackback/297 관련글 쓰기
그동안 써왔던 Silverlight 2 Controls Review 강좌목록을 정리했습니다.

Silverlight 2 Controls Reivew - TextBox, Button, TextBlack
Silverlight 2 Controls Review - DataPicker, Calendar
Silverlight 2 Controls Review - CheckBox, RadioButton
Silverlight 2 Controls Review - ComboBox
Silverlight 2 Controls Review - ListBox
Silverlight 2 Controls Review - MediaElement
Silverlight 2 Controls Review - Slider
Silverlight 2 Controls Review - ToggleButton
Silverlight 2 Controls Review - HyperlinkButton
Silverlight 2 Controls Review - Border

Silverlight 2 Controls Review - Canvas
Silverlight 2 Controls Review - StackPanel
Silverlight 2 Controls Review - Grid 1
Silverlight 2 Controls Review - Grid 2
Silverlight 2 Controls Review - GridSplitter
Silverlight 2 Controls Review - TabControl
Silverlight 2 Controls Review - ProgressBar



Silverlight 2 컨트롤의 주요 프로퍼티 사용법 및 이벤트를 중심으로 간단한 소스코드를 첨부하여 강좌를 적성하였습니다. 이후 작성될 컨트롤 강좌는 목록에 계속 추가해 나가도록 하겠습니다.

크리에이티브 커먼즈 라이선스
Creative Commons License
http://www.taedi.kr/trackback/296 관련글 쓰기
ProgressBar 컨트롤은 현재 프로그램의 로드되는 상태를 나타내며, 그림이나 동영상같은 멀티미디어 파일을 다운로드 또는 업로드 하는 현재 상태를 퍼센트로 보여줄 수 있습니다.

아래 예제는 동영상을 다운로드 하면서 진행상태를 보여주고 동영상을 재생을 재생을 합니다.

사용자 삽입 이미지


MediaElement, TextBlack, ProgressBar 컨트롤을 Xaml 코드뷰에서 추가해주거나 Blend에서 추가해줍니다. MediaElement는 다운로드한 동영상을 재생하고 TextBlack는 다운로드 되는 상태를 퍼센트로 보여줍니다.

Xaml

<UserControl x:Class="ControlTest17.Page"

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

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

    Width="290" Height="260">

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

       <ProgressBar Margin="32,0,105,31" x:Name="pgsLoad" Minimum="0"

                    VerticalAlignment="Bottom" Height="19"/>

       <TextBlock Height="19" HorizontalAlignment="Right" Margin="0,0,-8,31"

                  VerticalAlignment="Bottom" Width="97" Text="TextBlock"

                  TextWrapping="Wrap" x:Name="tbResult"/>

       <MediaElement Margin="30,20.5,25,66.5" x:Name="mediaElement" AutoPlay="True"/>

    </Grid>

</UserControl>


C# Code

using System;

using System.Net;

using System.Windows.Controls;

 

namespace ControlTest17

{

    public partial class Page : UserControl

    {

        public Page()

        {

            InitializeComponent();

 

            WebClient webclient = new WebClient();

 

            webclient.OpenReadAsync(new Uri("Silverlight.wmv",

UriKind.RelativeOrAbsolute));

            webclient.DownloadProgressChanged += new

                DownloadProgressChangedEventHandler(webclient_DownloadProgressChanged);

            webclient.OpenReadCompleted +=

                new OpenReadCompletedEventHandler(webclient_OpenReadCompleted);

        }

 

        void webclient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)

        {

            if (e.Error == null)

            {

                try

                {

                    mediaElement.SetSource(e.Result);

                    mediaElement.Play();

                }

                catch (Exception ex) {}

            }

        }

 

        void webclient_DownloadProgressChanged(object sender,

            DownloadProgressChangedEventArgs e)

        {

            pgsLoad.Value = e.ProgressPercentage;

            tbResult.Text = e.ProgressPercentage.ToString() + "% Completed";

        }

    }

}


WebClient 클래스를 이용하여 웹에서 동영상 경로를 설정하고 DownloadProgressChanged 메소드는 다운로드 되고 있는 상태를 PregressBar, TextBlack에 다운로드 되고 있는 결과를 보여줍니다.  ebclient_OpenReadCompleted 이벤트는 조건문을 통하여 다운로드 중 에러가 발생했는지 체크를 하고 에러가 없으면 결과값을 보여줍니다.



크리에이티브 커먼즈 라이선스
Creative Commons License
http://www.taedi.kr/trackback/295 관련글 쓰기

TabControl은 여러 페이지 사이를 빠르게 전환하는데 유용한 컨트롤입니다. 기본적인 사용법은 아래 Xaml 코드와 같습니다.

<basics:TabControl Margin="50,50,55,0" UseLayoutRounding="True" Height="152" TabStripPlacement="Top" SelectedIndex="1"

                            VerticalAlignment="Top">

<basics:TabItem Header="Tab 1"><TextBlock  Text="텝의 기초 1" /></basics:TabItem>

<basics:TabItem Header="Tab 2"> <TextBlock  Text="텝의 기초 2" /></basics:TabItem>

<basics:TabItem Header="Tab 3"><TextBlock  Text="텝의 기초 3" /></basics:TabItem>

<basics:TabItem Header="Tab 4"><TextBlock  Text="텝의 기초 4" /></basics:TabItem>

</basics:TabControl>



기본적인 TabControl을 생성했을때 보여지는 결과입니다. 4개의 TabItem이 들어가 있습니다.


사용자 삽입 이미지


TabControl 안에는 독립적으로 TabItem 컨트롤이 존재하며 TabItem 안에는 Button이나 TextBox 같은 Input 관련 컨트롤이나 레이아웃을 구성할 수 있는 StackPanel, Canvas 같은 페널을 추가할 수 있습니다. 아래코드는 TabItem에 Button 컨트롤을 삽입한 것입니다.

<basics:TabItem Header="Tab 1" >

<Button x:Name="btnTab1" Content="Click Me" Width="60" Height="25"/>

</basics:TabItem>




TabItem에 Button 컨트롤이 추가된 모습입니다.
사용자 삽입 이미지

Grid 패널을 이용하여 여러가지 컨트롤을 배치 할 수 있습니다.

<basics:TabItem Header="Tab 1" >

<Button x:Name="btnTab1" Content="Click Me" Width="60" Height="25"/>

</basics:TabItem>




여러가지 컨트롤을 배치한 모습입니다.
사용자 삽입 이미지
 

Tab의 타이틀에 이미지(또는 아이콘)를 집어넣을 수 있습니다. StackPanel 컨트롤을 추가하고 자식 엘리먼트로 이미지 컨트롤을 이용해 Source 프로퍼티에 이미지경로를 지정합니다.

<basics:TabItem Width="100">

<basics:TabItem.Header>

        <StackPanel Orientation="Horizontal">

            <Image Source="tab_isleaf.png" />

            <TextBlock Text="Tab 3" Margin="2,0,0,0"/>

        </StackPanel>

    </basics:TabItem.Header>

</basics:TabItem>

텝의 타이틀에 이미지를 추가한 모습입니다.

사용자 삽입 이미지

텝의 타이틀에 이미지 추가하는 것처럼 컨텐츠에 이미지를 추가할 수 있습니다. 이미지 컨트롤의 Source 프로퍼티에 인터넷에 있는 그림의 경로를 지정할 수 있습니다.

<basics:TabItem Header="Tab 4">

<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">

    <Image Source="http://fs.textcube.com/blog/0/2349/attach/XV3tNbRAgR.png"
Height
="150" Width="80"/>

</StackPanel>

</basics:TabItem>

웹의 경로를 지정하여 이미지를 출력한 모습입니다.

사용자 삽입 이미지

Xaml Code

<basics:TabControl Margin="50,50,55,0" UseLayoutRounding="True"  TabStripPlacement="Top" SelectedIndex="1"

                            VerticalAlignment="Top" Height="152" >

               <basics:TabItem Header="Tab 1" >

                <Button x:Name="btnTab1" Content="Click Me" Width="60" Height="25"/>

            </basics:TabItem>

               <basics:TabItem Header="Tab 2">

                <Grid>

                    <Grid.RowDefinitions>

                        <RowDefinition Height="25"/>

                        <RowDefinition />

                        <RowDefinition />

                        <RowDefinition />

                    </Grid.RowDefinitions>

                   

                    <Grid.ColumnDefinitions>

                        <ColumnDefinition Width="50"/>

                        <ColumnDefinition Width="*"/>

                    </Grid.ColumnDefinitions>

 

                    <TextBlock x:Name="tbPhone" Text="Phone" Grid.Column="0" Grid.Row="0"/>

                    <TextBlock x:Name="tbName" Text="Name" Grid.Column="0" Grid.Row="1"/>

                    <TextBlock x:Name="tbAddress" Text="Address" Grid.Column="0"
Grid.Row
="2"/>

 

                    <TextBox x:Name="txtPhone" Grid.Column="1" Grid.Row="0"/>

                    <TextBox x:Name="txtName" Grid.Column="1" Grid.Row="1"/>

                    <TextBox x:Name="txtAddress" Grid.Column="1" Grid.Row="2"/>

<Button x:Name="btnResult" Content="등록" Grid.Row="3"
Grid.ColumnSpan
="2"/>

                </Grid>

            </basics:TabItem>

            <basics:TabItem Width="100">

                <basics:TabItem.Header>

                    <StackPanel Orientation="Horizontal">

                        <Image Source="tab_isleaf.png" />

                        <TextBlock Text="Tab 3" Margin="2,0,0,0"/>

                    </StackPanel>

                </basics:TabItem.Header>

            </basics:TabItem>

            <basics:TabItem Header="Tab 4">

                <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">

                    <Image Source="http://fs.textcube.com/blog/0/2349/attach/XV3tNbRAgR.png"
Height
="150" Width="80"/>

                </StackPanel>

            </basics:TabItem>

        </basics:TabControl>

        <basics:TabControl Margin="50,0,55,28" UseLayoutRounding="True"  TabStripPlacement="Top"

SelectedIndex="1" VerticalAlignment="Bottom" Height="127" x:Name="Tab2">

</basics:TabControl>

텝의 전환은 텝의 타이틀을 클릭함으로서 가능하고 텝의 위치는 Dock 타입이며 TabStripPlacement 프로퍼티를 이용하면 Top, Bottom, Left, Right 4가지 방향으로 배치 할 수 있습니다. 또 텝을 삭제하고 추가할 수 있습니다.

다음 코드는 텝을 사방으로 전환하고, 추가, 삭제할 수 있는 예제입니다.

사용자 삽입 이미지


사용자 삽입 이미지

사용자 삽입 이미지


사용자 삽입 이미지


Xaml Code

<basics:TabControl Margin="50,0,55,28" UseLayoutRounding="True"  TabStripPlacement="Top"

        SelectedIndex="1" VerticalAlignment="Bottom" Height="127" x:Name="Tab2">

           

        </basics:TabControl>

        <Button Height="26" HorizontalAlignment="Right" Margin="0,0,55,195"

                VerticalAlignment="Bottom" Width="93" Content="텝 삭제"

                x:Name="TabItemDel" Click="TabItemDel_Click"/>

       

        <ComboBox VerticalAlignment="Bottom" Height="26" Margin="149,0,157,195" x:Name="cboOrientation" SelectionChanged="ComboBox_SelectionChanged">

            <ComboBoxItem Content="Top"/>

            <ComboBoxItem Content="Bottom"/>

            <ComboBoxItem Content="Left"/>

            <ComboBoxItem Content="Right"/>

        </ComboBox>

       

        <Button Margin="47,0,0,195" Content="텝 추가" Height="26"

                VerticalAlignment="Bottom" HorizontalAlignment="Left"

                Width="93" x:Name="TabItemAdd" Click="TabItemAdd_Click"/>


C# Code

/// <summary>

/// TabItem Add

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void TabItemAdd_Click(object sender, RoutedEventArgs e)

{

// Tab Create

TabItem tabitem = new TabItem();

         

int tcnt = 0;

 

for (int i = 0; i<Tab2.Items.Count; i++)

{

tcnt = tcnt + 1;

tabitem.Header = "Tab " + tcnt;

}

 

Tab2.Items.Add(tabitem);

}

 

/// <summary>

/// TabItem Delete

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void TabItemDel_Click(object sender, RoutedEventArgs e)

{

int tabcnt = Tab2.Items.Count;

 

    if (tabcnt > 0)

    {

        Tab2.Items.RemoveAt(tabcnt - 1);

}

    else

    {

        MessageBox.Show("삭제할 텝이 없습니다.");

        return;

    }

}

 

/// <summary>

/// TabItem Orientation

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void ComboBox_SelectionChanged(object sender,

            SelectionChangedEventArgs e)

{

int cboitem = cboOrientation.SelectedIndex;

 

if (cboitem < 0)

return;

 

switch (cboitem)

{

        case 0:

            Tab2.TabStripPlacement = Dock.Top;

            break;

        case 1:

            Tab2.TabStripPlacement = Dock.Bottom;

            break;

        case 2:

            Tab2.TabStripPlacement = Dock.Left;

            break;

        case 3:

            Tab2.TabStripPlacement = Dock.Right;

            break;

}

}


크리에이티브 커먼즈 라이선스
Creative Commons License
http://www.taedi.kr/trackback/291 관련글 쓰기

그리드는 키보드 혹은 마우스등을 이용하여 행과 열의 크기를 자유자재로 조절할 수 있다는 큰 특징이 있습니다. 이것을 가능케하는 컨트롤이 바로 GridSplitter(그리드스플리터) 컨트롤입니다.

GridSplitter는 HorizontalAlignment의 기본 값은 Right이고 VerticalAligument의 기본 값은 Stretch이기 때문에, 기본적으로 특정한 셀의 오른쪽에 도킹됩니다. GridSplitter의 올바른 사용은 적어도 한방향으로 Strect 정렬을 하는 것입니다.

GridSplitter를 마우스를 좌우 또는 위아래로 드래그(drag)하게 되면 드래그한 GridSplitter의 주변의 Grid 및 셀안의 자식 엘리먼트 크기는 자동 조절됩니다.

그리드(Grid)의 열(Column)을 지정합니다. <ColumnDefinition Width="5"/>는(은) GridSplitter가 위치할 셀입니다.

<!--Grid Column-->

<Grid.ColumnDefinitions>

     <ColumnDefinition Width="80" />

     <ColumnDefinition Width="5"/>

     <ColumnDefinition Width="80" />

     <ColumnDefinition Width="5"/>

     <ColumnDefinition Width="80" />

     <ColumnDefinition Width="5"/>

     <ColumnDefinition Width="80" />

</Grid.ColumnDefinitions>


그리드(Grid)의 행(Row)을 지정합니다. <RowDefinition Height="5" />는(은) GridSplitter가 위치할 셀입니다.

<!--Grid Row-->

<Grid.RowDefinitions>

     <RowDefinition Height="80" />

     <RowDefinition Height="5" />

     <RowDefinition Height="80" />

     <RowDefinition Height="5" />

     <RowDefinition Height="80" />

     <RowDefinition Height="5" />

     <RowDefinition Height="80" />

</Grid.RowDefinitions>


그리드의 자식 엘리먼트 입니다

<!--자식 엘리먼트-->

<Rectangle Grid.Row="0" Grid.Column="0" Fill="Red"/>

<Rectangle Grid.Row="2" Grid.Column="0" Fill="Green"/>

<Rectangle Grid.Row="4" Grid.Column="0" Fill="Blue"/>

<Rectangle Grid.Row="6" Grid.Column="0" Fill="Yellow"/>

<Rectangle Grid.Row="0" Grid.Column="2" Fill="Green"/>

<Rectangle Grid.Row="2" Grid.Column="2" Fill="Blue"/>

<Rectangle Grid.Row="4" Grid.Column="2" Fill="Yellow"/>

<Rectangle Grid.Row="6" Grid.Column="2" Fill="Red"/>

<Rectangle Grid.Row="0" Grid.Column="4" Fill="Blue"/>

<Rectangle Grid.Row="2" Grid.Column="4" Fill="Yellow"/>

<Rectangle Grid.Row="4" Grid.Column="4" Fill="Red"/>

<Rectangle Grid.Row="6" Grid.Column="4" Fill="Green"/>

<Rectangle Grid.Row="0" Grid.Column="6" Fill="Yellow"/>

<Rectangle Grid.Row="2" Grid.Column="6" Fill="Red"/>

<Rectangle Grid.Row="4" Grid.Column="6" Fill="Green"/>

<Rectangle Grid.Row="6" Grid.Column="6" Fill="Blue"/>

       

사용자 삽입 이미지


GridSplitter 입니다. GridSplitter 역시 Grid의 자식엘리먼트로 위치하며 Rectangle의 사이사이에 들어갑니다.  ColumnSpan 프로퍼티는 GridSplitter가 속한 행 또는 열을 합쳐서 하나의 셀로 사용할 수 있도록 하여 GridSplitter를 마우스도 드래그 할때 어느 위치에서든 크기 조절을 가능토록 합니다. ShowsPreview 프로퍼티는 크기를 조절할 때 이웃한 셀과 자식엘리먼트의 크기가 자동으로 조절되면서 변경된 크기를 미리 보여줍니다. HorizontalAlignment와 VerticalAlignment의 프로퍼티 값은 Stretch를 주어 GridSplitter가 들어간 셀크기 만큼 GridSplitter크기를 채우겠다는 뜻입니다.

<basics:GridSplitter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="7"

  ShowsPreview="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />

<basics:GridSplitter Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="7"

  ShowsPreview="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />

<basics:GridSplitter Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="7"

  ShowsPreview="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>

<basics:GridSplitter Grid.Row="0" Grid.Column="1" Grid.RowSpan="7"

  ShowsPreview="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />

<basics:GridSplitter Grid.Row="0" Grid.Column="3" Grid.RowSpan="7"

ShowsPreview="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />

<basics:GridSplitter Grid.Row="0" Grid.Column="5" Grid.RowSpan="7"

ShowsPreview="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />


사용자 삽입 이미지

사용자 삽입 이미지

Xaml

<UserControl xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"  x:Class="ControlTest15.Page"

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

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

    Width="340" Height="340">

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

        <!--Grid Column-->

        <Grid.ColumnDefinitions>

            <ColumnDefinition Width="80" />

            <ColumnDefinition Width="5"/>

            <ColumnDefinition Width="80" />

            <ColumnDefinition Width="5"/>

            <ColumnDefinition Width="80" />

            <ColumnDefinition Width="5"/>

            <ColumnDefinition Width="80" />

        </Grid.ColumnDefinitions>

       

        <!--Grid Row-->

        <Grid.RowDefinitions>

            <RowDefinition Height="80" />

            <RowDefinition Height="5" />

            <RowDefinition Height="80" />

            <RowDefinition Height="5" />

            <RowDefinition Height="80" />

            <RowDefinition Height="5" />

            <RowDefinition Height="80" />

        </Grid.RowDefinitions>

 

        <!--자식 엘리먼트-->

        <Rectangle Grid.Row="0" Grid.Column="0" Fill="Red"/>

        <Rectangle Grid.Row="2" Grid.Column="0" Fill="Green"/>

        <Rectangle Grid.Row="4" Grid.Column="0" Fill="Blue"/>

        <Rectangle Grid.Row="6" Grid.Column="0" Fill="Yellow"/>

        <Rectangle Grid.Row="0" Grid.Column="2" Fill="Green"/>

        <Rectangle Grid.Row="2" Grid.Column="2" Fill="Blue"/>

        <Rectangle Grid.Row="4" Grid.Column="2" Fill="Yellow"/>

        <Rectangle Grid.Row="6" Grid.Column="2" Fill="Red"/>

        <Rectangle Grid.Row="0" Grid.Column="4" Fill="Blue"/>

        <Rectangle Grid.Row="2" Grid.Column="4" Fill="Yellow"/>

        <Rectangle Grid.Row="4" Grid.Column="4" Fill="Red"/>

        <Rectangle Grid.Row="6" Grid.Column="4" Fill="Green"/>

        <Rectangle Grid.Row="0" Grid.Column="6" Fill="Yellow"/>

        <Rectangle Grid.Row="2" Grid.Column="6" Fill="Red"/>

        <Rectangle Grid.Row="4" Grid.Column="6" Fill="Green"/>

        <Rectangle Grid.Row="6" Grid.Column="6" Fill="Blue"/>

       

        <basics:GridSplitter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="7"

           ShowsPreview="True" HorizontalAlignment="Stretch"

           VerticalAlignment="Stretch" />

        <basics:GridSplitter Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="7"

           ShowsPreview="True" HorizontalAlignment="Stretch"

           VerticalAlignment="Stretch" />

        <basics:GridSplitter Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="7"

           ShowsPreview="True" HorizontalAlignment="Stretch"

           VerticalAlignment="Stretch"/>

        <basics:GridSplitter Grid.Row="0" Grid.Column="1" Grid.RowSpan="7"

           ShowsPreview="True" HorizontalAlignment="Stretch"

           VerticalAlignment="Stretch" />

        <basics:GridSplitter Grid.Row="0" Grid.Column="3" Grid.RowSpan="7"

           ShowsPreview="True" HorizontalAlignment="Stretch"

           VerticalAlignment="Stretch" />

        <basics:GridSplitter Grid.Row="0" Grid.Column="5" Grid.RowSpan="7"

           ShowsPreview="True" HorizontalAlignment="Stretch"

           VerticalAlignment="Stretch" />

    </Grid>

</UserControl>

 


 

크리에이티브 커먼즈 라이선스
Creative Commons License
http://www.taedi.kr/trackback/271 관련글 쓰기

Silverlight 2 용 쓸만한 컨트롤 라이브러리가 나왔습니다.

오픈소스 형태로 Codeplex에 공개되었으며 http://silverlightcontrib.org/ 에서 데모와 소스를 다운로드 할 수 있습니다.

사용자 삽입 이미지


공개된 소스코드에는 5개의 컨트롤과 8개의 라이브러리가 포함되어 있습니다.

Controls

- Color Picker
사용자 삽입 이미지
색을 직접 선택할 수도 있고 버튼을 누르면 랜덤으로 색을 선택하는 것도 가능합니다.

- Gauge Control
사용자 삽입 이미지

슬라이더 게이지 입니다. 사용자가 선택한 게이지의 양만큼 퍼센트(%)로 출력합니다.

- Star Selector
사용자 삽입 이미지

- Enhanced Metafile (EME)

사용자 삽입 이미지
오토캐드나 일러스트레이터에서 작업한 원본 파일을 Silverlight에서 읽어들일 수 있습니다.

- Cool Menu
사용자 삽입 이미지

사용자 삽입 이미지
마우스의 움직임에 따라 선택된 메뉴가 활성화 됩니다.



Libraries

- Zip
사용자 삽입 이미지
실버라이트에서 txt, xml 파일을 zip로 압출할 수 있는 라이브러리 입니다.

- Byte utilities
사용자 삽입 이미지


- String utilities
사용자 삽입 이미지


- Simple text parser
사용자 삽입 이미지
RTF(Rich Tex Format) 파일을 Silverlight Xaml로 변환합니다.

- Animation Tweening
사용자 삽입 이미지

- Wheel Mouse listener
사용자 삽입 이미지


Live Demo : http://silverlightcontrib.org/demo/
Source Down : http://www.codeplex.com/silverlightcontrib/Release/ProjectReleases.aspx?ReleaseId=17497
크리에이티브 커먼즈 라이선스
Creative Commons License
http://www.taedi.kr/trackback/267 관련글 쓰기

Grid 패널의 행(Row)과 열(Column) 크기 조절

절대 크기 조절(abslute sizing) : RowDefinition에 Height나 ColumnDefinition에 Width의 값을 숫자로 설정한다는 것은 다른 컨트롤처럼 장치 독립적인 필셀을 사용한다는 의미와 같습니다. 절대 크기를 설정한 열과 행들을 일반적인 타입과 비교해 보면 그리드의 크기나 엘리먼트의 크기가 변해도 줄어들거나 늘어나지 않습니다.

아래코드는 임의로 행과 열에 필셀값을 할당하는 예제입니다.

사용자 삽입 이미지


Xaml

<UserControl x:Class="ControlTest13.Page"

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

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

    Width="400" Height="300">

    <Grid x:Name="LayoutRoot" Background="Black" ShowGridLines="True">

        <!--네 개의 행을 선언-->

        <Grid.RowDefinitions>

            <RowDefinition Height="100"/> <!--값을 넣어서 픽셀크기를 고정-->

            <RowDefinition Height="70"/>

            <RowDefinition Height="80"/>

            <RowDefinition Height="50"/>

        </Grid.RowDefinitions>

       

        <!--두 개의 열을 선언-->

        <Grid.ColumnDefinitions>

            <ColumnDefinition Width="80" />

            <ColumnDefinition Width="160"/>

            <ColumnDefinition Width="160"/>

        </Grid.ColumnDefinitions>

      

    </Grid>

</UserControl>

자동 크기(autosizing) : 이전처럼 Height나 Width가 Auto로 설정되면 Silverlight와 WPF에서 기본 값이 설정된 것처럼 자식 엘리먼트들이 필요한 공간만 허용하고 더 이상 가질 수 없습니다. 행은 엘리먼트 중에서 가장 높이가 큰 값을 설정되고, 열은 엘리먼트 중 가장 넓은 값이 설정됩니다. 지역화나 다른 언어 환경때문에 짤릴 염려가 있는 텍스트가 포함되었다면 절대 크기를 설정하는 것보다 이 값을 설정하는 것이 더 좋은 선택입니다.


아래 코드는 RowDefinition Height와 ColumnDefinition Width의 크기를 Auto를 지정하여 자식 엘리먼트의 크기에 Grid 패널의 셀크기를 자동으로 맞추는 예제입니다.


사용자 삽입 이미지


Xaml

<UserControl x:Class="ControlTest13.Page"

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

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

    Width="400" Height="300">

    <Grid x:Name="LayoutRoot" Background="Black" ShowGridLines="True">

        <!--네 개의 행을 선언-->

        <Grid.RowDefinitions>

            <RowDefinition Height="100"/> <!--값을 넣어서 픽셀크기를 고정-->

            <RowDefinition Height="70"/>

            <RowDefinition Height="80"/>

            <RowDefinition Height="50"/>

        </Grid.RowDefinitions>

       

        <!--두 개의 열을 선언-->

        <Grid.ColumnDefinitions>

            <ColumnDefinition Width="80" />

            <ColumnDefinition Width="160"/>

            <ColumnDefinition Width="160"/>

        </Grid.ColumnDefinitions>

      

    </Grid>

</UserControl>

비율 기반 크기(propositional sizing or star sizing) : 이용 가능한 공간을 동일한 비율이나 크기로 나누는 특별한 방법입니다. 비율로 지정된 행이나 열을 Grid의 크기가 변하면 그에 따라 줄어들거나 늘어납니다.



다음에 나오는 코드들은 특별한 값(*:아스터리스크)을 사용하여 일정크기의 비율만큼 크기를 지정합니다.

1)  여러개의 RowDefinition Height와 ColumnDefinition Width의 크기를 *(아스트리스크)를 지정하는 경우

사용자 삽입 이미지


Xaml

<UserControl x:Class="ControlTest13.Page"

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

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

    Width="400" Height="300">

    <Grid x:Name="LayoutRoot" Background="Black" ShowGridLines="True">

        <!--네 개의 행을 선언-->

        <Grid.RowDefinitions>

            <RowDefinition Height="50" />

            <RowDefinition Height="2.5*" />

            <RowDefinition />

            <RowDefinition />

        </Grid.RowDefinitions>

       

        <!--두 개의 열을 선언-->

        <Grid.ColumnDefinitions>

            <ColumnDefinition Width="100"/>

            <ColumnDefinition Width="2*" />

            <ColumnDefinition Width="4*"/>

            <ColumnDefinition Width="2*"/>

        </Grid.ColumnDefinitions>

       

        <!--자식 엘리먼트 추가-->

        <TextBlock TextWrapping="Wrap" Grid.Column="0" Grid.Row="0">

            <Run Foreground="#FFFFFFFF" Text="안녕하세요 태디입니다. "/>

        </TextBlock>

        <Button Grid.Column="2" Grid.Row="2" Content="Click Me" FontSize="36" />

        <Ellipse Grid.Row="3" Stroke="#FF000000">

               <Ellipse.Fill>

                       <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">

                              <GradientStop Color="#FFF41515"/>

                              <GradientStop Color="#FF47A341" Offset="1"/>

                              <GradientStop Color="#FFFDFDFD" Offset="0.482"/>

                       </LinearGradientBrush>

               </Ellipse.Fill>

        </Ellipse>

      

    </Grid>

</UserControl>

 


나머지 Grid의 셀들은 자동으로 같은 크기로 지정됩니다.

2) RowDefinition Height와 ColumnDefinition Width의 크기를 더 크게 가지려면 단순히 *(아스트리스크)를 사용하는 것보다 2* 또는 2.5*처럼 그 앞에 계수를 사용할 수 있습니다. ColumnDefinition Width를 2*로 설정하면 *를 가진 열보다 폭이 정확히 두 배가 됩니다.

여기서 남아 있는 공간(remaning space) 이라는 의미는 Grid의 높이나 폭에서 절대 크기나 자동 크기로 설정된 값을 뺀 것입니다.


사용자 삽입 이미지


Xaml

<UserControl x:Class="ControlTest13.Page"

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

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

    Width="400" Height="300">

    <Grid x:Name="LayoutRoot" Background="Black" ShowGridLines="True">

        <!--네 개의 행을 선언-->

        <Grid.RowDefinitions>

            <RowDefinition Height="*" />

            <RowDefinition />

            <RowDefinition />

            <RowDefinition />

        </Grid.RowDefinitions>

       

        <!--두 개의 열을 선언-->

        <Grid.ColumnDefinitions>

            <ColumnDefinition Width="*" />

            <ColumnDefinition />

            <ColumnDefinition />

        </Grid.ColumnDefinitions>

       

        <!--자식 엘리먼트 추가-->

        <TextBlock TextWrapping="Wrap" Grid.Column="0" Grid.Row="0">

            <Run Foreground="#FFFFFFFF" Text="안녕하세요 태디입니다. "/>

        </TextBlock>

        <Button Grid.Column="2" Grid.Row="2" Content="Click Me" FontSize="36" />

        <Ellipse Grid.Row="3" Stroke="#FF000000">

               <Ellipse.Fill>

                       <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">

                              <GradientStop Color="#FFF41515"/>

                              <GradientStop Color="#FF47A341" Offset="1"/>

                              <GradientStop Color="#FFFDFDFD" Offset="0.482"/>

                       </LinearGradientBrush>

               </Ellipse.Fill>

        </Ellipse>

      

    </Grid>

</UserControl>

크리에이티브 커먼즈 라이선스
Creative Commons License
http://www.taedi.kr/trackback/263 관련글 쓰기

Grid는 여러 가지 기능을 복합적으로 가진 패널입니다. 실버라이트에서 Canvas 패널과 함께 가장 많이 쓰이는 패널중에 하나입니다. 특히 실버라이트는 그리드를 기본 패널로 하고 있으며, 여러 행과 열로 자식 엘리먼트를 배치 할 수 있도록 해 주며 이를 조절할 수 있는 기능을 제공해 줍니다. 그리드를 통해서 작업하는 것은 HTML 안에서 테이블로 다루는 것과 아주 유사합니다.

4×2 행과 열을 만들고 기본적으로 1셀에 1개의 자식 엘리먼트를 집어넣는 예제입니다.

사용자 삽입 이미지

Xaml

<UserControl x:Class="ControlTest13.Page"

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

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

    Width="400" Height="300">

    <Grid x:Name="LayoutRoot" Background="Black" ShowGridLines="True">

        <!--네 개의 행을 선언-->

        <Grid.RowDefinitions>

            <RowDefinition />

            <RowDefinition />

            <RowDefinition />

            <RowDefinition />

        </Grid.RowDefinitions>

       

        <!--두 개의 열을 선언-->

        <Grid.ColumnDefinitions>

            <ColumnDefinition />

            <ColumnDefinition />

        </Grid.ColumnDefinitions>

       

        <!--자식 엘리먼트를 배치-->

        <Button x:Name="btnL1" Content="0×0" Width="100"

                Height="50" Grid.Column="0" Grid.Row="0" />

        <Button x:Name="btnL2" Content="0×1" Width="100"

                Height="50" Grid.Column="0" Grid.Row="1" />

        <Button x:Name="btnL3" Content="0×2" Width="100"

                Height="50" Grid.Column="0" Grid.Row="2" />

        <Button x:Name="btnL4" Content="0×3" Width="100"

                Height="50" Grid.Column="0" Grid.Row="3" />

       

        <Button x:Name="btnR1" Content="1×0" Width="100"

                Height="50" Grid.Column="1" Grid.Row="0" />

        <Button x:Name="btnR2" Content="1×1" Width="100"

                Height="50" Grid.Column="1" Grid.Row="1" />

        <Button x:Name="btnR3" Content="1×2" Width="100"

                Height="50" Grid.Column="1" Grid.Row="2" />

        <Button x:Name="btnR4" Content="1×3" Width="100"

                Height="50" Grid.Column="1" Grid.Row="3" />

    </Grid>

</UserControl> 


예제에 표시된 점선은 Grid의 설정을 강조하기 위해 Grid 컨트롤 안에 ShowGridLines="True" 프로퍼티를 선언하였습니다. 

Grid.Column="0" Grid.Row="0" 프로퍼티를 사용하여 Grid안에 자식 엘리먼트의 위치를 지정합니다. Column과 Row의 값이 각각 0이면 가장 처음 셀에 위치합니다.

RowDefinitions 엘리먼트는 행을 만들며 그안에 RowDefinition 엘리먼트 개수는 행의 개수를 지정합니다.


4×2 행과 열을 만들고 기본적으로 1셀에 1개의 자식 엘리먼트를 집어넣으며 엘리먼트의 Height와 Width의 크기만큼 Grid 셀을 자동으로 결정하는 예제입니다.

사용자 삽입 이미지

Xaml

<UserControl x:Class="ControlTest13.Page"

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

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

    Width="400" Height="300">

    <Grid x:Name="LayoutRoot" Background="Black" ShowGridLines="True">

        <!--네 개의 행을 선언-->

        <Grid.RowDefinitions>

            <RowDefinition Height="Auto"/>

            <RowDefinition Height="Auto"/>

            <RowDefinition Height="Auto"/>

            <RowDefinition Height="Auto"/>

        </Grid.RowDefinitions>

       

        <!--두 개의 열을 선언-->

        <Grid.ColumnDefinitions>

            <ColumnDefinition Width="Auto"/>

            <ColumnDefinition Width="Auto"/>

        </Grid.ColumnDefinitions>

       

        <!--자식 엘리먼트를 배치-->

        <Button x:Name="btnL1" Content="0×0" Width="100"

                Height="50" Grid.Column="0" Grid.Row="0" />

        <Button x:Name="btnL2" Content="0×1" Width="100"

                Height="50" Grid.Column="0" Grid.Row="1" />

        <Button x:Name="btnL3" Content="0×2" Width="100"

                Height="50" Grid.Column="0" Grid.Row="2" />

        <Button x:Name="btnL4" Content="0×3" Width="100"

                Height="50" Grid.Column="0" Grid.Row="3" />

       

        <Button x:Name="btnR1" Content="1×0" Width="100"

                Height="50" Grid.Column="1" Grid.Row="0" />

        <Button x:Name="btnR2" Content="1×1" Width="100"

                Height="50" Grid.Column="1" Grid.Row="1" />

        <Button x:Name="btnR3" Content="1×2" Width="100"

                Height="50" Grid.Column="1" Grid.Row="2" />

        <Button x:Name="btnR4" Content="1×3" Width="100"

                Height="50" Grid.Column="1" Grid.Row="3" />

    </Grid>

</UserControl>




다음 예제는 HTML의 ColSpan, RowSpan 처럼 두개의 셀을 합쳐서 쓰는 효과를 Grid에서도 다중의 셀을 합쳐서 하나의 셀로 사용할 수 있도록 하는 효과입니다.

사용자 삽입 이미지


Xaml

<UserControl x:Class="ControlTest13.Page"

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

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

    Width="400" Height="300">

    <Grid x:Name="LayoutRoot" Background="Black" ShowGridLines="True">

        <!--네 개의 행을 선언-->

        <Grid.RowDefinitions>

            <RowDefinition />

            <RowDefinition />

            <RowDefinition />

            <RowDefinition />

        </Grid.RowDefinitions>

       

        <!--두 개의 열을 선언-->

        <Grid.ColumnDefinitions>

            <ColumnDefinition />

            <ColumnDefinition />

        </Grid.ColumnDefinitions>

       

        <!--자식 엘리먼트를 배치-->

        <Button x:Name="btnL1" Content="1" Width="100"

                Height="50" Grid.ColumnSpan="2" />

        <Button x:Name="btnL2" Content="2" Width="100"

                Height="50" Grid.RowSpan="4" Grid.Column="0" />

        <Button x:Name="btnL3" Content="3" Width="100"

                Height="50" Grid.RowSpan="4" Grid.Column="2" />

        <Button x:Name="btnL4" Content="4" Width="100"

                Height="50" Grid.ColumnSpan="2" Grid.Row="3" />

       

    </Grid>

</UserControl>


ColumnSpan과 RowSpan은 한개의 자식 엘리먼트를 여러개의 셀을 합쳐서 사용하고자 할때 사용합니다.



크리에이티브 커먼즈 라이선스
Creative Commons License
http://www.taedi.kr/trackback/262 관련글 쓰기

Visual Studio 2008 SP1용 Microsoft® Silverlight™ Tools(RC1) 한국어 버전 출시

다운로드 : Silverlight_Tools.exe

사용자 삽입 이미지

크리에이티브 커먼즈 라이선스
Creative Commons License
http://www.taedi.kr/trackback/255 관련글 쓰기

StackPanel 컨트롤은 이용하기 간편하고 유용한 패널입니다. Stack이라는 단어가 쌓다라는 뜻이라서 자식 엘리먼트들이 추가되는 순서대로 누적됩니다. 가장 먼저 추가된 엘리먼트가 가장 밑으로 갑니다. 자식 엘리먼트에서 사용하는 첨부프로퍼티는 없으며 오직 오리엔테이션(Orientation) 프로퍼티를 사용해서 조정합니다.. Horizontal이나 Vertical 중 하나를 설정할 수 있고 기본값은 Vertical(세로)입니다.

사용자 삽입 이미지
사용자 삽입 이미지

아래 예제는 오리엔테이션(Orientation) 프로퍼티의 현재설정상태에 따라 버튼을 클릭하면 Horizontal이나 Vertical중 하나를 설정하는 예제입니다.

Xaml

<UserControl x:Class="ControlTest12.Page"

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

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

    Width="821" Height="300">

  <StackPanel x:Name="stackOri">

        <Button Height="29" Width="64" Content="버튼 가"/>

        <Button Height="29" Width="64" Content="버튼 나"/>

        <Button Height="29" Width="64" Content="버튼 다"/>

        <Button Height="29" Width="64" Content="버튼 라"/>

        <Button Height="29" Width="64" Content="버튼 마"/>

        <Button Height="29" Width="64" Content="버튼 바"/>

        <Button Height="29" Width="64" Content="버튼 사"/>

        <Button Height="29" Width="64" Content="버튼 아"/>

        <Button Height="29" Width="64" Content="버튼 자"/>

        <Button Height="29" Width="64" Content="정렬 전환" x:Name="btnOrientation"

            Click="btnOrientation_Click"/>

  </StackPanel>

</UserControl>


C#

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 ControlTest12

{

    public partial class Page : UserControl

    {

        public Page()

        {

            InitializeComponent();

        }

 

        private void btnOrientation_Click(object sender, RoutedEventArgs e)

        {

            if (stackOri.Orientation == Orientation.Vertical)

            {

                stackOri.Orientation = Orientation.Horizontal;

                btnOrientation.Content = "가로정렬";

            }

            else

            {

                stackOri.Orientation = Orientation.Vertical;

                btnOrientation.Content = "세로정렬";

            }

        }

    }

}


크리에이티브 커먼즈 라이선스
Creative Commons License
http://www.taedi.kr/trackback/261 관련글 쓰기

Silverlight 2 RC1 버전이 릴리즈 되었습니다.

※ Visual Studio 2008 영문 버전을 기준으로 한 설치입니다.
 
실치에 필요한 프로그램 목록

1. Silverlight 2 Runtime
2. Microsoft® Silverlight™ Tools for Visual Studio 2008 SP1 (RC1)
3. Microsoft Expression Blend™ 2 Service Pack 1
4. Deep Zoom Composer



Silverlight 2 프로그램을 실행하려면 런타임이 필요합니다.

1. Silverlight 2 Runtime Install (설치 생략 가능)
(참고로 Silverlight 2 Runtime는 2번 Silverlight Tools를 설치하면 자동적으로 설치됩니다.)

Silverlight 2 Runtime는 여기에서 받으세요. 기존에 설치된 Silverlight 2 beta 2, Silverlight 2 RC0용 Runtime는 모두 삭제하시기 바랍니다.

사용자 삽입 이미지

사용자 삽입 이미지

사용자 삽입 이미지

사용자 삽입 이미지

Runtime를 설치하고 설치버전을 확인하면 Silverlight 2 실행할 수 있는 환경이 구성됩니다.

2. Microsoft® Silverlight™ Tools for Visual Studio 2008 SP1 (RC1) Setup
(Silverlight Runtime, Silverlight SDK는 Silverlight Tools를 설치하면 자동적으로 Install 됩니다.)

Vistuall Studio 2008 에서 Silverlight 2 프로그래밍을 하기 위한 Add-in을 설치를 하여야 합니다. 다운로드는 여기 에서 하면 됩니다.파일명은 Silverlight_Tools.exe 입니다.

사용자 삽입 이미지

기존 Beta 1, 2, RC0의 Add-in은 모두 제거해야 합니다. 설치는 영문 버전을 기준으로 합니다. 현재 실행중인 웹브라우저를 모두 종료해야 합니다.

사용자 삽입 이미지

사용자 삽입 이미지

사용자 삽입 이미지

동의에 체크하고 다음 버튼을 클릭합니다.

사용자 삽입 이미지

사용자 삽입 이미지

사용자 삽입 이미지

설치가 완료되면 Visual Studio 2008 새 프로젝트 대화상자에 설치여부를 확인여부를 체크하면 됩니다.

사용자 삽입 이미지

기본적으로 Silverlight 2 Runtime 와 개발 Tool을 설치하면 Silverlight 2 SDK 까지 설치가 됩니다.

3. Microsoft Expression Blend™ 2 Service Pack 1 Setup

이전에 설치되었던 Blend 2를 제거해 주세요. 다운로드는 여기에서 하면 되며, 파일명은 BlendV2SP1_en.exe 입니다. 이번 버전은 Silverlight 2가 정식릴리즈 되면서 Blend 2도 Preeview 딱지를 때게 되었습니다.
(이전에 설치한 Blend 2 Service Pack Preeview 만 삭제하고 Microsoft Expression Blend™ 2 Trial 는 반드시 설치가 되어 있어야 Blend 2 Service Pack 1이 정상적으로 설치됩니다.. 만약 삭제하셨다면 여기 를 클릭하여 다운로드하여 다시 설치해 주십시오)

사용자 삽입 이미지

사용자 삽입 이미지

I Accept 버튼을 클립하고 다음 설치를 진행합니다.

사용자 삽입 이미지

사용자 삽입 이미지

설치가 완료되었다면 버전체크 후 설치를 종료 합니다.

4. Deep Zoom Composer

치기존에 설치되었던 Deep Zoom Composer를 제거 해주세요. 다운로드는 여기에서 하면 됩니다. 파일명은 Deep Zoom Composer.msi 이며 영문 버전입니다.

사용자 삽입 이미지
사용자 삽입 이미지

동의를 선택하고 다음 버튼을 클릭하여 설치를 계속 진행합니다.

사용자 삽입 이미지

설치할 위치를 지정하고 다음 버튼을 클릭하여 설치를 계속 진행합니다.

사용자 삽입 이미지
사용자 삽입 이미지

설치가 완료되면 철치버전의 버전을 체크하고 설치종료를 합니다.
크리에이티브 커먼즈 라이선스
Creative Commons License
http://www.taedi.kr/trackback/241 관련글 쓰기
Silverlight 2 가 미국시간으로 14일 화요일에 RTW로 릴리즈 될 예정입니다. 실버라이트 카페 스텝 공도님과 ivoryguard님이 블로그 및 실버라이트 카페에 각각 정리를 해주셨습니다.

다음 글을 참고하시기 바립니다.

공도님 블로그 : http://gongdo.tistory.com/324
ivoryguard : http://cafe.naver.com/mssilverlight/3209

연합뉴스 실버라이트 기사


PS) RTW(Release To Web:온라인 릴리즈)
크리에이티브 커먼즈 라이선스
Creative Commons License
http://www.taedi.kr/trackback/236 관련글 쓰기

Canvas는 가장 기본적인 패널입니다. Canvas는 명시적인 좌표값을 이용해서 엘리먼트의 위치를 결정합니다. 그러나 오래된 UI 시스템과 다른 점이 한가지 있는데 Canvas는 사방을 자신의좌표값으로 사용할 수 있습니다.

Canvas 는 Left/Top 첨부 프로퍼티를 가지고 있으며 이를 통해서 엘리먼트 위치를 조정할 수 있습니다.

사용자 삽입 이미지

Xaml

<UserControl x:Class="ControlTest11.Page"

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

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

    Width="400" Height="300">

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

        <Canvas Margin="22,14,29,24">

               <Canvas.Background>

                       <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">

                              <GradientStop Color="#FF000000"/>

                              <GradientStop Color="#FFFFFFFF" Offset="1"/>

                       </LinearGradientBrush>

               </Canvas.Background>

               <TextBox Height="24" Width="117" Canvas.Left="15" Canvas.Top="12"

                     Text="TextBox" TextWrapping="Wrap"/>

               <Button Height="25" Width="72" Canvas.Left="152" Canvas.Top="11"

                    Content="Button"/>

               <TextBox Width="117" Text="TextBox" TextWrapping="Wrap"

                     Height="24" Canvas.Left="62" Canvas.Top="127"/>

               <Button Content="Button" Height="25" Width="72" Canvas.Left="199"

                    Canvas.Top="126"/>

               <TextBox Width="117" Text="TextBox" TextWrapping="Wrap"

                     Height="24" Canvas.Left="124" Canvas.Top="222"/>

               <Button Content="Button" Height="25" Width="72" Canvas.Left="261"

                    Canvas.Top="221"/>

        </Canvas>

    </Grid>

</UserControl>

 


Canvas 패널안에 있는 자식 컨트롤은 Left/Top 첨부 프로퍼티를 이용하여 Canvas 내의 위치를 자유롭게 조절할 수 있습니다.

사용자 삽입 이미지


Z-index 첨부 프로퍼티를 이용하여 Canvas 내의 자식컨트롤이 겹처 있을때 보이는 순서를 지정할 수있습니다.

<UserControl x:Class="ControlTest11.Page"

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

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

    Width="400" Height="300">

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

        <Canvas Margin="22,14,29,24">

               <Canvas.Background>

                       <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">

                              <GradientStop Color="#FF000000"/>

                              <GradientStop Color="#FFFFFFFF" Offset="1"/>

                       </LinearGradientBrush>

               </Canvas.Background>

               <Rectangle Height="97" Width="135.612" Canvas.Left="42" Canvas.Top="40"

                       Fill="#FFE89696" Stroke="#FF000000" Canvas.ZIndex="1"/>

               <Ellipse Height="108" Width="108" Canvas.Left="125" Canvas.Top="94"

                     Fill="#FFBAE896" Stroke="#FF000000" />

        </Canvas>

    </Grid>

</UserControl>


Canvas 내의 엘리먼트(자식컨트롤)의 Left/Top 첨부프로퍼티 값은 부모 컨트롤인 Canvas를 기준으로 위치가 정해집니다.
사용자 삽입 이미지

기본적으로 사각형이 뒤에 있었고 원이 앞에 위치해 있었습니다. 사각형에 Canvas.ZIndex="1" 첨부프로퍼티에 1을 주면 사각형이 앞으로 위치하게 됩니다.

순서는 한 번 정해지면 고정되는 것이 아니고, 패너러 클래스를 상속받은 모든 클래스들은 ZIndex 첨부프로퍼티를 이용해서 자식 엘리먼트의 순서를 마음대로 저정할 수 있슶니다. Zindex는 기본값이 0이며 음수일 수도 있습니다. 큰 값을 가진 엘리먼트가 작은 값을 가진 엘리먼트보다 상위에서 렌더링되기 때문에 최소값을 가진 엘리먼트는 가장 밑에 보이고 최대값을 가진 엘리먼트가 가장 위에 보입니다.
크리에이티브 커먼즈 라이선스
Creative Commons License
http://www.taedi.kr/trackback/260 관련글 쓰기

Border 컨트롤은 다른 컨트롤의 외곽에 경계를 그어주는 역활을 합니다. 이미지 경계에 외곽선을 주어 돋보이게 할 수도 있고 Button, TextBox 컨트롤등을 프로그램내에서 동일 기능 하는 컨트롤끼리 묶어서 외곽선을 표시해 줄 수도 있습니다.

사용자 삽입 이미지

기본적인 Xaml 구문입니다.

<Border x:Name="border" BorderThickness="4" Margin="33,34,36,38"

BorderBrush="Black" Width="409" Height="250"/>


BorderThickness는 Border의 외곽선 두께를 지정합니다. BorderBrush는 색을 지정하며, Width는 가로길이 Height는 세로 길이를 지정합니다.


사용자 삽입 이미지
Border의 BorderBrush에 그라데이션(Gradatikon) 효과를  줄 수 있습니다.

<Border x:Name="border" BorderThickness="4" Margin="33,34,36,38" Width="409" Height="250">

               <Border.BorderBrush>

                       <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">

                              <GradientStop Color="#FF26A783"/>

                              <GradientStop Color="#FF165478" Offset="0.987"/>

                              <GradientStop Color="#FFFFFFFF" Offset="0.527"/>

                       </LinearGradientBrush>

               </Border.BorderBrush>

</Border>



사용자 삽입 이미지

Border에 Background를 줄 수 있습니다.

<Border x:Name="border" BorderThickness="4" Margin="33,34,36,38"
Width
="409" Height="250" BorderBrush="Black" CornerRadius="10">

            <Border.Background>

                <ImageBrush x:Name="imgBarkground" Stretch="UniformToFill">

                    <ImageBrush.ImageSource>

                        <BitmapImage x:Name="bmpBackground" UriSource="f22.png"/>

                    </ImageBrush.ImageSource>

                </ImageBrush>

            </Border.Background>

        </Border>

</Grid>


ImageBrush
Stretch 프로퍼티는 Background Image Border의 외각선에 맞추는 설정을 합니다.

BitmapImage의 UriSource 프로퍼티는 이미지의 경로를 지정합니다. 웹에 있는 이미지의 Url로 지정이 가능하며 웹서버의 로컬에 있는 이미지도 가져올 수 있습니다.



사용자 삽입 이미지

BorderCornerRadius 프로퍼티를 이용하여 Round 효과를 줄 수 있습니다.

<Border x:Name="border" BorderThickness="4" Margin="33,34,36,38" Width="409" Height="250"

                BorderBrush="Black" CornerRadius="10" />


Border을 컨트롤을 이용하여 다양한 효과를 얻어낼 수 있으며, Silverlight에서 제공되는 기본적인 컨트롤의 믿믿한 디자인에 Style효과를 줄 수도 있지만, Border을 이용하여 간단하게 효과를 줄 수 있습니다.
크리에이티브 커먼즈 라이선스
Creative Commons License
http://www.taedi.kr/trackback/257 관련글 쓰기