• 検索結果がありません。

Microsoft PowerPoint - Windows Presentation Foundation (WPF) 3.5 の新機能

N/A
N/A
Protected

Academic year: 2021

シェア "Microsoft PowerPoint - Windows Presentation Foundation (WPF) 3.5 の新機能"

Copied!
21
0
0

読み込み中.... (全文を見る)

全文

(1)

WPF

WPF 3.5

3.5 の新機能

の新機能

WPF

WPF 3.5

3.5 の新機能

の新機能

川⻄ 川⻄ 裕幸裕幸 UX UX エバンジェリストエバンジェリスト デベロッパー&プラットフォーム統括本部 デベロッパー&プラットフォーム統括本部 マイクロソフト株式会社 マイクロソフト株式会社

(2)

WPF 3.5 ?

WPF 3.5 ?

WPF 3.5 ?

WPF 3.5 ?

NET F

k 3 5

NET F

k 3 5 に含まれる

に含まれる WPF

WPF

.NET Framework 3.5

.NET Framework 3.5 に含まれる

に含まれる WPF

WPF

SP1 + SP1 + 新しいアセンブリ(新しいアセンブリ(System.Core.dllSystem.Core.dll など)など) Linq

Linq はは System.Core.dllSystem.Core.dll に含まれるに含まれる

.NET Framework 3.0 SP1

.NET Framework 3.0 SP1 に含まれる

a e o 3 0 S

a e o 3 0 S

に含まれる WPF

に含まれる

に含まれる

WPF

Windows Server 2008 Windows Server 2008 Windows Vista SP1 Windows Vista SP1 Windows Vista SP1 Windows Vista SP1 ただし、 ただし、LinqLinq バインディングを使うときは注意バインディングを使うときは注意

詳しくは

詳しくは Visual Studio 2008

Visual Studio 2008 ドキュメント

ドキュメント

詳しくは

詳しくは Visual Studio 2008

Visual Studio 2008 ドキュメント

ドキュメント

バージョン情報を参照 バージョン情報を参照

(3)

互換性

互換性

互換性

互換性

WPF 3 0

WPF 3 0 でビルドしたアプリは

でビルドしたアプリは WPF3 5

WPF3 5 上

WPF 3.0

WPF 3.0 でビルドしたアプリは

でビルドしたアプリは WPF3.5

WPF3.5 上

(ex. Vista SP1

ex. Vista SP1)で動作

)で動作

WPF 3.5

WPF 3.5 でビルドしたアプリは

でビルドしたアプリは WPF3.0

WPF3.0 上で

上で

は動作しない

は動作しない NET Framework 3 5

NET Framework 3 5 のインス

のインス

は動作しない、

は動作しない、.NET Framework 3.5

.NET Framework 3.5 のインス

のインス

トールが必要

トールが必要

新機能を使 ていなければ動作するかもしれない 新機能を使 ていなければ動作するかもしれない 新機能を使っていなければ動作するかもしれない 新機能を使っていなければ動作するかもしれない...

新しいスキーマ

新しいスキーマ

http://schemas.microsoft.com/netfx/2007/xaml/presentation http://schemas.microsoft.com/netfx/2007/xaml/presentation http://schemas.microsoft.com/netfx/2007/xaml/presentation http://schemas.microsoft.com/netfx/2007/xaml/presentation

これまでのスキーマも有効

これまでのスキーマも有効

(4)

アプリケーション

アプリケーション モデル

モデル

アプリケ ション

アプリケ ション モデル

モデル

XBAP

XBAP

XBAP

XBAP

Firefox Firefox HTTP HTTP CookieCookie 部分信頼 部分信頼 WCF WCF サービスサービス

Add

Add--In

In サポート

サポート

dll dll を実⾏時に動的に統合できるを実⾏時に動的に統合できる dll dll を実⾏時に動的に統合できるを実⾏時に動的に統合できる

(5)

部分信頼

部分信頼 WCF

WCF サービス

