'WPF'에 해당되는 글 2건

  1. [WPF] XAML (Extensible Application Markup Language)
  2. [WPF] WPF란?

[WPF] XAML(Extensible Application Markup Language)

XAML이 WPF의 컨트롤과 컨트롤의 레이아웃을 정의한다
디자이너이면 Microsoft Expression Blend을 이용하게 될 것이고, 개발자면 비주얼 스튜디오를 사용한다

비주얼 스튜디오에서 XAML 컴파일을 하게 되면 BAML(바이너리)로 변환되게 된다.

** top-level element
• Window
• Page (which is similar to Window, but used for navigable applications)
• Application (which defines application resources and startup settings)


** The Code-Behind Class
<Window x:Class="WindowsApplication1.Window1"

namespace WindowsApplication1
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
    public Window1()
    {
        InitializeComponent();
    }
}
}

** Attached Properties- DefiningType.PropertyName
They’re actually translated into method
calls.

example)
<TextBox ... Grid.Row="0">
[Place question here.]
</TextBox>

--> Grid.SetRow(txtQuestion, 0);

** Special Characters andWhitespace
<Button ... >
<Click Me>
</Button>
--> should be
<Button ... >
&lt;Click Me&gt;
</Button>

<TextBox Name="txtQuestion" xml:space="preserve" ...>
[There is a lot of space inside these quotation marks " ".]
</TextBox>


** Events
<Button ... Click="cmdAnswer_Click">


** Using Types from Other Namespaces
xmlns:Prefix="clr-namespace:Namespace;assembly=AssemblyName"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:local="clr-namespace:MyNamespace"

<local:MyObject ...></local:MyObject>

XAML doesn’t support parameterized constructors, and all the elements
in WPF elements include a no-argument constructor.

<Window x:Class="WindowsApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Width="300" Height="300"
>
<ListBox>
<ListBoxItem>
<sys:DateTime>10/13/2010 4:30 PM</sys:DateTime>
</ListBoxItem>
<ListBoxItem>
<sys:DateTime>10/29/2010 12:30 PM</sys:DateTime>
</ListBoxItem>
<ListBoxItem>
<sys:DateTime>10/30/2010 2:30 PM</sys:DateTime>
</ListBoxItem>
</ListBox>
</Window>

** Loading and Compiling XAML

[WPF] WPF란?

WPF는 Direct X를 사용한다. 기존의 GDI/GDI+를 사용하지 않는다.

** 하드웨어 가속과 WPF
WPF는 소프트웨어 계산을 사용하는 모든 것을 수행할 수 있는 능력을 가지고 있다. 즉, 비디오 카드에 내장된 특정 지원에 의존적이지 않다

WPF는 Vista에서 더욱 좋은 성능을 발휘한다. 이유는 WDDM(Windows Vista Display Driver Model (WDDM))
또한, 오래된 비디오카드가 장착된 컴퓨터로는 WPF 어플리케이션을 잘 구동시킬 수 없다. 물론 기존의 GDI 타입보다는 빠른 성능을 보여주긴 한다.

** WPF: A Higher-Level API
A web-like layout model - 컨트롤 사이즈를 자유롭게 운용
A rich drawing model
A rich text model
Animation as a first-class programming concept.
Support for audio and video media.
Support for audio and video media.
Commands
Declarative user interface.
Page-based applications

** Resolution Independence

** New Features in WPF 3.5
Firefox support for XBAPs
Data binding support for LINQ.
Data binding support for IDataErrorInfo
Support for placing interactive controls (such as buttons) inside a RichTextBox control.
Support for placing 2-D elements on 3-D surfaces.
An add-in model.

** Windows Forms Lives On
윈도우즈 폼 컨트롤도 WPF안에서 사용되지 질 수 있다. 윈도우 폼을 수용함으로 새로운 윈도우 기반 프로젝트에서는 적용할만 하다.

** Silverlight
FireFox와 Internet Exlore를 지원하는 WPF, 웹기반 어플리케이션일지라도 결국은 윈도우 OS기반에서만 돌아간다. 그러나 실버라이트는 리눅스상의 웹브라우져에서도 구동한다.


** Class Hierachy

사용자 삽입 이미지

WPF 네임스페이스는 System.Windows, System.WIndows.Controls, System.Windows.Media 와 같은 구조를 가진다.


- System.Threading.DispatcherObject
- System.Windows.DependencyObject
- System.Windows.Media.Visual
- System.Windows.UIElement
- System.Windows.FrameworkElement
- System.Windows.Shapes.Shape
- System.Windows.Controls.Control
- System.Windows.Controls.ContentControl
- System.Windows.Controls.ItemsControl
- System.Windows.Controls.Panel