0

我在这里遇到过类似的问题,但还没有找到解决方案。内部控件是一个表:

<UserControl x:Class="Labster7.Application.Modules.MassiveExecution.Windows.ExperimentDetailsTableView"
             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" 
             mc:Ignorable="d" 
             MinHeight="150"
             d:DesignHeight="300" d:DesignWidth="300" 
             xmlns:igDP="http://infragistics.com/DataPresenter"
             xmlns:fw="clr-namespace:Labster7.Application.Framework;assembly=Labster7.Application.Framework"
             xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:igEditors="http://infragistics.com/Editors">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="..\Resources\Styles.xaml" />
                <ResourceDictionary>
                    <Style TargetType="ScrollViewer" BasedOn="{StaticResource CoolScrollViewerStyle}">
                        <Setter Property="HorizontalAlignment" Value="Stretch" />
                        <Setter Property="VerticalAlignment" Value="Stretch" />
                        <Setter Property="Visibility" Value="Visible"/>
                    </Style>
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <igDP:XamDataGrid DataSource="{Binding Path=TaskObjects, Mode=TwoWay}" MinHeight="100"
                          RecordsDeleting="DataPresenterBase_OnRecordsDeleting" 
                          RecordsDeleted="DataPresenterBase_OnRecordsDeleted" ScrollingMode="DeferredWithScrollTips">
            <igDP:XamDataGrid.Resources>
                <Style x:Key="CheckBoxedHeaderStyle" TargetType="{x:Type igDP:LabelPresenter}">
                    <Setter Property="ContentTemplate">
                        <Setter.Value>
                            <DataTemplate>
                                <CheckBox Name="HeaderCheckBox" Content="{Binding}" Click="OnClick" IsChecked="True" IsThreeState="False"/>
                            </DataTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
                <Style TargetType="igEditors:XamCheckEditor">
                    <EventSetter Event="ValueChanged" Handler="XamCheckEditorValueChanged"/>
                </Style>
            </igDP:XamDataGrid.Resources>
            <igDP:XamDataGrid.FieldLayouts>
                <igDP:FieldLayout>
                    <igDP:FieldLayout.Fields>
                        <igDP:Field Name="IsSelected" Label="Selected" IsSelected="{Binding AllSelected}">
                            <igDP:Field.Settings>
                                <igDP:FieldSettings AllowEdit="{Binding IsEditable}" 
                                                    EditAsType="{x:Type sys:Boolean}" 
                                                    EditorType="{x:Type igEditors:XamCheckEditor}" 
                                                    LabelPresenterStyle="{StaticResource CheckBoxedHeaderStyle}" />
                            </igDP:Field.Settings>
                        </igDP:Field>
                        <igDP:Field Name="ExperimentName" Label="Experiment Name">
                            <igDP:Field.Settings>
                                <igDP:FieldSettings AllowEdit="False" />
                            </igDP:Field.Settings>
                        </igDP:Field>
                        <igDP:Field Name="Machines" Label="Machines">
                            <igDP:Field.Settings>
                                <igDP:FieldSettings AllowEdit="False" />
                            </igDP:Field.Settings>
                        </igDP:Field>
                        <igDP:Field Name="Status" Label="Status">
                            <igDP:Field.Settings>
                                <igDP:FieldSettings AllowEdit="False" />
                            </igDP:Field.Settings>
                        </igDP:Field>
                        <igDP:Field Name="StartTime" Label="Start Time"
                                    Converter="{fw:DateTimeToStringConverter FormatString=0:hh:mm:ss}">
                            <igDP:Field.Settings>
                                <igDP:FieldSettings AllowEdit="False" EditAsType="{x:Type sys:String}"/>
                            </igDP:Field.Settings>
                        </igDP:Field>
                        <igDP:Field Name="EndTime" Label="End Time"
                                    Converter="{fw:DateTimeToStringConverter FormatString=0:hh:mm:ss}">
                            <igDP:Field.Settings>
                                <igDP:FieldSettings AllowEdit="False" EditAsType="{x:Type sys:String}"/>
                            </igDP:Field.Settings>
                        </igDP:Field>
                    </igDP:FieldLayout.Fields>
                </igDP:FieldLayout>
            </igDP:XamDataGrid.FieldLayouts>
            <igDP:XamDataGrid.FieldLayoutSettings>
                <igDP:FieldLayoutSettings SelectionTypeRecord="Single"/>
            </igDP:XamDataGrid.FieldLayoutSettings>
        </igDP:XamDataGrid>
    </Grid>
