검색결과 리스트
Silverlight에 해당되는 글 77건
- 2008/12/12 SilverlightTeskTop Application Program
- 2008/12/12 Silverlight ChartBuilder 소스코드 및 데모 업데이트
- 2008/12/10 Silverlight Toolkit 2008년 12월 버전 릴리즈
- 2008/11/25 Silverlight Tools(RC1) 한국어버전 출시 (2)
- 2008/10/29 2008 PDC에서 Silverlight Tools 및 Toolkit release & Themes 가 발표되었습니다. (2)
- 2008/10/27 Silverlight 2 Controls Review 강좌목록
- 2008/10/27 Silverlight 2 Controls Review - ProgressBar
- 2008/10/25 Silverlight 2 Controls Review - TabControl
- 2008/10/24 Silverlight 2 워터마크 컨트롤 (WatorMarked Text Box Control) (2)
- 2008/10/22 Silverlight 2 Controls Review - GridSplitter
- 2008/10/21 SilverlightContrib Controls 릴리즈
- 2008/10/18 Silverlight 2 Controls Review - Grid 2 (1)
- 2008/10/18 Silverlight 2 Controls Review - Grid 1
- 2008/10/17 Silverlight 2 RC1 Tool 한국어버전 출시
- 2008/10/17 Silverlight 2 Controls Review - StackPanel
글
SilverlightTeskTop Application Program
메일도 보낼 수 있는 것 같습니다.
소스코드를 다운로드하여 테스트 해보고 싶으시면 여기에서 받으시면 됩니다. 단 웹사이트에 아이디, 이름, 이메일, 비밀번호의 간단한 개인정보를 입력후 가입을 해야 합니다.
※ 가입하기가 귀찮다면 직접 다운로드 CodePlex에서 다운로드 하시면 됩니다. : SilverlightDesktop 01.90.00
윈도우 비스타를 환경에서 테스트 해볼 수 있도록 설치가이드가 제공됩니다.(비스타는 프로페셔널이상에 IIS 웹서버가 설치되어 있어야 합니다.)
실버라이트 데스크탑 어플리케이션의 아키텍쳐입니다. (출처 : http://silverlightdesktop.net/Default.aspx)
'Silverlight' 카테고리의 다른 글
| SilverlightTeskTop Application Program (0) | 2008/12/12 |
|---|---|
| Silverlight ChartBuilder 소스코드 및 데모 업데이트 (0) | 2008/12/12 |
| Silverlight Toolkit 2008년 12월 버전 릴리즈 (0) | 2008/12/10 |
| Silverlight Tools(RC1) 한국어버전 출시 (2) | 2008/11/25 |
| 2008 PDC에서 Silverlight Tools 및 Toolkit release & Themes 가 발표되었습니다. (2) | 2008/10/29 |
| Silverlight 2 Controls Review 강좌목록 (0) | 2008/10/27 |
| Silverlight 2 Controls Review - ProgressBar (0) | 2008/10/27 |
| Silverlight 2 Controls Review - TabControl (0) | 2008/10/25 |
글
Silverlight ChartBuilder 소스코드 및 데모 업데이트
데모사이트, 소스코드 다운로드
더 자세히 보려면... 여기를 클릭하세요
'Silverlight' 카테고리의 다른 글
| SilverlightTeskTop Application Program (0) | 2008/12/12 |
|---|---|
| Silverlight ChartBuilder 소스코드 및 데모 업데이트 (0) | 2008/12/12 |
| Silverlight Toolkit 2008년 12월 버전 릴리즈 (0) | 2008/12/10 |
| Silverlight Tools(RC1) 한국어버전 출시 (2) | 2008/11/25 |
| 2008 PDC에서 Silverlight Tools 및 Toolkit release & Themes 가 발표되었습니다. (2) | 2008/10/29 |
| Silverlight 2 Controls Review 강좌목록 (0) | 2008/10/27 |
| Silverlight 2 Controls Review - ProgressBar (0) | 2008/10/27 |
| Silverlight 2 Controls Review - TabControl (0) | 2008/10/25 |
글
Silverlight Toolkit 2008년 12월 버전 릴리즈
2008년 12월 버전 Silverlight Toolkit가 릴리즈 되었습니다.
Silverlight Toolkit December 2008 Download
- Components in the Preview Quality Band
- Components in the Stable Quality Band
새로 추가된 컨트롤
Sample Demo Site : 보러가기
테마
- Bureau Black
- Bureau Blue
- Shiny Red
- Expression Dark
- Expression Light
- Rainier Purple
- Rainier Orange
- Shiny Blue
- Shiny Red
- Whistler Blue
Sample Demo Site : 보러기기
'Silverlight' 카테고리의 다른 글
| SilverlightTeskTop Application Program (0) | 2008/12/12 |
|---|---|
| Silverlight ChartBuilder 소스코드 및 데모 업데이트 (0) | 2008/12/12 |
| Silverlight Toolkit 2008년 12월 버전 릴리즈 (0) | 2008/12/10 |
| Silverlight Tools(RC1) 한국어버전 출시 (2) | 2008/11/25 |
| 2008 PDC에서 Silverlight Tools 및 Toolkit release & Themes 가 발표되었습니다. (2) | 2008/10/29 |
| Silverlight 2 Controls Review 강좌목록 (0) | 2008/10/27 |
| Silverlight 2 Controls Review - ProgressBar (0) | 2008/10/27 |
| Silverlight 2 Controls Review - TabControl (0) | 2008/10/25 |
글
Silverlight Tools(RC1) 한국어버전 출시
11월 24일 월요일자로 버전업이 되었습니다. 다운로드 : Silverlight_Tools.exe
영문버전버도 약 한달 늦게 나왔습니다. 자세한 내용은 철수네 소프트웨어세상 블로그를 참고하시면 됩니다. 변경된 내용은 다음과 같습니다.
- Visual Basic 및 C# 프로젝트 템플릿
- XAML용 Intellisense 및 코드 생성기
- XAML 디자인 미리 보기
- Silverlight 응용 프로그램의 디버깅
- Mac용 Silverlight 응용 프로그램의 원격 디버깅
- 웹 참조 지원
- WCF 템플릿
- 팀 빌드 및 명령줄 빌드 지원
- Expression Blend와 통합
가장 크게 좋아진것은 무엇보다도 Silverlight 2 SDK 도움말이 바로 한국어로 출시되었다는 것입니다.
다운로드 하러 가기
덧) RC1의 버전은 언제 바뀔까요.. 이젠 버전만 바뀌면 될것 같습니다.
'Silverlight' 카테고리의 다른 글
| SilverlightTeskTop Application Program (0) | 2008/12/12 |
|---|---|
| Silverlight ChartBuilder 소스코드 및 데모 업데이트 (0) | 2008/12/12 |
| Silverlight Toolkit 2008년 12월 버전 릴리즈 (0) | 2008/12/10 |
| Silverlight Tools(RC1) 한국어버전 출시 (2) | 2008/11/25 |
| 2008 PDC에서 Silverlight Tools 및 Toolkit release & Themes 가 발표되었습니다. (2) | 2008/10/29 |
| Silverlight 2 Controls Review 강좌목록 (0) | 2008/10/27 |
| Silverlight 2 Controls Review - ProgressBar (0) | 2008/10/27 |
| Silverlight 2 Controls Review - TabControl (0) | 2008/10/25 |
글
새벽부터 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의 블로그에 소스코드까지 첨부되어서
자세히 분석되어져 있습니다.
실버라이트도 개발툴과 런타임이 최종적으로 정식 릴리즈 되었으니 시장에서 플래시와의 대대적인 한판싸움은 피할 수 없게 된 것 같습니다. 뭐 서로 상생해 가면서 발전할 수 있다면 더욱 좋은 것이겠지요. 실버라이트의 시장에서의 파급효과가 얼마나 커질지 앞으로가 주목됩니다.
'Silverlight' 카테고리의 다른 글
| Silverlight ChartBuilder 소스코드 및 데모 업데이트 (0) | 2008/12/12 |
|---|---|
| Silverlight Toolkit 2008년 12월 버전 릴리즈 (0) | 2008/12/10 |
| Silverlight Tools(RC1) 한국어버전 출시 (2) | 2008/11/25 |
| 2008 PDC에서 Silverlight Tools 및 Toolkit release & Themes 가 발표되었습니다. (2) | 2008/10/29 |
| Silverlight 2 Controls Review 강좌목록 (0) | 2008/10/27 |
| Silverlight 2 Controls Review - ProgressBar (0) | 2008/10/27 |
| Silverlight 2 Controls Review - TabControl (0) | 2008/10/25 |
| Silverlight 2 워터마크 컨트롤 (WatorMarked Text Box Control) (2) | 2008/10/24 |
글
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 컨트롤의 주요 프로퍼티 사용법 및 이벤트를 중심으로 간단한 소스코드를 첨부하여 강좌를 적성하였습니다. 이후 작성될 컨트롤 강좌는 목록에 계속 추가해 나가도록 하겠습니다.
'Silverlight' 카테고리의 다른 글
| Silverlight Toolkit 2008년 12월 버전 릴리즈 (0) | 2008/12/10 |
|---|---|
| Silverlight Tools(RC1) 한국어버전 출시 (2) | 2008/11/25 |
| 2008 PDC에서 Silverlight Tools 및 Toolkit release & Themes 가 발표되었습니다. (2) | 2008/10/29 |
| Silverlight 2 Controls Review 강좌목록 (0) | 2008/10/27 |
| Silverlight 2 Controls Review - ProgressBar (0) | 2008/10/27 |
| Silverlight 2 Controls Review - TabControl (0) | 2008/10/25 |
| Silverlight 2 워터마크 컨트롤 (WatorMarked Text Box Control) (2) | 2008/10/24 |
| Silverlight 2 Controls Review - GridSplitter (0) | 2008/10/22 |
글
Silverlight 2 Controls Review - 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 이벤트는 조건문을 통하여 다운로드 중 에러가 발생했는지 체크를 하고 에러가 없으면 결과값을 보여줍니다.
'Silverlight' 카테고리의 다른 글
| Silverlight Tools(RC1) 한국어버전 출시 (2) | 2008/11/25 |
|---|---|
| 2008 PDC에서 Silverlight Tools 및 Toolkit release & Themes 가 발표되었습니다. (2) | 2008/10/29 |
| Silverlight 2 Controls Review 강좌목록 (0) | 2008/10/27 |
| Silverlight 2 Controls Review - ProgressBar (0) | 2008/10/27 |
| Silverlight 2 Controls Review - TabControl (0) | 2008/10/25 |
| Silverlight 2 워터마크 컨트롤 (WatorMarked Text Box Control) (2) | 2008/10/24 |
| Silverlight 2 Controls Review - GridSplitter (0) | 2008/10/22 |
| SilverlightContrib Controls 릴리즈 (0) | 2008/10/21 |
글
Silverlight 2 Controls Review - TabControl
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>
텝의 타이틀에 이미지를 추가한 모습입니다.
<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 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;
}
}
'Silverlight' 카테고리의 다른 글
| 2008 PDC에서 Silverlight Tools 및 Toolkit release & Themes 가 발표되었습니다. (2) | 2008/10/29 |
|---|---|
| Silverlight 2 Controls Review 강좌목록 (0) | 2008/10/27 |
| Silverlight 2 Controls Review - ProgressBar (0) | 2008/10/27 |
| Silverlight 2 Controls Review - TabControl (0) | 2008/10/25 |
| Silverlight 2 워터마크 컨트롤 (WatorMarked Text Box Control) (2) | 2008/10/24 |
| Silverlight 2 Controls Review - GridSplitter (0) | 2008/10/22 |
| SilverlightContrib Controls 릴리즈 (0) | 2008/10/21 |
| Silverlight 2 Controls Review - Grid 2 (1) | 2008/10/18 |
글
Silverlight 2 워터마크 컨트롤 (WatorMarked Text Box Control)
Silverlight 2 beta 1 버전과 Silverlight 2 정식 릴리즈 버전의 지원되는 컨트롤 비교입니다.
2008년 3월에 Silverlight 2 Beta 1이 발표되면서 컨트롤에 들어있던 ScrollBar, ToolTip, WarkmarkedTextBox, ContentControl 컨트롤이 빠지고 beta 2, RC0, Silverlight 2 (RTW) 순으로 정식버전까지 릴리즈되면서 ComboBox, PasswordBox, ProgressBar, TabControl 컨트롤 등이 추가되었고, 정식 컨트롤형태는 아니지만 MessageBox.Show()의 메소드 형태로 MessageBox가 추가되어 공개되었습니다. RC0이후 정식 버전이 출시되었지만 특별히 추가된 컨트롤은 없습니다. 정식릴리즈에서 WarkmarkedTextBox 컨트롤이 빠졌다는게 조금은 실망이였는데 Tim Heuer( http://timheuer.com/blog )블로그에 커스텀 컨트롤로 WatermarkedTextBox 소스 및 dll을 공개하였습니다.
WaterMarkedTextBox 컨트롤 다운로드
커스텀 컨트롤 테스트
WaterMarkedTextBox 컨트롤을 사용하기 위해선 Silverlight 2 프로젝트를 하나 만들고 Microsoft.Windows.Controls.WatermarkedTextBox.dll 파일을 솔루션 탐색기에서 참조에 추가합니다.
Xaml 코드에는 아래 소스코드와 같이 추가하면 됩니다.
<UserControl x:Class="WatermarkTextBox.Page"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Microsoft.Windows.Controls;assembly=Microsoft.Windows.Controls.WatermarkedTextBox"
Width="400" Height="300">
<Grid x:Name="LayoutRoot" Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="0.313*"/>
<RowDefinition Height="0.113*"/>
<RowDefinition Height="0.117*"/>
<RowDefinition Height="0.127*"/>
<RowDefinition Height="0.33*"/>
</Grid.RowDefinitions>
<local:WatermarkedTextBox x:Name="WmPhoneNumber" Grid.Row="1"
Watermark="휴대폰 입력" HorizontalAlignment="Center"
VerticalAlignment="Center" Width="150"/>
<local:WatermarkedTextBox x:Name="WmName" Grid.Row="2"
HorizontalAlignment="Center" VerticalAlignment="Center"
Watermark="이름 입력" Width="150"/>
<local:WatermarkedTextBox x:Name="WmAddress"
Watermark="주소 입력" Grid.Row="3" Width="150"
HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
</UserControl>
'Silverlight' 카테고리의 다른 글
| Silverlight 2 Controls Review 강좌목록 (0) | 2008/10/27 |
|---|---|
| Silverlight 2 Controls Review - ProgressBar (0) | 2008/10/27 |
| Silverlight 2 Controls Review - TabControl (0) | 2008/10/25 |
| Silverlight 2 워터마크 컨트롤 (WatorMarked Text Box Control) (2) | 2008/10/24 |
| Silverlight 2 Controls Review - GridSplitter (0) | 2008/10/22 |
| SilverlightContrib Controls 릴리즈 (0) | 2008/10/21 |
| Silverlight 2 Controls Review - Grid 2 (1) | 2008/10/18 |
| Silverlight 2 Controls Review - Grid 1 (0) | 2008/10/18 |
설정
트랙백
댓글
글
Silverlight 2 Controls Review - GridSplitter
그리드는 키보드 혹은 마우스등을 이용하여 행과 열의 크기를 자유자재로 조절할 수 있다는 큰 특징이 있습니다. 이것을 가능케하는 컨트롤이 바로 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>
'Silverlight' 카테고리의 다른 글
| Silverlight 2 Controls Review - ProgressBar (0) | 2008/10/27 |
|---|---|
| Silverlight 2 Controls Review - TabControl (0) | 2008/10/25 |
| Silverlight 2 워터마크 컨트롤 (WatorMarked Text Box Control) (2) | 2008/10/24 |
| Silverlight 2 Controls Review - GridSplitter (0) | 2008/10/22 |
| SilverlightContrib Controls 릴리즈 (0) | 2008/10/21 |
| Silverlight 2 Controls Review - Grid 2 (1) | 2008/10/18 |
| Silverlight 2 Controls Review - Grid 1 (0) | 2008/10/18 |
| Silverlight 2 RC1 Tool 한국어버전 출시 (0) | 2008/10/17 |
글
SilverlightContrib Controls 릴리즈
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
'Silverlight' 카테고리의 다른 글
| Silverlight 2 Controls Review - TabControl (0) | 2008/10/25 |
|---|---|
| Silverlight 2 워터마크 컨트롤 (WatorMarked Text Box Control) (2) | 2008/10/24 |
| Silverlight 2 Controls Review - GridSplitter (0) | 2008/10/22 |
| SilverlightContrib Controls 릴리즈 (0) | 2008/10/21 |
| Silverlight 2 Controls Review - Grid 2 (1) | 2008/10/18 |
| Silverlight 2 Controls Review - Grid 1 (0) | 2008/10/18 |
| Silverlight 2 RC1 Tool 한국어버전 출시 (0) | 2008/10/17 |
| Silverlight 2 Controls Review - StackPanel (0) | 2008/10/17 |
글
Silverlight 2 Controls Review - Grid 2
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>
'Silverlight' 카테고리의 다른 글
| Silverlight 2 워터마크 컨트롤 (WatorMarked Text Box Control) (2) | 2008/10/24 |
|---|---|
| Silverlight 2 Controls Review - GridSplitter (0) | 2008/10/22 |
| SilverlightContrib Controls 릴리즈 (0) | 2008/10/21 |
| Silverlight 2 Controls Review - Grid 2 (1) | 2008/10/18 |
| Silverlight 2 Controls Review - Grid 1 (0) | 2008/10/18 |
| Silverlight 2 RC1 Tool 한국어버전 출시 (0) | 2008/10/17 |
| Silverlight 2 Controls Review - StackPanel (0) | 2008/10/17 |
| Silverlight 2 RC1(RTW) 설치(VS2008 영문버전 기준) (0) | 2008/10/14 |
글
Silverlight 2 Controls Review - Grid 1
Grid는 여러 가지 기능을 복합적으로 가진 패널입니다. 실버라이트에서 Canvas 패널과 함께 가장 많이 쓰이는 패널중에 하나입니다. 특히 실버라이트는 그리드를 기본 패널로 하고 있으며, 여러 행과 열로 자식 엘리먼트를 배치 할 수 있도록 해 주며 이를 조절할 수 있는 기능을 제공해 줍니다. 그리드를 통해서 작업하는 것은 HTML 안에서 테이블로 다루는 것과 아주 유사합니다.
4×2 행과 열을 만들고 기본적으로 1셀에 1개의 자식 엘리먼트를 집어넣는 예제입니다.
<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은 한개의 자식 엘리먼트를 여러개의 셀을 합쳐서 사용하고자 할때 사용합니다.
'Silverlight' 카테고리의 다른 글
| Silverlight 2 Controls Review - GridSplitter (0) | 2008/10/22 |
|---|---|
| SilverlightContrib Controls 릴리즈 (0) | 2008/10/21 |
| Silverlight 2 Controls Review - Grid 2 (1) | 2008/10/18 |
| Silverlight 2 Controls Review - Grid 1 (0) | 2008/10/18 |
| Silverlight 2 RC1 Tool 한국어버전 출시 (0) | 2008/10/17 |
| Silverlight 2 Controls Review - StackPanel (0) | 2008/10/17 |
| Silverlight 2 RC1(RTW) 설치(VS2008 영문버전 기준) (0) | 2008/10/14 |
| Silverlight 2 Released!! - x줄타게 기다렸습니다. (0) | 2008/10/14 |
글
Silverlight 2 RC1 Tool 한국어버전 출시
Visual Studio 2008 SP1용 Microsoft® Silverlight™ Tools(RC1) 한국어 버전 출시
다운로드 : Silverlight_Tools.exe
'Silverlight' 카테고리의 다른 글
| SilverlightContrib Controls 릴리즈 (0) | 2008/10/21 |
|---|---|
| Silverlight 2 Controls Review - Grid 2 (1) | 2008/10/18 |
| Silverlight 2 Controls Review - Grid 1 (0) | 2008/10/18 |
| Silverlight 2 RC1 Tool 한국어버전 출시 (0) | 2008/10/17 |
| Silverlight 2 Controls Review - StackPanel (0) | 2008/10/17 |
| Silverlight 2 RC1(RTW) 설치(VS2008 영문버전 기준) (0) | 2008/10/14 |
| Silverlight 2 Released!! - x줄타게 기다렸습니다. (0) | 2008/10/14 |
| Silverlgith 2 Release (0) | 2008/10/14 |
설정
트랙백
-
Silverlight 2 RC1 Tool 한국어버전 출시
삭제
Trackback from HOONS 닷넷(www.hoons.kr) 2008/10/17 21:13HOONS 닷넷
댓글
글
Silverlight 2 Controls Review - StackPanel
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 = "세로정렬";
}
}
}
}
'Silverlight' 카테고리의 다른 글
| Silverlight 2 Controls Review - Grid 2 (1) | 2008/10/18 |
|---|---|
| Silverlight 2 Controls Review - Grid 1 (0) | 2008/10/18 |
| Silverlight 2 RC1 Tool 한국어버전 출시 (0) | 2008/10/17 |
| Silverlight 2 Controls Review - StackPanel (0) | 2008/10/17 |
| Silverlight 2 RC1(RTW) 설치(VS2008 영문버전 기준) (0) | 2008/10/14 |
| Silverlight 2 Released!! - x줄타게 기다렸습니다. (0) | 2008/10/14 |
| Silverlgith 2 Release (0) | 2008/10/14 |
| Silverlight 2 Controls Review - Canvas (0) | 2008/10/13 |
ControlTest17.zip