xaml-sdk/ChartView/WPF/DragToSelect/MainWindow.xaml

47 строки
2.5 KiB
XML

<Window x:Class="DragToSelect.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:local="clr-namespace:DragToSelect"
Title="MainWindow" Height="350" Width="525">
<FrameworkElement.Resources>
<Style x:Key="SelectionRectangleStyle1" TargetType="Rectangle">
<Setter Property="Fill" Value="#22AABBCC" />
<Setter Property="Stroke" Value="#DDAABBCC" />
<Setter Property="IsHitTestVisible" Value="False" />
</Style>
<Style x:Key="SelectionRectangleStyle2" TargetType="Border">
<Setter Property="Background" Value="#22AABBCC" />
<Setter Property="BorderBrush" Value="#DDAABBCC" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="2" />
<Setter Property="IsHitTestVisible" Value="False" />
</Style>
</FrameworkElement.Resources>
<Grid>
<telerik:RadCartesianChart x:Name="chart1" Palette="Flower"
SelectionPalette="FlowerSelected"
local:ChartUtilities.IsDragToSelectEnabled="True"
local:ChartUtilities.SelectionRectangleStyle="{StaticResource SelectionRectangleStyle1}">
<telerik:RadCartesianChart.HorizontalAxis>
<telerik:DateTimeContinuousAxis />
</telerik:RadCartesianChart.HorizontalAxis>
<telerik:RadCartesianChart.VerticalAxis>
<telerik:LinearAxis />
</telerik:RadCartesianChart.VerticalAxis>
<telerik:RadCartesianChart.Series>
<telerik:PointSeries CategoryBinding="XCat" ValueBinding="YVal" ItemsSource="{Binding}" />
</telerik:RadCartesianChart.Series>
<telerik:RadCartesianChart.Behaviors>
<telerik:ChartPanAndZoomBehavior x:Name="panZoomBehavior" />
</telerik:RadCartesianChart.Behaviors>
</telerik:RadCartesianChart>
<Border Background="White" BorderBrush="LightGray" BorderThickness="1" HorizontalAlignment="Right" VerticalAlignment="Top">
<StackPanel>
<RadioButton Content="drag-to-zoom" Checked="RadioButtonDragToZoom_Checked" />
<RadioButton Content="drag-to-select" Checked="RadioButtonDragToSelect_Checked" IsChecked="True" />
</StackPanel>
</Border>
</Grid>
</Window>