Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
WPF勉強会 第5回 テンプレート/WPFStudy5
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
hachiilcane
March 01, 2022
Programming
180
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
WPF勉強会 第5回 テンプレート/WPFStudy5
WPF勉強会 第5回 テンプレート
説明後に実演するライブコーディングのコードはこちら。
https://github.com/hachiilcane/WpfStudy
hachiilcane
March 01, 2022
More Decks by hachiilcane
See All by hachiilcane
機械学習勉強会01 1次関数での回帰分析/MLStudy01
hachiilcane
0
67
機械学習勉強会02 多項式近似と最小二乗法による推定/MLStudy02
hachiilcane
0
120
機械学習勉強会03 最急降下法/MLStudy03
hachiilcane
0
40
機械学習勉強会04 偏微分と連鎖律/MLStudy04
hachiilcane
0
45
機械学習勉強会05 パーセプトロン/MLStudy05
hachiilcane
0
45
機械学習勉強会06 ロジスティック回帰/MLStudy06
hachiilcane
0
59
機械学習勉強会07 ROC曲線/MLStudy07
hachiilcane
0
45
機械学習勉強会08 2次元入力3クラス分類/MLStudy08
hachiilcane
0
76
機械学習勉強会09 2層フィードフォワードニューラルネット/MLStudy09
hachiilcane
0
75
Other Decks in Programming
See All in Programming
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Kaigi on Rails 2026, Tokyo, Japan
marcoroth
2
240
APNsからLive Activityを開始する話
yumnumm
0
170
Simple Storage Service(S3) is not simple
iwatsukayura
0
290
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
28
33k
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
個人開発者よ、Honoを使え(おじさんver)
tanahiro2010
2
260
Web Framework Benchmark Battle 2026, Any%
a_matsuda
2
2.3k
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.9k
Next.js: The final boss of Web Performance
guaca
0
270
Railsバージョンを4倍にした話
optim
0
440
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
5
5.2k
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
620
Featured
See All Featured
How Software Deployment tools have changed in the past 20 years
geshan
2
35k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
940
Build your cross-platform service in a week with App Engine
jlugia
234
19k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.2k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
1
280
StorybookのUI Testing Handbookを読んだ
zakiyama
31
7k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
330
BBQ
matthewcrist
90
10k
Intergalactic Javascript Robots from Outer Space
tanoku
273
28k
Faster Mobile Websites
deanohume
310
32k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
Transcript
WPFษڧձ ୈ5ճ ςϯϓϨʔτ
ࠓ֮͑ͯ΄͍͜͠ͱ ςϯϓϨʔτΛ࡞Βͳͯ͘ࡁΉͳΒશ ྗͰಀ͛Δ Ұ͔ΒControlTemplateΛ࡞Βͳ͍ʂ DataTemplateͱControlTemplate༻్ ͕ҧ͏
ςϯϓϨʔτͱ WPFͷControlTemplateϓϩύςΟΛ࣋ͬͯ ͍Δ طఆͷςϯϓϨʔτΛಠࣗʹσβΠϯͨ͠ς ϯϓϨʔτͱࠩ͠ସ͑Δͱɺ֎؍Λࣗ༝ʹม ͑ΒΕΔʂ ςϯϓϨʔτΛม͑ͯɺϚεॲཧͳͲ ͷجຊػೳมΘΒͳ͍
طଘͷςϯϓϨʔτΛݟ ͯΈΔ TemplateϓϩύςΟ͔Β ControlTemplateΛऔΓग़͢ [υΩϡϝϯτΞτϥΠϯ]͔ΒӈΫ ϦοΫ - [ςϯϓϨʔτͷฤू] - [ίϐʔ
ͯ͠ฤू]
͍ํ ControlTemplateΛXAMLͰఆٛͯ͠ɺ TemplateϓϩύςΟʹηοτ͢Ε֎؍ Λ͕ΒΓͱม͑ΒΕΔʂ ͍͍ͨͯStyleͱͯ͠ఆٛ͢Δ
ҙ ControlTemplateΛ࡞Γ࢝Ίͨ࣌Ͱɺطఆͷςϯ ϓϨʔτશʹͳ͘ͳΔ ݟۭͨʹͳΔ ϚεΦʔόʔ࣌ΫϦοΫ࣌ͷมԽͳͲ͢ ͯͳ͘ͳΔ Ұ࡞Γ࢝ΊͨΒɺҰ௨Γ࡞Γ͞ͳ͍ͱ͔͑ͬ ͯΈ͢΅Β͘͠ͳΔʂ
खΛ͚ͳ͍༐ؾඞཁ ຊʹςϯϓϨʔτΛ͍͡Βͳ͍ͱ͍ ͚ͳ͍ͷ͔ৼΓฦΖ͏ ςʔϚͷద༻ͰࡁΉͳΒͦΕͰࡁ·ͤΑ ͏
߹͍ݴ༿ ςϯϓϨʔτΛ͍͡ΔͳΒ࠷ޙ·Ͱ͋ ͖ΒΊͳ͍ʂ
ςʔϚͬͯʁ WPFඪ४Ͱ༻Ͱ͖ΔશͯͷControlʹରͯ͠ɺ౷ҰతͳσβΠϯΛ ࢪͨ͠Styleͷू߹ମʢϦιʔεʣ େશ෦ͷControlͷContentTemplateΛ͍͍ͬͯ͡Δ ੲςʔϚͱ͍͏ݴ͍ํͰϦιʔεσΟΫγϣφϦͷϑΝΠϧ͕ެ ։͞Ε͍͕ͯͨɺݱࡏͩͱ౷߹తͳݟͨʴศརͳಠࣗControl͕ ηοτʹͳͬͨҎԼͷΑ͏ͳϥΠϒϥϦΛΠϯετʔϧͯ͠͏͜ ͱ͕ଟ͍ɻ Material Design
in XAML Toolkit MahApps.Metro
͜ΕςϯϓϨʔτඞ ཁʁ̍ จࣈ৭Λม͍͑ͨ
͜ΕςϯϓϨʔτඞ ཁʁ̍ จࣈ৭Λม͍͑ͨ ͍Γ·ͤΜʂ <Button Content="Button" Foreground="#FFC70BDA"/>
ϓϩύςΟΛ͍͡Ε ͍͍ύλʔϯ ϓϩύςΟͷΛม͑ΕࡁΉ͜ͱͳ ΒͦΕͰOK MSDNΛಡΜͰϓϩύςΟΛ୳ͦ͏ʂ ͪΖΜStyleͰઃఆͯ͠Α͍
͜ΕςϯϓϨʔτඞ ཁʁ̎ ϘλϯͷதʹϘλϯ͕͋Δ
͜ΕςϯϓϨʔτඞ ཁʁ̎ ϘλϯͷதʹϘλϯ͕͋Δ ͍Γ·ͤΜʂ <Button> <Grid> <TextBlock TextWrapping="Wrap" Text="Button" FontSize="36"
HorizontalAlignment="Center"/> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> <Button Content="Button" Margin="3,12,3,0" VerticalAlignment="Center"/> <Button Content="Button" Margin="3,12,3,0" VerticalAlignment="Center"/> </StackPanel> </Grid> </Button>
ContentΛ͍͡Ε͍͍ ύλʔϯ ContentϓϩύςΟΛ͍࣋ͬͯΔͳΒɺ ࢠཁૉͱͯ͠ͲΜͳControlͰೖΕΒ ΕΔ Content୯Ұཁૉ͔͠ೖΕΒΕͳ͍ ͔Βɺ͍Ζ͍Ζஔ͍ͨ͠߹ύ ωϧʹ͘ΔΉ
͜ΕςϯϓϨʔτඞ ཁʁ̏ ListBoxͷߦΛΧελϚΠζ͍ͨ͠
͜ΕςϯϓϨʔτඞ ཁʁ̏ ListBoxͷߦΛΧελϚΠζ͍ͨ͠ ͍Γ·ͤΜʂ <ListBox Grid.Column="1"> <ListBox.ItemTemplate> <DataTemplate DataType="System:String"> <Grid>
<Border BorderThickness="8,2,2,2" BorderBrush="Red"> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding}"/> <ProgressBar Width="60" Value="45"/> </StackPanel> </Border> </Grid> </DataTemplate> </ListBox.ItemTemplate> <System:String>͢Ϳͨ</System:String> <System:String>ͪΌʔΜ</System:String> <System:String>ͬΆ͏͍͞</System:String> </ListBox>
DataTemplateΛ͍͑ ͍ύλʔϯ ίϨΫγϣϯΛදࣔ͢ΔControlͳΒɺද ࣔ͢ΔதDataTemplateͰม͑ΒΕΔ DataTemplateɺͱͱදࣔͷํ͕ ఆٛ͞Εͯͳ͍ͷΛఆٛ͢Δͷ ControlTemplateͱͱఆٛ͞Εͯ ͍ΔͷΛ͋͑ͯ࠶ఆٛ͢Δͷ
͜ΕςϯϓϨʔτඞ ཁʁ̐ ϚεΦʔόʔ࣌ͷݟͨͷมԽΛม͑ ͍ͨ
͜ΕςϯϓϨʔτඞ ཁʁ̐ ϚεΦʔόʔ࣌ͷݟͨͷมԽΛม͑ ͍ͨ ͨͿΜ͍Γ·͢ʂ
τϦΨʔΛม͍͑ͨύ λʔϯ StyleͰτϦΨʔΛ͢͜ͱͰ͖Δ ͕ɺطఆͷಈ࡞ΛόοςΟϯά͢ΔՄ ೳੑ͋Δ ςϯϓϨʔτΛ࡞ͬͨํ͕҆৺͔͠ Εͳ͍
͜ΕςϯϓϨʔτඞ ཁʁ̑ Ϙλϯ͕ପԁܗ νΣοΫϘλϯͷ࢛֯ͷதʹจࣈྻ ͜Ε·Ͱʹແ͍UIͷεΫϩʔϧόʔ
ͦͦͷ֎؍Λม͑ͨ ͍ύλʔϯ ͜Ε͏ςϯϓϨʔτͷग़൪ʂ
ςϯϓϨʔτͷ࡞Γํ ςϯϓϨʔτͷXAMLΛҰ͔ΒࣗͰॻ ͘ͷແཧʂ طఆͷςϯϓϨʔτɺςʔϚͷதʹ ͋ΔςϯϓϨʔτΛվ͠Α͏ʂ
ෳࡶͳςϯϓϨʔτ ͱͱෳࡶͳίϯτϩʔϧ ControlTemplateෳ߹ܕͰෳࡶ
͋ͱ…… MSDNΛཔΓʹ͕ΜΓ·͠ΐ͏ʂ