开发者

Lockable Surface in WPF

开发者 https://www.devze.com 2023-04-08 20:53 出处:网络
I want a custom Control in WPF which have a appearance similar to HTML, we use for showing Images in the centre of the s开发者_Python百科creen with the whole screen locked and only image is showing.

I want a custom Control in WPF which have a appearance similar to HTML, we use for showing Images in the centre of the s开发者_Python百科creen with the whole screen locked and only image is showing.

I dont want to show images, I want to show UserControls within this section.

Can someone give suggestions of this?


In your Window, put all your controls in a single Grid, with a Border control (that contains your image) as the last item in the Grid (which means it will display on top of the other items). Toggle its Visibility via binding or code. Adjust styles as required.

<Window>
    <Grid>

        <!-- window controls go here --->

        <Border Visibility="..." Background="#80000000"> <!-- EDITED -->

            <!-- overlaid image (and/or other controls) goes here --->
            <Image 
                Source="..." 
                Width="..."
                Height="..."
                HorizontalAlignment="Center" 
                VerticalAlignment="Center" />

        </Border>

    <Grid>
</Window>


In Windows applications this is generally achieved using a modal dialog, i.e. you create a normal WPF window and show it using ShowDialog.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号