<?xml version="1.0" encoding="utf-8"?>
<UserControl x:Class="ChartExtended.Samples.Functions" mc:Ignorable="d" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
    <Grid x:Name="LayoutRoot">
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="230" />
      <ColumnDefinition />
    </Grid.ColumnDefinitions>
    <Border>
      <StackPanel>
        <Grid Margin="0,10,0,0">
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
          </Grid.ColumnDefinitions>
		  <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
          </Grid.RowDefinitions>
          <TextBlock Text="f(val)=" VerticalAlignment="Center" Margin="10,0,5,0" />
          <TextBox x:Name="tbCode" Grid.Column="1" AcceptsReturn="True" Margin="0,0,10,0" />
          <Border x:Name="error" Background="Transparent" Visibility="Collapsed" Grid.Column="2" Margin="2" BorderThickness="3" BorderBrush="Red" CornerRadius="6" Padding="6,0,6,0">
            <TextBlock Text="!" Foreground="Red" FontWeight="Bold" VerticalAlignment="Center" />
          </Border>
          <Button x:Name="btnApply" Content="Apply" Click="btnApply_Click" Margin="5,10,10,0" Grid.Row="1" Grid.ColumnSpan="3" Width="140" HorizontalAlignment="Right" />
        </Grid>
        <Border Background="#FFE0E0E0" Margin="10" BorderThickness="1" CornerRadius="2" Padding="2">
          <StackPanel>
            <TextBlock Text="Enter the function code with parameter val using JavaScript notation." TextWrapping="Wrap" />
            <Grid>
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition />
              </Grid.ColumnDefinitions>
              <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
              </Grid.RowDefinitions>

              <HyperlinkButton x:Name="btnSample1" Content="Sample 1:" Click="btnSample1_Click" ToolTipService.ToolTip="Click to copy sample" />
              <TextBlock Grid.Column="1" Foreground="Blue" Text="Math.sin(val)" />

              <HyperlinkButton Grid.Row="1" x:Name="btnSample2" Content="Sample 2:" Click="btnSample2_Click" VerticalAlignment="Top" ToolTipService.ToolTip="Click to copy sample" />
              <TextBlock Grid.Row="1" Grid.Column="1" Foreground="Blue"><Run Text="if (val&gt;0)" /><LineBreak /><Run Text=" " /><Run Text="  return val*val;" /><LineBreak /><Run Text=" " /><Run Text="else" /><LineBreak /><Run Text=" " /><Run Text="  return -val*val;" /></TextBlock>
            </Grid>
          </StackPanel>
        </Border>
      </StackPanel>
    </Border>
    <Border Grid.Column="1">
      <c1:C1Chart x:Name="chart" />
    </Border>
  </Grid>
</UserControl>