블로그 이미지
Magic_kit
study 관련자료를 한곳으로 자기 개발 목적으로 재태크 재무 관리 목적으로 일상생활의 팁을 공유 하기 위하여 블로그를 개설 하였습니다.

calendar

1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

Category

Recent Post

Recent Comment

Archive

'.Net Project'에 해당되는 글 538

  1. 2009.12.02 50장 ProgressBar 컨트롤
  2. 2009.12.02 49장 ListBox 컨트롤
  3. 2009.12.02 48장 ComboBox 컨트롤
  4. 2009.12.01 47장 RoutedEventArgs 컨트롤
2009. 12. 2. 15:31 .Net Project/SilverLight 3.0
반응형
  ProgressBar
 - 작업의 진행 상태와 같은 UI를 표시하기 위해서 사용 가능
 - IsIndeterminate 프로퍼티를 설정하여 진행 상태를 두 가지 형태로 표시 가능


  ProgressBar.Xaml
 


<
UserControl x:Class="ProgressBarExample.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:DesignWidth="640" d:DesignHeight="480">

    <StackPanel>

        <StackPanel>

            <StackPanel Orientation="Horizontal" Height="20" Width="300">

                <Button x:Name="btnMinus"

                        Content="-10" Click="btnMinus_Click"

                        Width="30" Height="20"/>

                <Button x:Name="btnPlus" Content="+10"

                        Click="btnPlus_Click" Width="30" Height="20"/>

            </StackPanel>

            <TextBox Text="IsIndeterminate False" Height="20" Width="300" />

            <ProgressBar x:Name="pgbar1"

                         Height="20" Width="300" Value="50"

                         Minimum="0" Maximum="100" IsIndeterminate="False" />

        </StackPanel>

        <StackPanel>

            <TextBox Text="IsIndeterminateTrue " Height="20" Width="300" />

            <ProgressBar x:Name="pgbar2" Height="20" Width="300"

                         IsIndeterminate="True" />

        </StackPanel>

    </StackPanel>

</UserControl>

 ProgressBar .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 ProgressBarExample

{

    public partial class MainPage : UserControl

    {

        public MainPage()

        {

            InitializeComponent();

        }

 

        private void btnMinus_Click(object sender, RoutedEventArgs e)

        {

            //pgbar1 ProgressBar Value 10 감소 

            pgbar1.Value -= 10;

        }

 

        private void btnPlus_Click(object sender, RoutedEventArgs e)

        {

            //pgbar1 ProgressBar Value 10 증가

            pgbar1.Value += 10;

        }

    }

} 





반응형

'.Net Project > SilverLight 3.0' 카테고리의 다른 글

52장 Tab 컨트롤  (0) 2009.12.02
51장 Slider 컨트롤  (0) 2009.12.02
49장 ListBox 컨트롤  (0) 2009.12.02
48장 ComboBox 컨트롤  (0) 2009.12.02
47장 RoutedEventArgs 컨트롤  (0) 2009.12.01
posted by Magic_kit
2009. 12. 2. 15:02 .Net Project/SilverLight 3.0
반응형
  ListBox 컨트롤
- ListBoxItem으로 설정된 컬렉션 컨트롤 입니다
- ItemsControl과 유하나 항목을 선택할 수 있다는 특징이  존재...


 
 ListBox.Xaml

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

    <StackPanel>

        <ListBox x:Name="lstFavorites" Width="150" Height="150">

            <ListBox.Items>

                <ListBoxItem>

                    <TextBlock Text="C#" 
                               FontSize
="20"></TextBlock>               

                </ListBoxItem>

                <ListBoxItem>

                    <TextBlock Text="ASP.NET" FontSize="20"></TextBlock>

                </ListBoxItem>

                <ListBoxItem>

                    <TextBlock Text="J-Query" FontSize="20"></TextBlock>

                </ListBoxItem>

                <ListBoxItem>

                    <TextBlock Text="SilverLight" FontSize="20"></TextBlock>

                </ListBoxItem>

            </ListBox.Items>          

        </ListBox>

        <TextBlock x:Name="lblDisplay" FontSize="20" Width="100"
                                       Height
="20"></TextBlock>

    </StackPanel>

</UserControl> 

  ListBox.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 RiaListBox

{

    public partial class MainPage : UserControl

    {

        public MainPage()

        {

            InitializeComponent();

            lstFavorites.SelectionChanged +=
              
new SelectionChangedEventHandler(lstFavorites_SelectionChanged);

        }

 

        void lstFavorites_SelectionChanged
                                   (
object sender, SelectionChangedEventArgs e)

        {

            this.lblDisplay.Text =
                ((
TextBlock)((ListBoxItem)this.lstFavorites.Items[

                lstFavorites.SelectedIndex]).Content).Text;           

        }

    }

} 





반응형

'.Net Project > SilverLight 3.0' 카테고리의 다른 글

