バージョン

Node プロパティ (InitializeDataNodeEventArgs)

データソースから初期化される UltraTreeNode インスタンスを返します。
シンタックス
'宣言
 
Public ReadOnly Property Node As UltraTreeNode
public UltraTreeNode Node {get;}
使用例
Imports Infragistics.Win
Imports Infragistics.Win.Layout
Imports Infragistics.Win.UltraWinTree

    Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
        '	Get the DataSet
        Dim dataSet As DataSet = Me.GetData()

        '	Set 'AutoGenerateColumnSets' to true so that UltraTreeCOlumnSets are automatically generated
        Me.ultraTree1.ColumnSettings.AutoGenerateColumnSets = True

        '	Set 'SynchronizeCurrencyManager' to false to optimize performance
        Me.ultraTree1.SynchronizeCurrencyManager = False

        '	Set 'ViewStyle' to OutlookExpress for a relational display
        Me.ultraTree1.ViewStyle = ViewStyle.OutlookExpress

        '	Set 'AutoFitColumns' to true to automatically fit all columns
        Me.ultraTree1.ColumnSettings.AutoFitColumns = AutoFitColumns.ResizeAllColumns

        '	Set DataSource/DataMember to bind the UltraTree
        Me.ultraTree1.DataSource = DataSet
        Me.ultraTree1.DataMember = "TVSeries"
    End Sub

    Private Function GetData() As DataSet
        Dim dataSet As DataSet = New DataSet()

        Dim dataTableSeries As DataTable = New DataTable("TVSeries")

        dataTableSeries.Columns.Add("RecordID", GetType(Integer))
        dataTableSeries.Columns.Add("Name", GetType(String))
        dataTableSeries.Columns.Add("Network", GetType(String))
        dataTableSeries.Columns.Add("PilotDate", GetType(DateTime))

        dataTableSeries.Rows.Add(New Object() {0, "Happy Days", "ABC", New DateTime(1974, 1, 15)})
        dataTableSeries.Rows.Add(New Object() {1, "Diff'rent Strokes", "NBC", New DateTime(1978, 11, 3)})
        dataTableSeries.Rows.Add(New Object() {2, "All In The Family", "CBS", New DateTime(1971, 1, 12)})


        Dim dataTableSpinoffs As DataTable = New DataTable("Spinoffs")

        dataTableSpinoffs.Columns.Add("RecordID", GetType(Integer))
        dataTableSpinoffs.Columns.Add("ParentRecordID", GetType(Integer))
        dataTableSpinoffs.Columns.Add("Name", GetType(String))
        dataTableSpinoffs.Columns.Add("Network", GetType(String))
        dataTableSpinoffs.Columns.Add("PilotDate", GetType(DateTime))

        dataTableSpinoffs.Rows.Add(New Object() {3, 0, "Blansky's Beauties", "ABC", New DateTime(1977, 2, 12)})
        dataTableSpinoffs.Rows.Add(New Object() {4, 0, "Mork And Mindy", "ABC", New DateTime(1978, 2, 28)})
        dataTableSpinoffs.Rows.Add(New Object() {5, 0, "Laverne And Shirley", "ABC", New DateTime(1979, 9, 11)})
        dataTableSpinoffs.Rows.Add(New Object() {6, 0, "Joanie Loves Chachi", "ABC", New DateTime(1982, 3, 23)})

        dataTableSpinoffs.Rows.Add(New Object() {7, 1, "Hello, Larry", "NBC", New DateTime(1979, 1, 26)})
        dataTableSpinoffs.Rows.Add(New Object() {8, 1, "The Facts Of Life", "NBC", New DateTime(1979, 8, 24)})

        dataTableSpinoffs.Rows.Add(New Object() {9, 2, "Maude", "CBS", New DateTime(1972, 9, 12)})
        dataTableSpinoffs.Rows.Add(New Object() {10, 2, "The Jeffersons", "CBS", New DateTime(1975, 1, 18)})
        dataTableSpinoffs.Rows.Add(New Object() {11, 10, "Checking In", "CBS", New DateTime(1981, 4, 9)})
        dataTableSpinoffs.Rows.Add(New Object() {12, 9, "Good Times", "CBS", New DateTime(1974, 2, 8)})

        dataSet.Tables.Add(dataTableSeries)
        dataSet.Tables.Add(dataTableSpinoffs)

        dataSet.Relations.Add("SpinoffToSeries", dataTableSeries.Columns("RecordID"), dataTableSpinoffs.Columns("ParentRecordID"), False)
        dataSet.Relations.Add("SpinoffToSpinoff", dataTableSpinoffs.Columns("RecordID"), dataTableSpinoffs.Columns("ParentRecordID"), False)

        Return dataSet
    End Function

    Private Sub ultraTree1_InitializeDataNode(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTree.InitializeDataNodeEventArgs) Handles ultraTree1.InitializeDataNode

        '	If the node is being initialized for the first time,
        '	set some appearance properties for root nodes
        If e.Reinitialize = False AndAlso e.Node.Level = 0 Then
            e.Node.Override.NodeAppearance.BackColor = Office2003Colors.ToolbarGradientLight
            e.Node.Override.NodeAppearance.BackColor2 = Office2003Colors.ToolbarGradientDark
            e.Node.Override.NodeAppearance.BackGradientStyle = GradientStyle.Vertical
            e.Node.Override.NodeAppearance.ForeColor = Color.DarkBlue
            e.Node.Override.NodeAppearance.FontData.Bold = DefaultableBoolean.True
        End If

        '	Expand each node as it is initialized
        e.Node.Expanded = True

    End Sub

    Private Sub ultraTree1_ColumnSetGenerated(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTree.ColumnSetGeneratedEventArgs) Handles ultraTree1.ColumnSetGenerated
        Dim i As Integer
        For i = 0 To e.ColumnSet.Columns.Count - 1

            Dim column As UltraTreeNodeColumn = e.ColumnSet.Columns(i)

            '	Format the DateTime columns with the current culture's ShortDatePattern
            If column.DataType Is GetType(DateTime) Then
                column.Format = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern
            End If

            '	Hide the integer columns, which represent record IDs
            If (column.DataType Is GetType(Integer)) Then
                column.Visible = False
            End If

            '	Set the MapToColumn for the relationship ColumnSets
            If e.ColumnSet.Key = "SpinoffToSeries" Or e.ColumnSet.Key = "SpinoffToSpinoff" Then
                column.MapToColumn = column.Key
            End If

            '	Set the Text property to something more descriptive
            If column.Key = "Name" Then

                column.Text = "TV Series / Spinoffs"

                '	Make the name column wider
                column.LayoutInfo.PreferredLabelSize = New Size(Me.ultraTree1.Width / 2, 0)

            ElseIf column.Key = "PilotDate" Then

                column.Text = "First Aired"

                '	Center align the text for the first aired date
                column.CellAppearance.TextHAlign = HAlign.Center

            ElseIf column.Key = "Network" Then
                '	Center align the text for the name of the network
                column.CellAppearance.TextHAlign = HAlign.Center
            End If
        Next i

    End Sub
