XAML Button XAML Button Namebtn A Content Width
XAMLを見てみよう • どちらも同じものです。(Button) XAML <Button Name=“btn. A” Content=“ボタン” Width=“ 200” Height=“ 25” /> C# Button btn. A = new Button(); btn. A. Content = "Click!"; btn. A. Width = 200; btn. A. Height = 25; this. Content = btn. A; 簡単になりましたよね? わんくま同盟 福岡勉強会 #4
Grid • Grid内に子要素を配置する • 何行、何列を指定する (Row. Definitions , Column. Definitions) サンプルソース(2行1列) <Grid> <Grid. Row. Definitions> <Row. Definition Height="*"/> <Row. Definition Height="2*"/> </Grid. Row. Definitions> <Button Width="200" Height="25" Content="Click" Grid. Row="1“ /> </Grid> わんくま同盟 福岡勉強会 #4
コントロール ほんの一部だけご紹介 • Button • Text. Box, Text. Block, Label, Password. Box Rick. Text. Box • Radio. Button, Check. Box, Combo. Box List. Box • Expander, Tree. View • Menu, Task. Bar わんくま同盟 福岡勉強会 #4
リソース(Resources)-2 サンプルソース <Window x: Class="Wpf. Application 1. Window 1" xmlns="http: //schemas. microsoft. com/winfx/2006/xaml/presentation" xmlns: x="http: //schemas. microsoft. com/winfx/2006/xaml" Title="Demo"> <Window. Resources> <Solid. Color. Brush x: Key="blue. Brush" Color="Blue"/> </Window. Resources> <Stack. Panel> <Label Content="ラベル~" Foreground="Blue"/> <Label Content="ラベル~" Foreground="{Static. Resource blue. Brush}"/> <Button Content="ボタン~" Foreground="{Static. Resource blue. Brush}"/> </Stack. Panel> </Window> わんくま同盟 福岡勉強会 #4
xmlns="http: //schemas. microsoft. com/winfx/2006/xaml/presentation" <Window x: Class="Wpf. Application 1. Window 1" xmlns: x="http: //schemas. microsoft. com/winfx/2006/xaml" xmlns="http: //schemas. microsoft. com/winfx/2006/xaml/presentation" Title="Demo" Width="600" Height="250"> xmlns: x="http: //schemas. microsoft. com/winfx/2006/xaml" <Stack. Panel>Width="600" Height="250"> Title="Demo" <Text. Block Margin="30" Horizontal. Alignment="Center" Font. Size="30"> <Window. Resources> <Text. Block. Foreground> <Style Target. Type="Text. Block"> <Linear. Gradient. Brush Start. Point="0, 0" End. Point="0, 2"> <Setter Property="Horizontal. Alignment" Value="Center"/> <Linear. Gradient. Brush. Gradient. Stops> <Setter Property="Foreground"> <Gradient. Stop Offset="0. 0" Color="Orange"/> <Setter. Value> <Gradient. Stop Offset="2. 0" Color="Yellow"/> <Linear. Gradient. Brush Start. Point="0, 0" End. Point="0, 2"> </Linear. Gradient. Brush. Gradient. Stops> </Linear. Gradient. Brush> <Gradient. Stop Offset="0. 0" Color="Orange"/> </Text. Block. Foreground> <Gradient. Stop Offset="2. 0" Color="Red"/> スタイルはどうでしょ? </Linear. Gradient. Brush. Gradient. Stops> </Text. Block> </Linear. Gradient. Brush> <Text. Block Margin="30" Horizontal. Alignment="Center" Font. Size="40"> </Setter. Value> <Text. Block. Foreground> </Setter> <Linear. Gradient. Brush Start. Point="0, 0" End. Point="0, 2"> </Style> <Linear. Gradient. Brush. Gradient. Stops> </Window. Resources> <Gradient. Stop Offset="0. 0" Color="Orange"/> <Stack. Panel> <Gradient. Stop Offset="2. 0" Color="Yellow"/> <Text. Block Margin="30" Font. Size="30"> </Linear. Gradient. Brush. Gradient. Stops> スタイルはどうでしょ? </Linear. Gradient. Brush> </Text. Block. Foreground> <Text. Block Margin="30" Font. Size="40"> スタイルはどうでしょ? </Text. Block> </Stack. Panel> </Window> スタイル(Style)ー2 わんくま同盟 福岡勉強会 #4
- Slides: 20