Edit this page

RadCalculator

This tutorial will walk your through the creation of a sample application that contains RadCalculator and will show you how:

  • Use RadCalculator in your project;

  • Perform basic calculations;

  • Perform more complicated calculations

For the purpose of this example, you will need to create an empty WPF Application project and open it in Visual Studio.

Adding RadCalculator to the Project

  • Create a new WPF project;

  • Add references to the assemblies Telerik.Windows.Controls and Telerik.Windows.Controls.Input;

  • Add the RadCalculator as demonstrated below:

<Window x:Class="RadCalculator.MainWindow"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&#13;             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&#13;             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"&#13;             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"&#13;             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"&#13;             xmlns:my="clr-namespace:RadCalculator"
             mc:Ignorable="d" d:DesignHeight="700" d:DesignWidth="700">   

    <Grid x:Name="LayoutRoot" Background="White" >
        <telerik:RadCalculator />       
    </Grid>
</Window>

Two lines of code are important here:

  • The import of the Telerik schema:

  • The declaration of the RadCalculator control inside the Grid:

<telerik:RadCalculator />

Now if you run the application, you have RadCalculator:

Rad Calculator-Basic

Perform basic calculation with RadCalculator

RadCalculator allows you to perform all the basic calculations - addition, subtraction, multiplication, division. All of them can be executed either by its corresponding buttons or through the keyboard. Once a particular operation is executed, the history is updated accordingly:

Rad Calculator-Basic Calculations

Perform complex calculation with RadCalculator

RadCalculator allows you to perform a couple of more complex calculations - square root, reciplorcal, percent, negate. All of them can be executed either by its corresponding buttons. Once a particular operation is executed, the history is updated accordingly:

Rad Calculator-Complex Calculations