サービス

部分信頼

部分信頼 WCF

WCF サ ビス

サ ビス

ASP NET

ASP NET 中間アクセス権で動作するサ バ アプリで

中間アクセス権で動作するサ バ アプリで

ASP.NET

ASP.NET 中間アクセス権で動作するサーバーアプリで、

中間アクセス権で動作するサーバーアプリで、

WCF Service Model

WCF Service Model を使って基本

を使って基本 HTTP

HTTP サービスを作成

サービスを作成

インタ ネット

インタ ネット ゾ ン

ゾ ン アクセス権で動作するクライアン

アクセス権で動作するクライアン

インターネット

インターネット ゾーン

ゾーン アクセス権で動作するクライアン

アクセス権で動作するクライアン

ト アプリ(

アプリ(ex. XBAP

ex. XBAP)は、

)は、WCF

WCF プロキシ経由で

プロキシ経由で HTTP

HTTP

サービスを利⽤

サービスを利⽤

サ ビスを利⽤

サ ビスを利⽤

部分信頼

部分信頼 フルサポート

フルサポート

部分信頼

部分信頼 フルサポ ト

フルサポ ト

BasicHttpBinding

BasicHttpBinding, , WebHttpBindingWebHttpBinding

トランスポート

トランスポート セキュリティ

セキュリティ モードのみサポート

モードのみサポート

トランスポ ト

トランスポ ト セキュリティ

セキュリティ モ ドのみサポ ト

モ ドのみサポ ト

WSHttpBinding WSHttpBinding

部分信頼⾮サポート

部分信頼⾮サポート

部分信頼⾮サポ ト

部分信頼⾮サポ ト

NetTcpBinding

(6)

Add

Add--In

In

Add

Add In

In

WPF

WPF は

は Add

Add In

In を使って

を使って UI

UI を表⽰できる

を表⽰できる

WPF

WPF は

は Add

Add--In

In を使って

を使って UI

UI を表⽰できる

を表⽰できる

UI UI を返すを返す AddAdd--InIn ロードする条件によって変化する ロードする条件によって変化する UIUI ロ ドする条件によって変化する ロ ドする条件によって変化する UIUI UI UI であるである AddAdd--InIn 同じ 同じ UIUI を表⽰を表⽰ ex.ex.カラーピッカーカラーピッカー

F

kEl

t

F

kEl

t を継承したクラス

を継承したクラス

FrameworkElement

FrameworkElement を継承したクラス

を継承したクラス

Shape, Control, User Control, Panel Shape, Control, User Control, Panel

⼿順

⼿順

⼿順

⼿順

パイプラインの作成 パイプラインの作成 契約の宣⾔ 契約の宣⾔ 契約の宣⾔ 契約の宣⾔ Add

Add--InIn はは FrameworkElementFrameworkElement をを INativeHandleContractINativeHandleContract にに 変換して返す(あるいは⾃分⾃⾝を変換して渡す) 変換して返す(あるいは⾃分⾃⾝を変換して渡す) 返された(あるいは渡された) 返された(あるいは渡された) INativeHandleContractINativeHandleContract をを 返された(あるいは渡された) 返された(あるいは渡された) INativeHandleContractINativeHandleContract をを FrameworkElement FrameworkElement に変換に変換 ホストアプリは返された(あるいは渡された) ホストアプリは返された(あるいは渡された) F kEl t F kEl t を表⽰を表⽰ FrameworkElement FrameworkElement を表⽰を表⽰

(7)

データ

データ

デ タ

デ タ

ビジネス

ビジネス オブジ クト検証

オブジ クト検証

ビジネス

ビジネス オブジェクト検証

オブジェクト検証

IDataErrorInfo IDataErrorInfo {Binding

{Binding ValidatesOnDataErrorsValidatesOnDataErrors=true}=true}

Linq

Linq および

および Xlinq

Xlinq バインディング

バインディング サポート

サポート

Linq

Linq および

および Xlinq

