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
1490
get the position of Chart Info Strips
posted

Hi,

I have studied the sample of  Chart Info Strips, and I do below changes to make the info strip be movable:

First, import these two dlls(Microsoft.Expression.Interactions,System.Windows.Interactivity) in IGDataChart.WPF and Infragistics.SamplesBrowser.WPF project, and then in ChartInfoStrips.xaml, I add 

<i:Interaction.Behaviors>
<il:MouseDragElementBehavior ConstrainToParentBounds="False" />
</i:Interaction.Behaviors>

under TextBlock.

<DataTemplate x:Key="VerticalInfoStripTemplate">
<Grid Margin="0" Width="{Binding Width}" Height="{Binding Height}">
<Rectangle Fill="{Binding Fill}" Opacity="1" />
<TextBlock HorizontalAlignment="Center" Cursor="Hand" VerticalAlignment="Center" Foreground="DimGray"
FontSize="30" FontWeight="Bold" Text="{Binding Label}" RenderTransformOrigin=".5,.5">
<i:Interaction.Behaviors>
<il:MouseDragElementBehavior ConstrainToParentBounds="False" />
</i:Interaction.Behaviors>
<TextBlock.RenderTransform>
<RotateTransform Angle="90" />
</TextBlock.RenderTransform>
</TextBlock>
</Grid>
</DataTemplate>

Now it's movable. The requirement is  when I move it to another position, I want to get the position of it, and then save the position in order that when next time I open the page, it's in the position where I move it before.

Do I make my self clearly?  Waiting for your answer, thanks~~

Parents
  • 138253
    Offline posted

    Hello,

    Thank you for your post. I have been looking into it and I can suggest you handle the MouseDragElementBehavior’s DragFinished event and in the handler you can use the sender to get the X and Y coordinates like this:

    double x = (sender as MouseDragElementBehavior).X;
    double y = (sender as MouseDragElementBehavior).Y;
     

    Please let me know if this helps you or you need further assistance on this matter.

    Looking forward for your reply.

Reply Children