Click here to Skip to main content
15,885,914 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.7K   4.2K   158  
Equation Calculator with Graphing
<ResourceDictionary x:Class="CommonUtils.Themes.Generic"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:CommonUtils">

    <Style x:Key="DropDownButtonStyle" TargetType="{x:Type Button}" />
    <Style TargetType="local:TextBoxWithHistory" BasedOn="{StaticResource {x:Type TextBox}}">
        <Style.Setters>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="TextBoxBase">
                        <ControlTemplate.Resources>
                        </ControlTemplate.Resources>
                        <Border 
                                BorderThickness="0.4"
                                Background="{TemplateBinding Background}" 
                                BorderBrush="{TemplateBinding Foreground}" 
                                >
                            <StackPanel>
                                <DockPanel>
                                    <Button Width="20" 
                                        x:Name="PART_DropButton"
                                        DockPanel.Dock="Right"
                                        Margin="3,0,0,0"
                                        Height="{TemplateBinding Height}" 
                                        Style="{DynamicResource DropDownButtonStyle}"
                                        Foreground="{TemplateBinding Foreground}"
                                        Focusable="False"
                                            >
                                        <Path Fill="{TemplateBinding Foreground}" Stroke="{TemplateBinding Foreground}" >
                                            <Path.Data>
                                                <PathGeometry Figures="M0,0L6,0L3,3z" />
                                            </Path.Data>
                                        </Path>
                                    </Button>
                                        <ScrollViewer Name="PART_ContentHost" 
                                        Margin="2"
                                        SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" 
                                        HorizontalContentAlignment="Center" 
                                        VerticalContentAlignment="Center"/>
                                </DockPanel>
                                <local:HistoryListPopup x:Name="PART_Popup"
                                       IsOpen="False" 
                                       StaysOpen="False"
                                       Placement="Bottom" 
                                       AllowsTransparency="True"
                                       Width="{TemplateBinding ActualWidth}"
                                       Height="200"
                                       >
                                    <ListBox ItemsSource="{Binding HistoryList}" 
                                         Background="{TemplateBinding Background}" 
                                         Foreground="{TemplateBinding Foreground}"
                                         SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
                                         x:Name="m_historyListBox"
                                             >
                                        <!--SelectedItem="{TemplateBinding local:HistoryListPopup.SelectedItem, Mode=TwoWay}"-->
                                        <!--MouseDoubleClick="OnMouseDoubleClick"-->
                                    </ListBox>

                                </local:HistoryListPopup>
                            </StackPanel>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style.Setters>
    </Style>


    <Style TargetType="{x:Type local:TestCustomControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:TestCustomControl}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>

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