我是靠谱客的博主 爱笑流沙,最近开发中收集的这篇文章主要介绍右下角扩展区域也会执行MouseEnter事件,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述


            <Grid x:Name="gridMain" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Grid.RowDefinitions>
                    <RowDefinition Height="100"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="85"/>
                    <RowDefinition Height="5"/>
                </Grid.RowDefinitions>

                ......

                <!--菜单栏弹出区域-->
                <StackPanel x:Name="stkPnlShowFooter" Grid.Row="4" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Transparent" MouseEnter="stkPnlShowFooter_MouseEnter">
                    <!--右下角扩展的区域:500*50-->
                    <StackPanel Width="500" Height="50" Margin="0,-50,0,0" Background="Transparent" HorizontalAlignment="Right"/>
                </StackPanel>
            </Grid>

        /// <summary>
        /// 隐藏菜单栏
        /// </summary>
        private void userCtrlFooter_MouseLeave(object sender, MouseEventArgs e)
        {
            SetFooterHidden();
        }

        /// <summary>
        /// 隐藏底部一级菜单栏
        /// </summary>
        public void SetFooterHidden()
        {
            contentPercentage = 0.84;

            if (this.layoutPopup != null)
                this.layoutPopup.Height = (int)(this.Height * contentPercentage);//重置Layout高度

            gridMain.RowDefinitions[3].SetValue(RowDefinition.HeightProperty, new System.Windows.GridLength(0, GridUnitType.Pixel));

            userCtrlFooter.SetValue(Grid.RowSpanProperty, 1);//底部菜单栏
            userCtrlFooter.Visibility = Visibility.Collapsed;//底部菜单栏
            mainContent.SetValue(Grid.RowSpanProperty, 2);//内容展示区
            mainContent.Visibility = Visibility.Collapsed;//内容展示区
            mainContent.Visibility = Visibility.Visible;//内容展示区
            stkPnlShowFooter.Visibility = Visibility.Visible;//高度为5的底部弹出区域
        }

        /// <summary>
        /// 弹出菜单栏
        /// </summary>
        private void stkPnlShowFooter_MouseEnter(object sender, MouseEventArgs e)
        {
            contentPercentage = 0.76;

            if (this.layoutPopup != null)
                this.layoutPopup.Height = (int)(this.Height * contentPercentage);//重置Layout高度

            gridMain.RowDefinitions[3].SetValue(RowDefinition.HeightProperty, new System.Windows.GridLength(85, GridUnitType.Pixel));

            stkPnlShowFooter.Visibility = Visibility.Collapsed;//高度为5的底部弹出区域
            userCtrlFooter.SetValue(Grid.RowSpanProperty, 2);//底部菜单栏
            userCtrlFooter.Visibility = Visibility.Visible;//底部菜单栏
            mainContent.SetValue(Grid.RowSpanProperty, 1);//内容展示区
            mainContent.Visibility = Visibility.Collapsed;//内容展示区
            mainContent.Visibility = Visibility.Visible;//内容展示区
        }

 

最后

以上就是爱笑流沙为你收集整理的右下角扩展区域也会执行MouseEnter事件的全部内容,希望文章能够帮你解决右下角扩展区域也会执行MouseEnter事件所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(35)

评论列表共有 0 条评论

立即
投稿
返回
顶部