</UserControl>

CoolScroller是已经在应用中成功使用的样式,比较长,暂时不加代码。)

包含窗口是:

<UserControl x:Class="Labster7.Application.Modules.MassiveExecution.Windows.ActivityEditorView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:fw="clr-namespace:Labster7.Application.Framework;assembly=Labster7.Application.Framework"
             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:windows="clr-namespace:Labster7.Application.Modules.MassiveExecution.Windows" mc:Ignorable="d" d:DesignHeight="550"
             xmlns:igCa="http://infragistics.com/Chart">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="2"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0">
            <TextBox VerticalAlignment="Center" HorizontalAlignment="Center" Margin="10,10,10,10" Foreground="Red"  IsReadOnly="True"
                     Visibility="{Binding ShouldShowExperimentTable,Converter={fw:BoolToVisibilityConverter TrueValue=Hidden, FalseValue=Visible}}">
                Click 'Add test from DOE' to view the activity's experiments
            </TextBox>
            <DockPanel LastChildFill="True" Visibility="{Binding Path=ShouldShowExperimentTable, Converter={fw:BoolToVisibilityConverter TrueValue=Visible, FalseValue=Hidden}}">
                <!--<StackPanel DockPanel.Dock="Right" Orientation="Horizontal" MaxHeight="30" Margin="4">
                    <Label Content="Select all"/>
                    <igEditors:XamCheckEditor IsChecked="{Binding ExperimentDetailsTableViewModel.SelectAll}" IsThreeState="False" />
                </StackPanel>-->
                <windows:ExperimentDetailsTableView DockPanel.Dock="Top"
                                                    HorizontalAlignment="Stretch" 
                                                    Margin="3,3,3,3" 
                                                    VerticalAlignment="Stretch"
                                                    DataContext="{Binding Path=ExperimentDetailsTableViewModel}" />
            </DockPanel>
        </StackPanel>
        <GridSplitter Grid.Row="1" Background="SkyBlue" Height="2" HorizontalAlignment="Stretch" VerticalAlignment="Top"/>
        <Grid Grid.Row="2" HorizontalAlignment="Left" Width="Auto">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <StackPanel Grid.Row="1" Orientation="Horizontal" Grid.ColumnSpan="2">
                <!--<Label MinHeight="30" MinWidth="100" Content="{Binding Stopwatch.TimeElapsed}"/>-->
                <!--<ProgressBar MinHeight="30" Maximum="100" Minimum="0" 
                             Value="{Binding Progress, UpdateSourceTrigger=PropertyChanged}" 
                             Visibility="{Binding RelativeSource={RelativeSource Self}, Path=Value, Mode=OneWay, Converter={StaticResource conv}}"/>-->
            </StackPanel>
            <igCa:XamChart  Grid.Row="2" HorizontalContentAlignment="Left" HorizontalAlignment="Left" Visibility="{Binding Path=ShowExperimentsStatusData, 
                            Converter={fw:BoolToVisibilityConverter TrueValue=Visible, FalseValue=Hidden}}"
                            MaxHeight="300" Width="Auto" Grid.ColumnSpan="2">

            </igCa:XamChart>
        </Grid>

    </Grid>
</UserControl>

(我删除了图表系列,因为它是不相关的绑定。)
windows:ExperimentDetailsTableView是内部控件。我想要一个滚动条(首选样式,但我很灵活),当我将表格的区域设置得太小或表格有太多行无法在其当前区域显示时,它会出现。请帮忙。

4

2 回答 2

0

事实证明,删除图表后,滚动条突然起作用了。我想它与'restart VS'相同。

于 2013-02-28T07:45:00.197 回答
0

你不能只使用 aScrollViewer吗?

<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
    <%-- your content --%>
于 2013-02-03T07:33:25.270 回答