using Infragistics.Win;
using Infragistics.Win.Layout;
using Infragistics.Win.UltraWinTree;
using System.Diagnostics;

		private void button1_Click(object sender, System.EventArgs e)
		{
			//	Get the DataSet
			DataSet dataSet = this.GetData();

			//	Set 'AutoGenerateColumnSets' to true so that UltraTreeCOlumnSets are automatically generated
			this.ultraTree1.ColumnSettings.AutoGenerateColumnSets = true;

			//	Set 'SynchronizeCurrencyManager' to false to optimize performance
			this.ultraTree1.SynchronizeCurrencyManager = false;

			//	Set 'ViewStyle' to OutlookExpress for a relational display
			this.ultraTree1.ViewStyle = ViewStyle.OutlookExpress;

			//	Set 'AutoFitColumns' to true to automatically fit all columns
			this.ultraTree1.ColumnSettings.AutoFitColumns = AutoFitColumns.ResizeAllColumns;

			//	Set DataSource/DataMember to bind the UltraTree
			this.ultraTree1.DataSource = dataSet;
			this.ultraTree1.DataMember = "TVSeries";
		}	

		private DataSet GetData()
		{
			DataSet dataSet = new DataSet();

			DataTable dataTableSeries = new DataTable( "TVSeries" );

			dataTableSeries.Columns.Add( "RecordID", typeof(int) );
			dataTableSeries.Columns.Add( "Name", typeof(string) );
			dataTableSeries.Columns.Add( "Network", typeof(string) );
			dataTableSeries.Columns.Add( "PilotDate", typeof(DateTime) );

			dataTableSeries.Rows.Add( new object[]{ 0, "Happy Days", "ABC", new DateTime( 1974, 1, 15 ) } );
			dataTableSeries.Rows.Add( new object[]{ 1, "Diff'rent Strokes", "NBC", new DateTime( 1978, 11, 3 ) } );
			dataTableSeries.Rows.Add( new object[]{ 2, "All In The Family", "CBS", new DateTime( 1971, 1, 12 ) } );


			DataTable dataTableSpinoffs = new DataTable( "Spinoffs" );

			dataTableSpinoffs.Columns.Add( "RecordID", typeof(int) );
			dataTableSpinoffs.Columns.Add( "ParentRecordID", typeof(int) );
			dataTableSpinoffs.Columns.Add( "Name", typeof(string) );
			dataTableSpinoffs.Columns.Add( "Network", typeof(string) );
			dataTableSpinoffs.Columns.Add( "PilotDate", typeof(DateTime) );

			dataTableSpinoffs.Rows.Add( new object[]{ 3, 0, "Blansky's Beauties", "ABC", new DateTime( 1977, 2, 12 ) } );
			dataTableSpinoffs.Rows.Add( new object[]{ 4, 0, "Mork And Mindy", "ABC", new DateTime( 1978, 2, 28 ) } );
			dataTableSpinoffs.Rows.Add( new object[]{ 5, 0, "Laverne And Shirley", "ABC", new DateTime( 1979, 9, 11 ) } );
			dataTableSpinoffs.Rows.Add( new object[]{ 6, 0, "Joanie Loves Chachi", "ABC", new DateTime( 1982, 3, 23 ) } );

			dataTableSpinoffs.Rows.Add( new object[]{ 7, 1, "Hello, Larry", "NBC", new DateTime( 1979, 1, 26 ) } );
			dataTableSpinoffs.Rows.Add( new object[]{ 8, 1, "The Facts Of Life", "NBC", new DateTime( 1979, 8, 24 ) } );

			dataTableSpinoffs.Rows.Add( new object[]{ 9, 2, "Maude", "CBS", new DateTime( 1972, 9, 12 ) } );
			dataTableSpinoffs.Rows.Add( new object[]{ 10, 2, "The Jeffersons", "CBS", new DateTime( 1975, 1, 18 ) } );
			dataTableSpinoffs.Rows.Add( new object[]{ 11, 10, "Checking In", "CBS", new DateTime( 1981, 4, 9 ) } );
			dataTableSpinoffs.Rows.Add( new object[]{ 12, 9, "Good Times", "CBS", new DateTime( 1974, 2, 8 ) } );

			dataSet.Tables.Add( dataTableSeries );
			dataSet.Tables.Add( dataTableSpinoffs );

			dataSet.Relations.Add( "SpinoffToSeries", dataTableSeries.Columns["RecordID"], dataTableSpinoffs.Columns["ParentRecordID"], false );
			dataSet.Relations.Add( "SpinoffToSpinoff", dataTableSpinoffs.Columns["RecordID"], dataTableSpinoffs.Columns["ParentRecordID"], false );

			return dataSet;
		}

		private void ultraTree1_InitializeDataNode(object sender, Infragistics.Win.UltraWinTree.InitializeDataNodeEventArgs e)
		{
			//	If the node is being initialized for the first time,
			//	set some appearance properties for root nodes
			if ( e.Reinitialize == false && e.Node.Level == 0 )
			{
				e.Node.Override.NodeAppearance.BackColor = Office2003Colors.ToolbarGradientLight;
				e.Node.Override.NodeAppearance.BackColor2 = Office2003Colors.ToolbarGradientDark;
				e.Node.Override.NodeAppearance.BackGradientStyle = GradientStyle.Vertical;				
				e.Node.Override.NodeAppearance.ForeColor = Color.DarkBlue;
				e.Node.Override.NodeAppearance.FontData.Bold = DefaultableBoolean.True;
			}

			//	Expand each node as it is initialized
			e.Node.Expanded = true;
		}

		private void ultraTree1_ColumnSetGenerated(object sender, Infragistics.Win.UltraWinTree.ColumnSetGeneratedEventArgs e)
		{			
			for ( int i = 0; i < e.ColumnSet.Columns.Count; i ++ )
			{
				UltraTreeNodeColumn column = e.ColumnSet.Columns[i];

				//	Format the DateTime columns with the current culture's ShortDatePattern
				if ( column.DataType == typeof(DateTime) )
					column.Format = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern;

				//	Hide the integer columns, which represent record IDs
				if ( column.DataType == typeof(int) )
					column.Visible = false;

				//	Set the MapToColumn for the relationship ColumnSets
				if ( e.ColumnSet.Key == "SpinoffToSeries" || e.ColumnSet.Key == "SpinoffToSpinoff" )
					column.MapToColumn = column.Key;

				//	Set the Text property to something more descriptive
				if ( column.Key == "Name" )
				{
					column.Text = "TV Series / Spinoffs";

					//	Make the name column wider
					column.LayoutInfo.PreferredLabelSize = new Size( this.ultraTree1.Width / 2, 0 );
				}
				else
				if ( column.Key == "PilotDate" )
				{
					column.Text = "First Aired";

					//	Center align the text for the first aired date
					column.CellAppearance.TextHAlign = HAlign.Center;
				}
				else
				if ( column.Key == "Network" )
					//	Center align the text for the name of the network
					column.CellAppearance.TextHAlign = HAlign.Center;
			}

		}
参照