【WPF】ウィンドウ枠を非表示にする
親ウィンドウから、子ウィンドウ(枠線なし)をポップアップでメッセージなどを表示する…ようなものを作りたくて、いろいろ考え…。。
はじめはコントロールでやろうかと思ったけど、ウィンドウを完全に枠無しにできるようなので子ウィンドウを表示する方法に変更。
枠線だけは残ると思っていたけど、背景まで完全に見えなくできるのね。
目標
ウィンドウ枠を非表示にする
コントロールのみが表示されるようにする
コード作成
<Window x:Class="WinDllText.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:WindowBorderNone" mc:Ignorable="d" WindowStyle="None" AllowsTransparency="True" Background="Transparent" Title="LimitOutWindow" Height="450" Width="800"> <Grid> <Button Height="50" Width="100">ぼたん</Button> </Grid> </Window>
WidnowStyleをNoneにすることでタイトルバーを非表示。
AllowsTransparencyをTrueにすることで枠線を非表示?(WidnowStyle=”None”にしないといけない)
BackgroundをTransparentにすることで背景色を透明に。