Xlinq バインディング

バインディング サポ ト

サポ ト

Path=Element[content].Attribute[

Path=Element[content].Attribute[urlurl].Value].Value

XML (DOM)

XML (DOM) バインディング性能改善

バインディング性能改善

XML (DOM)

XML (DOM) バインディング性能改善

バインディング性能改善

DataSet

DataSet バインディング性能改善

バインディング性能改善

(8)

データ

データ

デ タ

デ タ

デバ グの改善

デバ グの改善

デバッグの改善

デバッグの改善

バンディング バンディング トレーストレース PresentationTraceSources.TraceLevel PresentationTraceSources.TraceLevel

Low, Medium, High Low, Medium, High

<Window x:Class=“SampleApplication.Window1”

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

xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:diag=“clr‐namespace:System.Diagnostics;assembly=WindowsBase”> <Button Background=“{Binding Path=ProductColor, di P t ti T S T L l Hi h”/ diag:PresentationTraceSource.TraceLevel=High”/> </Window>

Binding

Binding の新しいプロパティ

の新しいプロパティ

ValidatesOnExceptions ValidatesOnExceptionspp ValidatesOnDataErrors ValidatesOnDataErrors

(9)

テキスト

テキスト

テキスト

テキスト

T tB

T tB

の IME

IME サポ ト

サポ ト

TextBox

TextBox の

の IME

IME サポート

サポート

FrameworkTextComposition FrameworkTextCompositionに新しいプロパティに新しいプロパティ CompositionOffset CompositionOffset CompositionLenght CompositionLenght ResultOffset ResultOffset ResultLength ResultLength IME

IME で⼊⼒中、で⼊⼒中、TextInputTextInput, , TextInputUpdateTextInputUpdate, , TextInputStart TextInputStart イベントが発⽣するととき、イベントが発⽣するととき、 T tC iti E tA T tC iti T tC iti E tA T tC iti として使⽤として使⽤ TextCompositionEventArgs.TextComposition TextCompositionEventArgs.TextComposition として使⽤として使⽤

RichTextBox

RichTextBoxの改善

の改善

UIElement UIElement がインラインで可能がインラインで可能 カスタム カスタム TextElementTextElementが可能が可能

(10)

サウンド

サウンド

サウンド

サウンド

応答⾳再⽣⽤の新しいクラス

応答⾳再⽣⽤の新しいクラス

応答⾳再⽣⽤の新しいクラス

応答⾳再⽣⽤の新しいクラス

SoundPlayerAction SoundPlayerAction <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <Page.Triggers> <EventTrigger RoutedEvent="Button.Click" SourceName="clickButton"> <EventTrigger.Actions> <SoundPlayerAction Source="media¥lowbat.wav"/> </EventTrigger Actions> </EventTrigger.Actions> </EventTrigger> <EventTrigger RoutedEvent="Button.MouseEnter" SourceName="hoverButton"> <EventTrigger.Actions> <SoundPlayerAction Source="media¥tada.wav"/> </EventTrigger.Actions> </EventTrigger> </Page.Triggers> </Page.Triggers> <StackPanel Width="200"> <Button Name="clickButton">Click to Play Sound</Button> B tt  N "h B tt " H  t  Pl  S d /B tt <Button Name="hoverButton">Hover to Play Sound</Button> </StackPanel> </Page>

(11)

パフォーマンス

パフォーマンス

パフォ マンス

パフォ マンス

レイヤ ウ ンドウのハ ドウ ア化

レイヤ ウ ンドウのハ ドウ ア化

レイヤーウィンドウのハードウェア化

レイヤーウィンドウのハードウェア化

(12)

パフォーマンス

パフォーマンス

パフォ マンス

パフォ マンス

レイヤ ウ ンドウのハ ドウ ア化

レイヤ ウ ンドウのハ ドウ ア化

レイヤーウィンドウのハードウェア化

レイヤーウィンドウのハードウェア化

KB938660 KB938660 でも解決でも解決

(13)

3D

D

System.Windows.Media.Media3D.Visual3DSystem.Windows.Media.Media3D.Visual3DSystem.Windows.Media3D.ModelVisual3DSystem.Windows.Media3D.ModelVisual3D

3D

D

System.Windows.UIElemt3D System.Windows.UIElemt3D System.Windows.Media.Media3D.ContainerUIElemt3D System.Windows.Media.Media3D.ContainerUIElemt3D System.Windows.Media3D.ModelVisual3D System.Windows.Media3D.ModelVisual3D System.Windows.Media.Media3D.ModelUIElement3D System.Windows.Media.Media3D.ModelUIElement3D System.Windows.Media3D.Viewport2DVisual3D System.Windows.Media3D.Viewport2DVisual3D

UIElement3D

UIElement3D(仮想)

(仮想)

C t i UIEl t3D M d lUIEl t3D C t i UIEl t3D M d lUIEl t3D ContainerUIElement3D, ModelUIElement3D ContainerUIElement3D, ModelUIElement3D ⼊⼒、フォーカス、イベントをサポートする ⼊⼒、フォーカス、イベントをサポートするModelVisual3DModelVisual3D O M d lU d O M d lU d II lidlid M d lM d lメソ ドを持メソ ドを持 OnModelUpdate

OnModelUpdate, , InvalidateModelInvalidateModelメソッドを持つメソッドを持つ

Viewport2DVisual3D

Viewport2DVisual3D

(機能する)

(機能する)VisualVisualが張れるが張れるModelVisual3DModelVisual3D 3D 3D上のインタラクティブな上のインタラクティブな2D2Dコンテンツコンテンツ 33 上のインタラクティブな上のインタラクティブな ンテンツンテンツ

GeneralTransform3D

GeneralTransform3D(仮想)

(仮想)

新しい座標変換クラス 新しい座標変換クラス 新しい座標変換クラス 新しい座標変換クラス GeneralTransform3DTo2D, GeneralTransform2DTo3D GeneralTransform3DTo2D, GeneralTransform2DTo3D

(14)

UIElement3D

UIElement3D

UIElement3D

UIElement3D

UIEl

t

UIEl

tと同等のイベントハンドリング

と同等のイベントハンドリング

UIElement

UIElementと同等のイベントハンドリング

と同等のイベントハンドリング

交差テスト⽤コードを書く必要はもうない 交差テスト⽤コードを書く必要はもうない 内部階層のルーティング 内部階層のルーティング イベントも処理イベントも処理 レイアウト機能はない レイアウト機能はない

(15)

UIElement3D

UIElement3D その

その11

UIElement3D

UIElement3D その

その11

H dli

E

t i 3

H dli

E

t i 3 D S

D S

l

l

Handling Events in 3

Handling Events in 3--D Sample

D Sample

<ModelUIElement3D

<ModelUIElement3D MouseDownMouseDown “Cube1MouseDown”>“Cube1MouseDown”> <ModelUIElement3D

<ModelUIElement3D MouseDownMouseDown=“Cube1MouseDown”>=“Cube1MouseDown”> <ModelUIElement3D.Transform><ModelUIElement3D.Transform>

<TranslateTransform3D <TranslateTransform3D OffsetZOffsetZ=“1.5” />=“1.5” /> </ModelUIElement3D Transform>

</ModelUIElement3D Transform> </ModelUIElement3D.Transform> </ModelUIElement3D.Transform> <ModelUIElement3D.Model><ModelUIElement3D.Model>

<GeometryModel3D Geometry="{<GeometryModel3D Geometry="{StaticResourceStaticResource CubeMeshCubeMesh}">}"> <GeometryModel3D Material>

<GeometryModel3D Material>

<GeometryModel3D.Material><GeometryModel3D.Material>

<<DiffuseMaterialDiffuseMaterial x:Name=“cube1Material” Brush=“Blue” />x:Name=“cube1Material” Brush=“Blue” /> </GeometryModel3D.Material></GeometryModel3D.Material> </GeometryModel3D> </GeometryModel3D> </GeometryModel3D></GeometryModel3D> </ModelUIElement3D.Model></ModelUIElement3D.Model> </ModelUIElement </ModelUIElement33D>D>

private void Cube1MouseDown(object sender,

private void Cube1MouseDown(object sender, MouseButtonEventArgsMouseButtonEventArgs e)e) {{ cube1Material.Brush = cube1Material.Brush = ( b 1M i l B h ( b 1M i l B h BB h Blh Bl ?? BB h R dh R d BB h Blh Bl )) (cube1Material.Brush ==

(cube1Material.Brush == Brushes.BlueBrushes.Blue ? ? Brushes.RedBrushes.Red : : Brushes.BlueBrushes.Blue);); }}

(16)

UIElement3D

UIElement3D その

その22

UIElement3D

UIElement3D その

その22

O M d lU d t O M d lU d t II lid t M d llid t M d lメソ ドによりメソ ドにより OnModelUpdate

OnModelUpdate, , InvalidateModelInvalidateModelメソッドにより、メソッドにより、 データバインディングを使った通知が可能に データバインディングを使った通知が可能に プロパティ変更による⾃⼰変更が可能な プロパティ変更による⾃⼰変更が可能な UIElement3DUIElement3D 派⽣派⽣ プロパティ変更による⾃⼰変更が可能な プロパティ変更による⾃⼰変更が可能な UIElement3D UIElement3D 派⽣派⽣ クラスが作成できる クラスが作成できる <Slider Width=“300” Maximum=“60” Minimum=“‐60” Margin=“10” Value=“{Binding ElementName=MyCylinder, Path=Angle}”/> <Viewport3D Width=“480” Height=“400” Margin=“10” > <Viewport3D.Camera> <PerspectiveCamera Position=“0,3,10” FieldOfView=“45”/> </Viewport3D.Camera> l l li d “ li d ” / <local:Cylinder x:Name=“MyCylinder”  /> <ModelVisual3D> <ModelVisual3D.Content>

<Di ti lLi ht C l “Whit ” Di ti “0 0 1”/> <DirectionalLight Color=“White” Direction=“0,0,‐1”/> </ModelVisual3D.Content>

</ModelVisual3D> </Viewport3D>

(17)

UIElement3D

UIElement3D その

その22

UIElement3D

UIElement3D その

その22

protected override void OnUpdateModel() { GeometryModel3D model = new GeometryModel3D(); model.Geometry = Tessellate(Angle); model.Material = new DiffuseMaterial(Brushes.Blue); Model = model; } i i

public static readonly DependencyProperty AngleProperty = DependencyProperty.Register( “Angle“, typeof(double), typeof(Cylinder),  P t M t d t (0 0  A l P t Ch d)) new PropertyMetadata(0.0, AnglePropertyChanged)); private static void AnglePropertyChanged(DependencyObject d,  DependencyPropertyChangedEventArgs e) { { Cylinder s = (Cylinder)d; s.InvalidateModel(); } } public double Angle { get {return (double)GetValue(AngleProperty);} get {return (double)GetValue(AngleProperty);} set {SetValue(AngleProperty, value);} }

