如何根据屏幕分辨率设置Tabitem

时间:2014-07-28 07:37:38

标签: wpf

我使用Prism 4.0在WPF中工作。以下是XAML代码。

XAML:

<UserControl x:Class="OMS.MyOrders.View.MyOrdersMain"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
         xmlns:heid="http://schemas.heidesoft.com/components"
        xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" 
    xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" 
    xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars" 
    xmlns:dxd="http://schemas.devexpress.com/winfx/2008/xaml/docking"
          xmlns:dxcore="http://schemas.devexpress.com/winfx/2008/xaml/core"
          xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" 
          xmlns:dxdo="clr-namespace:DevExpress.Xpf.Docking;assembly=DevExpress.Xpf.Docking.v13.2" 
           dx:ThemeManager.ThemeName="Office2007Blue"
           mc:Ignorable="d">

<ScrollViewer VerticalScrollBarVisibility="Auto">
    <Grid x:Name="MOMain">
        <Grid.RowDefinitions>
            <RowDefinition Height="1*" />
        </Grid.RowDefinitions>
        <dxd:DockLayoutManager Grid.Row="1" x:Name="dockManager" FlowDirection="LeftToRight" dxcore:ThemeManager.ThemeName="Office2007Blue">
            <dxd:LayoutGroup>
                <dxd:LayoutControlItem>
                    <TabControl x:Name="Tb_Main" Style="{DynamicResource OMSMainTabControl}" >
                        <TabItem Header="My Orders" Padding="8,0,8,0" x:Name="Part_Main" Style="{DynamicResource HeaderTabItem}" Foreground="{DynamicResource TabButtonForeground}" Background="{DynamicResource DefaultControlBackgroundBrush}">
                            <Grid>
                                <dx:DXTabControl>

                                    <dx:DXTabItem Header="Shipped Not Received" Name="pnlShippedNotReceived">
                                        <dxg:GridControl x:Name="grd_ShippedNotReceived" Height="600" CustomColumnDisplayText="grd_ShippedNotReceived_CustomData">
                                            <dxg:GridControl.Columns>
                                                <dxg:GridColumn FieldName="Name"  Header="Inter-Unit ID" ReadOnly="true" AutoFilterCondition="Contains" VisibleIndex="0">
                                                    <dxg:GridColumn.CellTemplate>
                                                        <DataTemplate>
                                                            <TextBlock>
                                                                        <Hyperlink  NavigateUri="{Binding Data.Hyperlink}" Click="ClickonHyperlink" TargetName="_blank">
                                                                            <TextBlock Text="{Binding Data.Name}"></TextBlock>
                                                                        </Hyperlink>
                                                                    </TextBlock>
                                                        </DataTemplate>
                                                    </dxg:GridColumn.CellTemplate>
                                                </dxg:GridColumn>

                                            </dxg:GridControl.Columns>
                                            <dxg:GridControl.View>
                                                <dxg:TableView ShowAutoFilterRow="True" x:Name="vwShippedNotReceived" AutoWidth="True" ShowGroupPanel="False">
                                                </dxg:TableView>
                                            </dxg:GridControl.View>
                                        </dxg:GridControl>
                                    </dx:DXTabItem>

                                    <dx:DXTabControl.View>
                                        <dx:TabControlScrollView HeaderOrientation="Horizontal" HeaderLocation="Bottom" />
                                    </dx:DXTabControl.View>
                                </dx:DXTabControl>
                            </Grid>
                        </TabItem>
                    </TabControl>
                </dxd:LayoutControlItem>
            </dxd:LayoutGroup>
        </dxd:DockLayoutManager>
    </Grid>
</ScrollViewer>

问题:

这里我面临一个与布局有关的问题。当我在不同的系统上使用我的应用程序时,当时使用不同的分辨率我正在拍摄不需要的滚动,就像你在快照中看到的那样。当我点击红线提到的外部滚动,然后点击超级链接时,需要两次点击才能完成超链接任务:

首先点击用于获得焦点和

第二次点击将触发超链接

enter image description here

1 个答案:

答案 0 :(得分:0)

删除周围的ScrollViewer,它不是必需的,因为选项卡的内容会在需要时显示滚动条。