我在SO上遇到过类似的问题,但还没有找到解决方案。 内部控件是一个表:
<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
是内在控制。我想要一个滚动条(首选的风格,但我很灵活),当我使桌子的区域太小或者当桌子有太多的行显示在当前区域时,它会出现。请帮忙。
答案 0 :(得分:0)
你能不能只使用ScrollViewer
?
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<%-- your content --%>
答案 1 :(得分:0)
事实证明,删除图表后,滚动条突然发挥作用。我想它与'重启VS'相同。