(18)

Viewport2DVisual3D

Viewport2DVisual3D

Viewport2DVisual3D

Viewport2DVisual3D

Vi

t3D

Vi

t3D 内でも

内でも Vi

Vi

l

l が使える

が使える

Viewport3D

Viewport3D 内でも

内でも Visual

Visual が使える

が使える

Binding

Binding が利⽤できる

gg が利⽤できる

が利⽤できる

が利⽤できる

イベントハンドラとコールバックが利⽤できる

イベントハンドラとコールバックが利⽤できる

ただし ただし PP ii イベントハンドラを使うことイベントハンドラを使うこと ただし、 ただし、Preview Preview イベントハンドラを使うことイベントハンドラを使うこと

(19)

Viewport2DVisual3D

Viewport2DVisual3D

Viewport2DVisual3D

Viewport2DVisual3D

<Vi t2DVi l3D N " M d l1“ G t "{St ti R S }" > <Viewport2DVisual3D x:Name="myModel1“ Geometry="{StaticResource mySquare}" >

<Viewport2DVisual3D.Transform> <RotateTransform3D>

<RotateTransform3D.Rotation>

<AxisAngleRotation3D Angle="-45" Axis="0 1 0" /> </RotateTransform3D.Rotation> </RotateTransform3D> </Viewport2DVisual3D Transform> </Viewport2DVisual3D.Transform> <Viewport2DVisual3D.Material> <DiffuseMaterial Brush="White" Viewport2DVisual3D.IsVisualHostMaterial="True"/> </Viewport2DVisual3D.Material> <StackPanel>

