or
I have two gridviews that are bound to the same QueryableCollectionView. I need the selected items of the two gridviews to be the same at all times.
There seem to be some built-in funtionalty like this. If a select a row in GridView1 the same row will be selected in GridView2. But if I select multiple rows in GridView1, only the first selected of those rows will be selected in GridView2.
How can I
sync the selection between the gridviews?
I used to have the gridviews bound to the same RadObservableCollection. Then I synced the selection manually on the SelectionChanged-event on GridView1 like this:
private void GridView1_SelectionChanged(object sender, SelectionChangeEventArgs e){ GridView2.SelectedItems.Clear(); foreach (var item in GridView1.SelectedItems) { GridView2.SelectedItems.Add(item); }}Picture without setting a special background colorPicture with setting a special background color <UserControl.Resources> <Style x:Key="XTitleStyle" TargetType="{x:Type telerik:AxisTitle}"> <Setter Property="Margin" Value="0,-32,1,0"/> <Setter Property="HorizontalAlignment" Value="Right"/> <Setter Property="Panel.ZIndex" Value="10"/> </Style> <Style x:Key="Y1TitleStyle" TargetType="{x:Type telerik:AxisTitle}"> <Setter Property="VerticalAlignment" Value="Top"/> <Setter Property="RenderTransform"> <Setter.Value> <TransformGroup> <TranslateTransform X="-5" Y="-80"/> <RotateTransform Angle="90"/> </TransformGroup> </Setter.Value> </Setter> </Style> <Style TargetType="{x:Type telerik:MarkedZone}"> <Setter Property="Panel.ZIndex" Value="-1"/> </Style></UserControl.Resources><Grid Width="Auto" Height="Auto"> <telerik:RadChart HorizontalAlignment="Stretch" Margin="10,5,10,5" Name="radChart1" VerticalAlignment="Stretch" BorderThickness="0" Background="{DynamicResource backgroundTabControl}"> <telerik:RadChart.SeriesMappings> <telerik:SeriesMapping ItemsSource="{Binding Series1, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" > <telerik:SeriesMapping.SeriesDefinition> <telerik:LineSeriesDefinition ShowItemLabels="False" ShowPointMarks="False"> <telerik:LineSeriesDefinition.Appearance> <telerik:SeriesAppearanceSettings StrokeThickness="1.5"/> </telerik:LineSeriesDefinition.Appearance> </telerik:LineSeriesDefinition> </telerik:SeriesMapping.SeriesDefinition> <telerik:SeriesMapping.ItemMappings> <telerik:ItemMapping FieldName="Y" DataPointMember="YValue"/> </telerik:SeriesMapping.ItemMappings> </telerik:SeriesMapping> </telerik:RadChart.SeriesMappings> <telerik:RadChart.DefaultView> <telerik:ChartDefaultView ChartLegend="{x:Null}"> <telerik:ChartDefaultView.ChartArea> <telerik:ChartArea EnableAnimations="False" EnableStripLinesAnimation="False" SnapsToDevicePixels="True"> <!-- Here I'm setting the Background with PlotAreaStyle--> <telerik:ChartArea.PlotAreaStyle> <Style TargetType="{x:Type telerik:ClipPanel}"> <Setter Property="Background" Value="White"/> <Setter Property="Panel.ZIndex" Value="-1"/> </Style> </telerik:ChartArea.PlotAreaStyle> <!-- Here I'm setting the Background with a MarkedZone--> <telerik:ChartArea.Annotations> <telerik:MarkedZone Background="White" /> </telerik:ChartArea.Annotations> <telerik:ChartArea.AxisX> <telerik:AxisX AutoRange="False" MajorGridLinesVisibility="Visible" MajorTicksVisibility="Visible" Title="test"> <telerik:AxisX.AxisStyles> <telerik:AxisStyles TitleStyle="{StaticResource XTitleStyle}" /> </telerik:AxisX.AxisStyles> </telerik:AxisX> </telerik:ChartArea.AxisX> <telerik:ChartArea.AxisY> <telerik:AxisY AutoRange="False" MajorGridLinesVisibility="Visible" MinorGridLinesVisibility="Collapsed" Title="test" PlotAreaAxisVisibility="Visible" StripLinesVisibility="Collapsed"> <telerik:AxisY.AxisStyles> <telerik:AxisStyles TitleStyle="{StaticResource Y1TitleStyle}"/> </telerik:AxisY.AxisStyles> </telerik:AxisY> </telerik:ChartArea.AxisY> </telerik:ChartArea> </telerik:ChartDefaultView.ChartArea> </telerik:ChartDefaultView> </telerik:RadChart.DefaultView> </telerik:RadChart></Grid>
public static void PrintPreview(GridViewDataControl source, bool modal) { var window = new Window { Title = "Print Preview" }; var dialog = new PrintDialog(); var document = source.ToPrintFriendly().ToFixedDocument(dialog); var documentViewer = new DocumentViewer { Document = document }; window.Content = documentViewer; if (modal) window.ShowDialog(); else window.Show(); }