Version

PropertyName Property

Gets/sets which property of the control is used as either the source or target of any calculations involving the control.
Syntax
'Declaration
 
Public Property PropertyName As String
public string PropertyName {get; set;}
Remarks

PropertyName gets/sets the name of the property that is used as either the source or target (or both) of any calculations involving the control. If no PropertyName is set, or if the PropertyName is invalid, then the control will not participate in any calculations and a Reference Error may be generated.

In order for the CalcManager to properly use a control's proeprty as the source value in a calculation the property must follow the same guidelines as a Bindable property. That is, the control must expose the property publicly and also expose a PropertyChanged event. For Example, if The Text property is being used, then the control must also have a TextChanged event. If there is no such event, the calculation will not function correctly. This applies only to source properties. If the control is only being used at the target for the calculated value of a formula, the event is not required.

Example
Demonstrates setting up references for 2 TextBoxes which wil represent the height and width of a rectangle. The area of the rectangle is then calculated in a NamedReference. When the calculations are completed, the area is displayed in a third textbox.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.CalcEngine
Imports Infragistics.Win.UltraWinCalcManager

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'Suspend calculation while we are adding new items into the calc network
        Me.UltraCalcManager1.SuspendCalc()

        Dim calcSettings As CalcSettings

        'Set CalcSettings properties on TextBox1
        calcSettings = Me.UltraCalcManager1.GetCalcSettings(Me.textBox1)
        calcSettings.PropertyName = "Text"
        calcSettings.Alias = "Height"
        calcSettings.ErrorValue = 1

        'Set CalcSettings properties on TextBox2
        calcSettings = Me.UltraCalcManager1.GetCalcSettings(Me.textBox2)
        calcSettings.PropertyName = "Text"
        calcSettings.Alias = "Width"
        calcSettings.ErrorValue = 1

        'Create a NamedReference to calulate the area. 
        Dim namedReference As NamedReference
        namedReference = Me.UltraCalcManager1.NamedReferences.Add("Area", "[//Height] * [//Width]")
        namedReference.ErrorValue = "Error"

        'Everything is added, so resume
        Me.UltraCalcManager1.ResumeCalc()

    End Sub

    Private Sub UltraCalcManager1_CalculationsCompleted(ByVal sender As Object, ByVal e As System.EventArgs) Handles UltraCalcManager1.CalculationsCompleted
        If (Me.UltraCalcManager1.NamedReferences.Exists("Area")) Then
            Me.textBox3.Text = Me.UltraCalcManager1.NamedReferences("Area").FormulaResult.Value.ToString()
        End If
    End Sub
using Infragistics.CalcEngine;
using Infragistics.Win.UltraWinCalcManager;


	private void Form1_Load(object sender, System.EventArgs e)
		{
			//Suspend calculation while we are adding new items into the calc network
			this.ultraCalcManager1.SuspendCalc();

			CalcSettings calcSettings = null;

			//Set CalcSettings properties on TextBox1
			calcSettings = this.ultraCalcManager1.GetCalcSettings(this.textBox1);       
			calcSettings.PropertyName = "Text";
			calcSettings.Alias = "Height";
			calcSettings.ErrorValue = 1;
			
			//Set CalcSettings properties on TextBox2
			calcSettings = this.ultraCalcManager1.GetCalcSettings(this.textBox2);       
			calcSettings.PropertyName = "Text";
			calcSettings.Alias = "Width";
			calcSettings.ErrorValue = 1;
			
			//Create a NamedReference to calulate the area. 
			NamedReference namedReference = null;
			namedReference = this.ultraCalcManager1.NamedReferences.Add("Area", "[//Height] * [//Width]");
			namedReference.ErrorValue = "Error";

			//Everything is added, so resume
			this.ultraCalcManager1.ResumeCalc();
		}

		private void ultraCalcManager1_CalculationsCompleted(object sender, System.EventArgs e)
		{
			if ( this.ultraCalcManager1.NamedReferences.Exists("Area") )
			{
				this.textBox3.Text = this.ultraCalcManager1.NamedReferences["Area"].FormulaResult.Value.ToString();
			}
		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also