<TextBox Name="myInput" Background="White" Width="100" Height="20"/> <TextBlock Name="myText" Background="Red" Width="50" Height="50"

<TextBlock Name= myText Background= Red Width= 50 Height= 50 Text="{Binding ElementName=myInput, Path=Text}“ />

<Button PreviewMouseLeftButtonDown="Button_MouseLeftButtonDown"> Change Color / </Button> </StackPanel> </Viewport2DVisual3D>

(20)

GeneralTransform3D

GeneralTransform3D

GeneralTransform3D

GeneralTransform3D

3D

3D間

間 3D

3Dと

と2D

2D間の座標変換

間の座標変換

3D

3D間、

間、3D

3Dと

と2D

2D間の座標変換

間の座標変換

3D 3Dジオメトリの点などをジオメトリの点などを2D2D空間に座標変換したいとき便利空間に座標変換したいとき便利

GeneralTransform3D

GeneralTransform3D

Visual3D TransformToAncestor(Visual3D) Visual3D TransformToAncestor(Visual3D) Visual3D.TransformToAncestor(Visual3D) Visual3D.TransformToAncestor(Visual3D) Visual3D.TransformToDescendant(Visual3D) Visual3D.TransformToDescendant(Visual3D)

GeneralTransform3DTo2D

GeneralTransform3DTo2D

