Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.64 KB | None | 0 0
  1. <Window x:Class="TestOxyPlot.MainWindow"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:oxy="http://oxyplot.org/wpf"
  7. xmlns:local="clr-namespace:TestOxyPlot"
  8. mc:Ignorable="d"
  9. Title="MainWindow" Height="350" Width="525">
  10. <Grid>
  11. <oxy:Plot x:Name="oxyPlot" Title="{Binding Title}" Margin="207,53,0,0">
  12. <oxy:Plot.Series>
  13. <oxy:LineSeries ItemsSource="{Binding Points}"/>
  14. </oxy:Plot.Series>
  15. </oxy:Plot>
  16. <TextBox x:Name="textBox" HorizontalAlignment="Left" Height="23" Margin="44,64,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120" MouseLeave="textBox_MouseLeave" TextChanged="textBox_TextChanged"/>
  17. <TextBox x:Name="textBox1" HorizontalAlignment="Left" Height="23" Margin="44,101,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120" TextChanged="textBox1_TextChanged"/>
  18. <Button x:Name="button" Content="Button" HorizontalAlignment="Left" Margin="68,174,0,0" VerticalAlignment="Top" Width="75" Click="button_Click"/>
  19. </Grid>
  20. </Window>
  21.  
  22. using System;
  23. using System.Collections.Generic;
  24. using System.Linq;
  25. using System.Text;
  26. using System.Threading.Tasks;
  27. using System.Windows;
  28. using System.Windows.Controls;
  29. using System.Windows.Data;
  30. using System.Windows.Documents;
  31. using System.Windows.Input;
  32. using System.Windows.Media;
  33. using System.Windows.Media.Imaging;
  34. using System.Windows.Navigation;
  35. using System.Windows.Shapes;
  36. using OxyPlot;
  37.  
  38. namespace TestOxyPlot
  39. {
  40. /// <summary>
  41. /// Interaktionslogik für MainWindow.xaml
  42. /// </summary>
  43. public partial class MainWindow : Window
  44. {
  45. public MainWindow()
  46. {
  47. InitializeComponent();
  48. this.Title = "Example 2";
  49. this.Points = new List<DataPoint>
  50. {
  51. new DataPoint(0, 4),
  52. new DataPoint(10, 13),
  53. new DataPoint(20, 15),
  54. new DataPoint(30, 16),
  55. new DataPoint(40, 12),
  56. new DataPoint(50, 12)
  57. };
  58.  
  59.  
  60. }
  61. public string Title { get; private set; }
  62.  
  63. public IList<DataPoint> Points { get; private set; }
  64.  
  65. private void textBox_MouseLeave(object sender, MouseEventArgs e)
  66. {
  67.  
  68.  
  69. }
  70.  
  71. private void textBox_TextChanged(object sender, TextChangedEventArgs e)
  72. {
  73. try
  74. {
  75. oxyPlot.Width = Int32.Parse(textBox.Text);
  76. }
  77. catch (Exception error)
  78. {
  79. MessageBox.Show("Message: " + error);
  80. }
  81.  
  82. }
  83.  
  84. private void button_Click(object sender, RoutedEventArgs e)
  85. {
  86.  
  87. }
  88.  
  89. private void textBox1_TextChanged(object sender, TextChangedEventArgs e)
  90. {
  91. try
  92. {
  93. oxyPlot.Width = Int32.Parse(textBox.Text);
  94. }
  95. catch (Exception error)
  96. {
  97. MessageBox.Show("Message: " + error);
  98. }
  99. }
  100. }
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement