Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
90
XamZoomBar in TabItems changes in all TabViews when zoomed in one tabView
posted

Hi,

I have a user control which includes XamDataChart with horizontal and vertical XamZoomBars.

This user control is appearing in 2 tabViews with different dataValues. When I change the zoom setting in tabItem1, it is also reflected in TabItem2 and vice versa. 

I need to changes zoom settings individually. How can I achieve this behavior? Any thoughts?

This is the code snippet for adding XamZoombars.

<ig:XamZoombar x:Name="XamZoombarVertical" Orientation="Vertical"
Margin="5,0,0,5"
Grid.Column="1"
Grid.RowSpan="2"
Grid.Row="0"
Range="{Binding ElementName=ChartMemoryData, Path=VerticalZoombar.Range, Mode=TwoWay}"/>

<ig:XamZoombar x:Name="XamZoombar"
Margin="0,2,0,5"
Grid.Row="3"
ZoomChanged="XamZoombar_OnZoomChanged"
Range="{Binding ElementName=ChartMemoryData, Path=HorizontalZoombar.Range, Mode=TwoWay}"/>

Parents Reply
  • 90
    Offline posted in reply to Michael Peterson

    Hello,

    I am still not able to upload the project. I will copy the code for your reference.

    Project Name : TestProjectZoomBarInTabViews

    MainWindow.xaml


    <Window x:Class="TestProjectZoomBarInTabViews.MainWindow"
            xmlns="
    ">schemas.microsoft.com/.../presentation"
            xmlns:x="">schemas.microsoft.com/.../xaml"
            xmlns:d="">schemas.microsoft.com/.../2008"
            xmlns:mc="">schemas.openxmlformats.org/.../2006"
            xmlns:local="clr-namespace:TestProjectZoomBarInTabViews"
            mc:Ignorable="d"
            Title="MainWindow" Height="350" Width="525">
    <Window.DataContext>
    <local:MainWindowViewModel/>
             </Window.DataContext>
    <Grid>
    <DockPanel>
            <TabControl ItemsSource = "{Binding Path=ViewModels}"
                                 SelectedIndex ="0">
                       <TabControl.ItemTemplate>
                                 <!-- this is the header template-->
                                 <DataTemplate>
                                            <WrapPanel Orientation="Horizontal" >
                                                       <TextBlock Text="{Binding Name}"/>
                                            </WrapPanel>
                                 </DataTemplate>
                       </TabControl.ItemTemplate>
                       <TabControl.ContentTemplate>
                                  <!-- this is the body of the TabItem template-->
                                  <DataTemplate>
                                          <local:UserControlView/>
                                  </DataTemplate>
                        </TabControl.ContentTemplate>
               </TabControl>
           </DockPanel>
       </Grid>
    </Window>


    MainWindowViewModel.cs

    using System.Collections.ObjectModel;

    namespace TestProjectZoomBarInTabViews
    {
    public class MainWindowViewModel
    {
    private Collection <ViewModel> m_ViewModels = new Collection <ViewModel> ();

    public Collection <ViewModel> ViewModels => m_ViewModels;

    public MainWindowViewModel ()
    {
    var viewModel1 = new ViewModel ("Name1");
    m_ViewModels.Add(viewModel1);
    var viewModel2 = new ViewModel("Name2");
    m_ViewModels.Add(viewModel2);
    }
    }

    public class ViewModel
    {
    public ViewModel(string name)
    {
    this.Name = name;
    }

    public string Name
    {
    get;set;
    }
    }
    }


    UserControlView.xaml

    <UserControl x:Class="TestProjectZoomBarInTabViews.UserControlView"
    xmlns="">schemas.microsoft.com/.../presentation"
    xmlns:x="">schemas.microsoft.com/.../xaml"
    xmlns:mc="">schemas.openxmlformats.org/.../2006"
    xmlns:d="">schemas.microsoft.com/.../2008"
    xmlns:local="clr-namespace:TestProjectZoomBarInTabViews"
    mc:Ignorable="d"
    xmlns:ig="">schemas.infragistics.com/xaml"
    d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
    <ig:XamDataChart x:Name="ChartMemoryData"
    Grid.Row="0"
    Grid.Column="0"
    MinHeight="200"
    VerticalZoombarVisibility="Visible"
    IsVerticalZoomEnabled="True">
    <ig:SyncManager.SyncSettings>
    <ig:SyncSettings SyncChannel="syncGroup1"
    SynchronizeHorizontally="True"
    SynchronizeVertically="True" />
    </ig:SyncManager.SyncSettings>
    <ig:XamDataChart.Axes>
    <ig:CategoryXAxis Name="XAxisData1"
    MinorStrokeThickness="0"
    MajorStrokeThickness="0"
    MajorStrokeDashArray="1"
    MajorStroke="#CCCCCC"
    Label="Time">
    <ig:CategoryXAxis.LabelSettings>
    <ig:AxisLabelSettings Visibility="Visible" />
    </ig:CategoryXAxis.LabelSettings>
    </ig:CategoryXAxis>
    <ig:NumericYAxis Name="YAxisLoad"
    MaximumValue="50"
    MinimumValue="0"
    Title="Load"
    Label="{}{:F1}">
    <ig:NumericYAxis.LabelSettings>
    <ig:AxisLabelSettings Location="OutsideLeft"
    Margin="2,0,0,0"
    FontFamily="Segoe UI"
    FontWeight="SemiBold"
    FontSize="11"
    Foreground="#4CA5FF"
    Visibility="Visible"/>
    </ig:NumericYAxis.LabelSettings>
    <ig:NumericYAxis.TitleSettings>
    <ig:TitleSettings FontFamily="Segoe UI"
    FontWeight="SemiBold"
    FontSize="11"
    Margin="5,0,5,0"
    Angle="-90"/>
    </ig:NumericYAxis.TitleSettings>
    </ig:NumericYAxis>
    </ig:XamDataChart.Axes>
    <ig:XamDataChart.Series>
    <ig:LineSeries Brush="#4DAF4A"
    XAxis="{Binding ElementName=XAxisData1}"
    YAxis="{Binding ElementName=YAxisLoad}">
    </ig:LineSeries>
    </ig:XamDataChart.Series>
    </ig:XamDataChart>
    </Grid>
    </UserControl>


    References:

    InfragisticsWPF4.Controls.Charts.XamDataChart.v19.1

    InfragisticsWPF4.v19.1

    UserControlView.xaml.cs and MainWindoe.xaml.cs contains only InitializeComponent ()in constructor.

    Sorry for the formatting and I hope you will be able to create the project with the provided information.

    Let me know if you face any difficulties.

    Thanks,

    Preeti Gaur

Children