GeneralTransform3DTo2D

GeneralTransform3DTo2D

Visual3D.TransformToAncestor(Visual) Visual3D.TransformToAncestor(Visual) Canvas A D

GeneralTransform2DTo3D

GeneralTransform2DTo3D

Visual.TransformToAncester

Visual.TransformToAncester(Visual3D)(Visual3D) Viewport3D

A n c e e s c e Visual.TransformToAncester Visual.TransformToAncester(Visual3D)(Visual3D) ModelVisual3D Parent s t o r e n d a ModelVisual3D Child r n t

(21)

ご質問は?

ご質問は?

ご質問は?

ご質問は?

参照

関連したドキュメント

1 モデル検査ツール UPPAAL の概要 モデル検査ツール UPPAAL [19] はクライアント サーバアーキテクチャで実装されており,様々なプ ラットフォーム (Linux, windows,

東京工業大学

*この CD-ROM は,Microsoft Edge,Firefox,Google Chrome,Opera,Apple Safari

4G LTE サービス向け完全仮想化 NW を発展させ、 5G 以降のサービス向けに Rakuten Communications Platform を自社開発。. モデル 3 モデル

3.5 今回工認モデルの妥当性検証 今回工認モデルの妥当性検証として,過去の地震観測記録でベンチマーキングした別の

予報モデルの種類 予報領域と格子間隔 予報期間 局地モデル 日本周辺 2km 9時間 メソモデル 日本周辺 5km 39時間.. 全球モデル

解析モデル平面図 【参考】 修正モデル.. 解析モデル断面図(その2)

※ Surface Pro 9、 Surface Pro 9 with 5G、 Surface Laptop 5、 Surface Studio 2+ の法人向けモデルには Microsoft 365 Apps