Architect's Log

I'm a Cloud Architect. I'm highly motivated to reduce toils with driving DevOps.

Canvasを使ってコントロールをフローティングする

アプリ実行


ソースコード

App.xaml
<Application x:Class="WpfApplication4.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
</Application>
MainWindow.xaml
<Window x:Class="WpfApplication4.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="100" Width="300">
    <StackPanel>
        <Button>ボタン1</Button>
        <Button>ボタン2</Button>
        <Canvas Background="Aqua" HorizontalAlignment="Center" VerticalAlignment="Center">
            <TextBox Canvas.Right="20"  Canvas.Bottom="10">
                Canvas内のTextBox
            </TextBox>
        </Canvas>
    </StackPanel>
</Window>