不能在全屏wpf上使用tabitems

时间:2016-04-04 08:48:12

标签: c# wpf

所以我有一个问题,我不能在全屏使用我的tabitems但有时我可以通过随机点击屏幕打开标签,并且表格覆盖任务栏

用于tabcontrol和窗口和控件的XAML

    <<Window 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:omini_dækberegner"
    xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
    xmlns:Obselete="clr-namespace:Xceed.Wpf.Toolkit.Obselete;assembly=Xceed.Wpf.Toolkit" x:Class="Omini_Tires_And_rims.MainWindow"
    mc:Ignorable="d"
    Title="omini_dækberegner" Height="903.43" Width="1175.414" WindowStartupLocation="CenterScreen" AllowsTransparency="True" WindowStyle="None" ResizeMode="NoResize" Loaded="Window_Loaded" HorizontalAlignment="Left" VerticalAlignment="Top" SizeToContent="WidthAndHeight">
<Window.Resources>   



       <Button x:Name="Maximize" Click="Maximize_Click" Background="Transparent" BorderBrush="Transparent" Foreground="Transparent" IsTabStop="False" HorizontalAlignment="Right" VerticalAlignment="Top" Height="40" Width="39" Margin="0,18,67,0" HorizontalContentAlignment="Left" VerticalContentAlignment="Top" FontSize="18.667">
        <Image>
            <Image.Style>
                <Style TargetType="{x:Type Image}">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding WindowState, RelativeSource={RelativeSource AncestorType={x:Type Window}, Mode=FindAncestor}}" Value="Normal">
                            <Setter Property="Source" Value="img\maximize_window-.png"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding WindowState, RelativeSource={RelativeSource AncestorType={x:Type Window}, Mode=FindAncestor}}" Value="Maximized">
                            <Setter Property="Source" Value="img\restore-window-icon-61212.png"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Image.Style>
        </Image>
    </Button>

  <TabControl x:Name="tabControl" Margin="-2,70,0,-76" Background="#FF494949" BorderBrush="#FF494949" Foreground="#FF494949" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">

     <TabItem Header="Dækberegner"  Background="#FF303030" Foreground="#FFEAEAEA" BorderBrush="#FF303030" Margin="0,0,-21,0" FontSize="16" VerticalAlignment="Bottom">



  <TabItem BorderBrush="#FF303030" Background="#FF303030" Foreground="#FFEAEAEA" FontSize="16" Header="Betegnelser" Margin="22,0,-22,0" VerticalAlignment="Bottom">
            <Grid Margin="10,0,-10,42" Background="#FF494949">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <ListView x:Name="betegnelser_list" Margin="206,47,187,150" Background="#FF303030" BorderBrush="#FF303030" Foreground="#FF00B408" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" HorizontalAlignment="Center">
                    <ListView.View>
                        <GridView>
                            <GridView.ColumnHeaderContainerStyle>
                                <Style TargetType="{x:Type GridViewColumnHeader}">

                                    <Setter Property="Background" Value="Black" />
                                    <Setter Property="Foreground" Value="#FFEAEAEA                                                 " />
                                    <Setter Property="FontWeight" Value="Bold" />
                                </Style>
                            </GridView.ColumnHeaderContainerStyle>
                            <GridViewColumn Header="Betegnelse"
                                DisplayMemberBinding="{Binding betegnelse}"
                                Width="400"/>

                            <GridViewColumn Header="Betydning"
                                DisplayMemberBinding="{Binding betydning}"
                                Width="400"/>

                        </GridView>
                    </ListView.View>
                </ListView>
            </Grid>
        </TabItem>

C#代码

        private void Maximize_Click(object sender, RoutedEventArgs e)
    {
        if (this.WindowState == System.Windows.WindowState.Normal)
        {
            this.WindowState = System.Windows.WindowState.Maximized;
        }
        else
        {
            this.WindowState = System.Windows.WindowState.Normal;
        }
    }

video

0 个答案:

没有答案