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勉強会 第4回 スタイルの初歩/WPFStudy4
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
hachiilcane
March 01, 2022
Programming
150
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
WPF勉強会 第4回 スタイルの初歩/WPFStudy4
WPF勉強会 第4回 スタイルの初歩
説明後に実演するライブコーディングのコードはこちら。
https://github.com/hachiilcane/WpfStudy
hachiilcane
March 01, 2022
Transcript
11 slides
WPFษڧձ ୈ̐ճ ελΠϧͷॳา
ࠓ֮͑ͯ΄͍͜͠ͱ ελΠϧͱCSSͷΑ͏ͳͷͰ͋Δ ఆٛͷॴͰద༻ൣғ͕ܾ·Δ x:Key͕͔͔͘ͳ͍͔Ͱશવҧ͏ ελΠϧʹλʔήοτ͕ඞਢʂ
ελΠϧͱ ͍͔ͭ͘ͷϓϩύςΟΛ·ͱΊͨͷ ݸผʹɺશମʹɺෳͷཁૉʹద༻͢ ΔͨΊͷศརͳํ๏ ͭ·ΓCSSతͳͷͰ͢
CSSͱࣅ͍ͯΔͱ͜Ζ ఆٛ͢ΔॴͰద༻ൣғ͕มΘΔ ผϑΝΠϧʢϦιʔεσΟΫγϣφϦʣ> Application > Window > Page > ύωϧʢGridͱ͔ʣ
> 1ͭͷ ίϯτϩʔϧ > Template ఆ͕͔ٛͿͬͨ߹࠷ޙʹએݴͨ͠΄͏͕উͭ ݟͨͱϩδοΫΛͰ͖Δ XAML͚ͩͰݟͨΛࣗ༝ʹม͑ΒΕΔ
StyleͰઃఆͰ͖Δͷ ϓϩύςΟ എܠ৭ͱ͔ɺઢͷଠ͞ͱ͔ TemplateϓϩύςΟʹControlTemplateΛηοτ͢Δ͜ͱͰ͖Δ طଘͷίϯτϩʔϧͷࢹ֮తߏɾಈ࡞Λ࠶ఆٛͰ͖Δຐվ ࣍ճѻ͍·͢ TriggerʢϓϩύςΟτϦΨʔʣ ͜ͷϓϩύςΟ͕͜ΕʹͳͬͨΒ͜ͷϓϩύςΟΛ͜ͷʹ͢Δ EventTrigger MouseEnterΠϕϯτ͕ൃੜͨ͠Β0.2ඵ͔͚ͯOpacityΛ0.8ʹ͢Δͱ͔
؆୯ͳྫ ඞͣTargetType͕ඞཁ C#͔ͩΒܕݫີͳͷͰ͢ <Page.Resources> <Style TargetType="Button"> <Setter Property="Background" Value="AliceBlue"/> <Setter
Property="FontSize" Value="14"/> </Style> </Page.Resources> <Grid> <UniformGrid> <Button Content="Button1"/> <Button Content="Button2"/> <Button Content="Button3"/> </UniformGrid> </Grid>
x:Keyଐੑॏཁʂ x:Keyଐੑ͕ແ͍ͱɺTargetTypeͰࢦఆͨ͠ܕશ෦ʹద༻ x:Keyଐੑ͕͋ΔͱɺͦͷΩʔΛࢦఆͨ͠ͷ͚͕ͩద ༻ <Page.Resources> <Style x:Key="BlueButtonStyle" TargetType="Button"> <Setter Property="Background"
Value="AliceBlue"/> <Setter Property="FontSize" Value="14"/> </Style> </Page.Resources> <Grid> <UniformGrid> <Button Content="Button1"/> <Button Content="Button2" Style="{StaticResource BlueButtonStyle}"/> <Button Content="Button3"/> </UniformGrid> </Grid>
BasedOnͰܧঝͰ͖·͢ ผͷελΠϧΛج ʹɺελΠϧͷՃ ͕Ͱ͖Δ <Page.Resources> <Style TargetType="Button"> <Setter Property="Background" Value="AliceBlue"/>
<Setter Property="FontSize" Value="14"/> </Style> <Style x:Key="AmazingButtonStyle" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}"> <Setter Property="RenderTransform"> <Setter.Value> <RotateTransform Angle="10"/> </Setter.Value> </Setter> </Style> </Page.Resources> <Grid> <UniformGrid> <Button Content="Button1"/> <Button Content="Button2" Style="{StaticResource AmazingButtonStyle}"/> <Button Content="Button3"/> </UniformGrid> </Grid>
ελΠϧͱ࠶ར༻Λ తͱͨ͠ͷ XAMLϦιʔεͱ͍͏֓೦Ͱཧ ϦιʔεʹελΠϧʴϒϥγ ϦιʔεσΟΫγϣφϦͱ͍͏ผϑΝΠ ϧʹ͢ΔͱɺΞϓϦέʔγϣϯؒͰڞ ༗Ͱ͖Δ
ϒϥγϦιʔεʹ͠ͱ ͘ͱศར ͍ճ͕͠Ͱ͖ΔͷͰɺޙͰશମͷ৭ຯΛม ͍͑͢ Πϯελϯε͕1ݸͰࡁΉ <Page.Resources> <SolidColorBrush x:Key="ButtonBackColor" Color="AliceBlue"/> <Style
TargetType="{x:Type Button}"> <Setter Property="Background" Value="{StaticResource ButtonBackColor}"/> <Setter Property="FontSize" Value="14"/> </Style> </Page.Resources>
͔͠͠ͳΜ͔ͩΜͩݴͬ ͯ…… ελΠϧͷϝΠϯContentTemplate ࣍ճ͕ΜΓ·͠ΐ͏ʂ
More Decks by hachiilcane
See All by hachiilcane
機械学習勉強会01 1次関数での回帰分析/MLStudy01
hachiilcane
0
69
機械学習勉強会02 多項式近似と最小二乗法による推定/MLStudy02
hachiilcane
0
130
機械学習勉強会03 最急降下法/MLStudy03
hachiilcane
0
42
機械学習勉強会04 偏微分と連鎖律/MLStudy04
hachiilcane
0
48
機械学習勉強会05 パーセプトロン/MLStudy05
hachiilcane
0
48
機械学習勉強会06 ロジスティック回帰/MLStudy06
hachiilcane
0
62
機械学習勉強会07 ROC曲線/MLStudy07
hachiilcane
0
47
機械学習勉強会08 2次元入力3クラス分類/MLStudy08
hachiilcane
0
79
機械学習勉強会09 2層フィードフォワードニューラルネット/MLStudy09
hachiilcane
0
77
Other Decks in Programming
See All in Programming
作れるエンジニアから、価値を届けるエンジニアへ
ryunakayama
1
780
RaspberryPi 5で軽くはじめるk3sとtailscaleを用いたホームサーバー構築 (1)
nasum
0
430
SODA - FACT BOOK(JP)
sodainc
1
40k
AWS CDKを理解するために公式の定義を深掘って解説してみる / Understanding AWS CDK by Digging into Its Official Definition
akihisaikeda
3
330
protojson における文字化けの扱い
kazuki1023
0
460
JavaScriptはシングルバイナリの夢を見るか / Does JavaScript Dream of a Single Binary?
ssssota
0
130
Growing PicoRuby's Ecosystem on ESP32
yuuu
2
150
AppFunctionsの内部実装を紐解く
hiroaki404
0
120
例外からRich Errorsまで Kotlinエラーハンドリングの進化を読み解く
shiita0903
0
240
はじめてのKubernetesコントリビューション
nasa9084
0
320
地方こそサーバーレス — 10年続けた、顔が見えるチームで確かな基盤を / Serverless Matters Most in Regional Areas — 10 Years of Building Reliable Foundations with Close-Knit Teams
seike460
PRO
2
510
疎結合とは何か?ソフトウェア設計における結合バランスについて考える #phpcon_niigata
kajitack
2
420
Featured
See All Featured
How to Think Like a Performance Engineer
csswizardry
28
2.9k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
580
The browser strikes back
jonoalderson
0
2k
Designing for Timeless Needs
cassininazir
1
570
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1.1k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
7.1k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Building Better People: How to give real-time feedback that sticks.
wjessup
371
20k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
360
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
620
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
820
How to Talk to Developers About Accessibility
jct
2
630