Click here to Skip to main content
15,885,278 members
Articles / Desktop Programming / WPF

Equation Calculator with Graphing

Rate me:
Please Sign up or sign in to vote.
4.92/5 (69 votes)
25 Nov 2010CPOL9 min read 132.6K   4.2K   158  
Equation Calculator with Graphing
<Window x:Class="Calculator.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:shared="clr-namespace:CommonUtils;assembly=CommonUtils"
        xmlns:local="clr-namespace:Calculator"
        Title="Jesper's Calculator" Height="420" Width="650" WindowStartupLocation="CenterScreen"
        Background="{StaticResource Charcoal}"
        >
    <Window.Resources>

        <Style TargetType="Label" >
            <Setter Property="Foreground" Value="{StaticResource Forecolor}" />
            <Setter Property="FontSize" Value="16" />
            <Setter Property="FontFamily" Value="{StaticResource fontFamily}" />
        </Style>

        <Style TargetType="ListBoxItem">
            <Style.Resources>
                <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="#fF242424"/>
                <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#FF545454"/>
            </Style.Resources>
            <Setter Property="Foreground" Value="{StaticResource Forecolor}" />
        </Style>


        <Style TargetType="TabItem">
            <Style.Setters>
                <Setter Property="Foreground" Value="#FF7F7F7F" />

                <Setter Property="Background" Value="{StaticResource BlackButton}" />
                <Setter Property="FontFamily" Value="Cambria Math" />
                <Setter Property="FontSize" Value="14" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Border x:Name="bd"
                                        CornerRadius="4" 
                                        BorderBrush="#FF2F2F2F" 
                                        BorderThickness="1"
                                        Background="{TemplateBinding Background}"
                                        >
                                <ContentPresenter Margin="5,2,5,2" Content="{TemplateBinding TabItem.Header}" x:Name="ct"
                                    			HorizontalAlignment="Center" VerticalAlignment="Center">
                                </ContentPresenter>
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <!--Setter Property="Effect" >
                                        <Setter.Value>
                                            <DropShadowEffect ShadowDepth="0" Color="Wheat" BlurRadius="5" />
                                        </Setter.Value>
                                    </Setter-->
                                </Trigger>
                                <Trigger Property="TabItem.IsSelected" Value="True">
                                    <!--Setter Property="Background" Value="{StaticResource BrownButton}" /-->
                                    <Setter Property="Foreground" Value="{StaticResource BlackButtonForeground}" />
                                    <Setter Property="TabItem.RenderTransform" TargetName="ct">
                                        <Setter.Value>
                                            <TranslateTransform X="0" Y="-1" />
                                            <!--ScaleTransform ScaleX="1.2" ScaleY="1.2"/-->
                                        </Setter.Value>
                                    </Setter>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style.Setters>
        </Style>


    </Window.Resources>
    <TabControl Background="{StaticResource Charcoal}" SelectedIndex="0">
        <TabItem Header="Calculator" Height="25">
            <local:CalculatorCtrl x:Name="m_calculatorCtrl">
            </local:CalculatorCtrl>
        </TabItem>
        <TabItem Header="Graph" Height="25">
            <local:GraphForm  x:Name="m_graphCtrl">
            </local:GraphForm>
        </TabItem>
        <!--TabItem Header="test">
            <local:TestForm>
            </local:TestForm>
        </TabItem-->
    </TabControl>
</Window>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions