我正在使用radcartesian chart绘制图表。图表位于堆栈面板内, 堆栈面板位于网格内。所有这些都在数据模板中。 问题是我的图表超出了面板区域。两个图表重叠。 我已经尝试将Maxheight属性设置为telerik:RadCartesianChart但仍然无效 我在xaml中的datatemplate如下。
<DataTemplate x:Key="DataGridRow">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="45"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="590"></ColumnDefinition>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="110"></ColumnDefinition>
</Grid.ColumnDefinitions>
<telerik:Label Name="Criteria" Margin="5" Background="White" Height="23" Width="100" Grid.Column="0" Content="{Binding CriteriaName, Mode=TwoWay}"/>
<TextBox Background="White" Name="txtLow" TextAlignment="Center" Height="23" Width="60" Margin="1.5" Grid.Column="1" KeyDown="SliderValues_KeyDown" Text="{Binding SelectionLow, Mode=TwoWay,Converter={StaticResource formatLowerValue}}">
<TextBox.InputBindings>
<KeyBinding Key="Enter" Command="{Binding DataContext.LowValueChangedCmd,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type telerik:RadWindow}}}" >
<KeyBinding.CommandParameter>
<MultiBinding Converter="{StaticResource MultiValueConverter}">
<Binding ElementName="radGridView" />
<Binding ElementName="txtLow" />
</MultiBinding>
</KeyBinding.CommandParameter>
</KeyBinding>
<KeyBinding Key="Tab" Command="{Binding DataContext.LowValueChangedCmd,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type telerik:RadWindow}}}" >
<KeyBinding.CommandParameter>
<MultiBinding Converter="{StaticResource MultiValueConverter}">
<Binding ElementName="radGridView" />
<Binding ElementName="txtLow" />
</MultiBinding>
</KeyBinding.CommandParameter>
</KeyBinding>
</TextBox.InputBindings>
<i:Interaction.Triggers>
<i:EventTrigger EventName="LostFocus">
<Commands:EventToCommand Command="{Binding DataContext.LowValueChangedCmd,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type telerik:RadWindow}}}" >
<Commands:EventToCommand.CommandParameter>
<MultiBinding Converter="{StaticResource MultiValueConverter}">
<Binding ElementName="radGridView" />
<Binding ElementName="txtLow" />
</MultiBinding>
</Commands:EventToCommand.CommandParameter>
</Commands:EventToCommand>
</i:EventTrigger>
<!--<i:EventTrigger EventName="KeyDown">
<i:InvokeCommandAction Command="{Binding DataContext.SliderValueKeyDownCmd, RelativeSource={RelativeSource AncestorType={x:Type telerik:RadWindow}, Mode=FindAncestor}}" CommandParameter="{Binding ElementName=txtLow}"/>
</i:EventTrigger>-->
</i:Interaction.Triggers>
</TextBox>
<StackPanel Grid.Column="2" Margin="7,-72,7.5,0">
<!--<Grid Grid.Column="2" >
<Grid.RowDefinitions>
<RowDefinition Height="20"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>-->
<telerik:RadCartesianChart Palette="Summer">
<telerik:RadCartesianChart.HorizontalAxis>
<telerik:CategoricalAxis Visibility="Hidden"/>
</telerik:RadCartesianChart.HorizontalAxis>
<telerik:RadCartesianChart.VerticalAxis>
<telerik:LinearAxis Visibility="Hidden" MajorStep="30"/><!--</telerik:LinearAxis>MajorStep="{Binding DataContext.MajorStepValue,Mode=TwoWay,RelativeSource={RelativeSource AncestorType={x:Type telerik:RadWindow}, Mode=FindAncestor}}"/>-->
</telerik:RadCartesianChart.VerticalAxis>
<telerik:RadCartesianChart.Series>
<telerik:BarSeries ItemsSource="{Binding KeyValue, Mode=TwoWay}" CategoryBinding="Key" ValueBinding="Value">
<telerik:BarSeries.PointTemplates>
<DataTemplate>
<Rectangle Width="3" Fill="#FF3276b1"/>
</DataTemplate>
</telerik:BarSeries.PointTemplates>
</telerik:BarSeries>
</telerik:RadCartesianChart.Series>
</telerik:RadCartesianChart>
</StackPanel>
<telerik:RadSlider Name="CriteriaSlider" Grid.Column="2" ToolTip="Movable" Minimum="{Binding LowValue,Mode=TwoWay}" Height="13" Margin="5" Maximum="{Binding HighValue,Mode=TwoWay}" SelectionEnd="{Binding SelectionHigh,Mode=TwoWay}" SelectionStart="{Binding SelectionLow,Mode=TwoWay}" TickPlacement="TopLeft" IsSelectionRangeEnabled="True" IsDirectionReversed="False" SmallChange="10" VerticalAlignment="Bottom" telerik:StyleManager.Theme="Windows8" >
<!--TickFrequency="{Binding TickFreq,Mode=TwoWay}"-->
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<Commands:EventToCommand Command="{Binding DataContext.SliderSelectionChangedCmd,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type telerik:RadWindow}}}" >
<Commands:EventToCommand.CommandParameter>
<MultiBinding Converter="{StaticResource MultiValueConverter}">
<Binding ElementName="radGridView" />
<Binding ElementName="CriteriaSlider" />
</MultiBinding>
</Commands:EventToCommand.CommandParameter>
</Commands:EventToCommand>
</i:EventTrigger>
</i:Interaction.Triggers>
<telerik:RadSlider.TickTemplate>
<DataTemplate>
<Grid>
<!--<TextBlock Text="{Binding}" FontSize="7" Foreground="Transparent"/>
<Label Content="{Binding DrawHistoragm}"/>-->
</Grid>
</DataTemplate>
</telerik:RadSlider.TickTemplate>
</telerik:RadSlider>
<!--</Grid>-->
<!--<telerik:Label Background="White" Height="23" HorizontalContentAlignment="Center" Width="70" Grid.Column="3" Content="{Binding SelectionHigh, Mode=TwoWay,Converter={StaticResource formatCell}}"/>-->
<TextBox Background="White" TextAlignment="Center" Name="txtHigh" Height="23" Width="60" Margin="3" Grid.Column="3" KeyDown="SliderValues_KeyDown" Text="{Binding SelectionHigh, Mode=TwoWay,Converter={StaticResource formatCell}}">
<TextBox.InputBindings>
<KeyBinding Key="Enter" Command="{Binding DataContext.HighValueChangedCmd,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type telerik:RadWindow}}}" >
<KeyBinding.CommandParameter>
<MultiBinding Converter="{StaticResource MultiValueConverter}">
<Binding ElementName="radGridView" />
<Binding ElementName="txtHigh" />
</MultiBinding>
</KeyBinding.CommandParameter>
</KeyBinding>
<KeyBinding Key="Tab" Command="{Binding DataContext.HighValueChangedCmd,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type telerik:RadWindow}}}" >
<KeyBinding.CommandParameter>
<MultiBinding Converter="{StaticResource MultiValueConverter}">
<Binding ElementName="radGridView" />
<Binding ElementName="txtHigh" />
</MultiBinding>
</KeyBinding.CommandParameter>
</KeyBinding>
</TextBox.InputBindings>
<i:Interaction.Triggers>
<i:EventTrigger EventName="LostFocus">
<Commands:EventToCommand Command="{Binding DataContext.HighValueChangedCmd,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type telerik:RadWindow}}}" >
<Commands:EventToCommand.CommandParameter>
<MultiBinding Converter="{StaticResource MultiValueConverter}">
<Binding ElementName="radGridView" />
<Binding ElementName="txtHigh" />
</MultiBinding>
</Commands:EventToCommand.CommandParameter>
</Commands:EventToCommand>
</i:EventTrigger>
</i:Interaction.Triggers>
</TextBox>
<telerik:RadButton HorizontalAlignment="Center" Grid.Column="4" Height="Auto" Width="70" MinHeight="20" MinWidth="25" MaxHeight="30" MaxWidth="30" telerik:StyleManager.Theme="Summer"
Style="{StaticResource WhiteImageButton}" Command="{Binding DataContext.DeleteItem,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type telerik:RadWindow}}}" >
<telerik:RadButton.CommandParameter>
<MultiBinding Converter="{StaticResource MultiValueConverter}">
<Binding ElementName="radGridView" />
<Binding ElementName="Criteria" />
</MultiBinding>
</telerik:RadButton.CommandParameter>
</telerik:RadButton>
</Grid>