51장 Slider 컨트롤  (0) 2009.12.02
50장 ProgressBar 컨트롤  (0) 2009.12.02
48장 ComboBox 컨트롤  (0) 2009.12.02
47장 RoutedEventArgs 컨트롤  (0) 2009.12.01
46장 InkPresenter 컨트롤  (0) 2009.12.01
posted by Magic_kit
2009. 12. 2. 14:30 .Net Project/SilverLight 3.0
반응형
  ComboBox 컨트롤
 - 리스트 항목을 다음과 같이표시
 - 드롭 다운 리스트 항목 표시
 - ListBoxItem을 상속 받아 구현되어 있는 ComboBoxItem으로 구성된 컬렉션 컨트롤 입니다
  ComboBox.Xaml
 

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

       

    <StackPanel>

        <ComboBox x:Name="enc" Margin="5" Width="200" Height="20" >

            <ComboBox.Items>

                <ComboBoxItem Content="SilverLight"

                              Background="Gray"

                              FontSize="15">                   

                </ComboBoxItem>

                <ComboBoxItem Content="Java"

                              Background="Gray"

                              FontSize="15">                   

                </ComboBoxItem>

                <ComboBoxItem Content="J-Query"

                              Background="Gray"

                              FontFamily="Arial" FontSize="15"></ComboBoxItem>

            </ComboBox.Items>

        </ComboBox>

        <Button x:Name="btnSelect" Content="Select"

                Width="200" Height="20" Margin="5" ></Button>

        <TextBox x:Name="lblSelect" Width="200" Height="30"

                 ScrollViewer.HorizontalScrollBarVisibility="Auto"></TextBox>

    </StackPanel>   

</UserControl> 

  ComboBox.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 RiaComboBox

{

    public partial class MainPage : UserControl

    {

        public MainPage()

        {

            InitializeComponent();

            btnSelect.Click += new RoutedEventHandler(btnSelect_Click);

        }

 

        void btnSelect_Click(object sender, RoutedEventArgs e)

        {

            //lblSelect.Text = enc.SelectedItem.ToString();            

            //[1] Get Items 선택 항목을 텍스트 박스에 출력

            //lblSelect.Text = enc.SelectionBoxItem.ToString();

           

            //[2] Get Items 선택 항목을 다음과 같이 3줄로 나눠서 출력

            ComboBox cb = this.enc as ComboBox;

            ListBoxItem lbi = cb.SelectedItem as ListBoxItem; //Get Select Items

            lblSelect.Text = lbi.Content.ToString();

        }       

    }

} 





반응형

'.Net Project > SilverLight 3.0' 카테고리의 다른 글

50장 ProgressBar 컨트롤  (0) 2009.12.02
49장 ListBox 컨트롤  (0) 2009.12.02
47장 RoutedEventArgs 컨트롤  (0) 2009.12.01
46장 InkPresenter 컨트롤  (0) 2009.12.01
45장) Drag&Drop 컨트롤  (0) 2009.12.01
posted by Magic_kit
2009. 12. 1. 16:44 .Net Project/SilverLight 3.0
반응형
   RoutedEventArgs 컨트롤
 -
   RoutedEventArgs.Xaml


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

        <Rectangle x:Name="lblRect" Fill="Blue" Margin="20"></Rectangle>

        <TextBlock x:Name="lblName" Text="Silverlight"

                   FontSize="30" Foreground="White"

                   Width="200" Height="200"></TextBlock>

    </Grid>

</UserControl>

   RoutedEventArgs.Cs 실행화면...

TextBlock 클릭시 발생)


Grid Layout 클릭시 발생)


Rectgle 클릭시 발생)


 RoutedEventArgs.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 RiaRoutedEventArgs

{

    public partial class MainPage : UserControl

    {

        public MainPage()

        {

            InitializeComponent();

 

            //Grid

            this.LayoutRoot.MouseLeftButtonUp += new MouseButtonEventHandler
                            (LayoutRoot_MouseLeftButtonUp);

            //Rect

            this.lblRect.MouseLeftButtonUp += new MouseButtonEventHandler
                            (lblRect_MouseLeftButtonUp);

            //TextBlock

            this.lblName.MouseLeftButtonUp += new MouseButtonEventHandler
                            (lblName_MouseLeftButtonUp);

        }

 

        void lblName_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)

        {

            MessageBox.Show("TextBlock : MouseUp Event Handle");

            //이벤트 버플링(부모 요소에게 이벤트 전달­) 중지 : 라우팅 중지

            e.Handled = true; //부모 요소로 중지 의미

        }

 

        void lblRect_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)

        {

            MessageBox.Show("Rectangle : MouseUp Event Handle");         

        }

 

        void LayoutRoot_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)

        {

            MessageBox.Show("Grid Layout : MouseUp Event Handle");

            //[!]이벤트 발생 시킨 개체 찾기
            if (e.OriginalSource is Rectangle)

            {

                //원본 개체를 사각형으로 변경
                Rectangle r = e.OriginalSource as Rectangle;

                r.Fill = new SolidColorBrush(Colors.Green);

            }

        }

    }

} 





반응형

'.Net Project > SilverLight 3.0' 카테고리의 다른 글

49장 ListBox 컨트롤  (0) 2009.12.02
48장 ComboBox 컨트롤  (0) 2009.12.02
46장 InkPresenter 컨트롤  (0) 2009.12.01
45장) Drag&Drop 컨트롤  (0) 2009.12.01
42장) ScrollViewer 컨트롤  (0) 2009.12.01
posted by Magic_kit