2012年2月7日火曜日

UniformGrid コントロール

行列表示。コントロールを記述した順に配置する。
<Window x:Class="WpfApplication3.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="280" Width="300">
    <UniformGrid Columns="7" Rows="5" FirstColumn="3" FlowDirection="LeftToRight" >
        <UniformGrid.Resources>
            <Style TargetType="Label">
                <Setter Property="BorderBrush" Value="Black"/>
                <Setter Property="BorderThickness" Value=".1"/>
            </Style>
        </UniformGrid.Resources>
        <Label>1</Label><Label>2</Label><Label>3</Label>
        <Label>4</Label><Label>5</Label><Label>6</Label>
        <Label>7</Label><Label>8</Label><Label>9</Label>
        <Label>10</Label><Label>11</Label><Label>12</Label>
        <Label>13</Label><Label>14</Label><Label>15</Label>
        <Label>16</Label><Label>17</Label><Label>18</Label>
        <Label>19</Label><Label>20</Label><Label>21</Label>
        <Label>22</Label><Label>23</Label><Label>24</Label>
        <Label>25</Label><Label>26</Label><Label>27</Label>
        <Label>28</Label><Label>29</Label>
    </UniformGrid>
</Window>
Columnsで列数。Rowsで行数を設定。
FirstColumnで値を設定するカラムインデックスを設定。
FlowDirectionでコントロールを当てはめていく方向を設定。

0 件のコメント:

コメントを投稿