Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
305
WinTree Recursive DataBinding
posted

I've been searching for quite some time and have not found an ideal example.

Is it possible to do something like the following:

PartCategoryTable
PartCategoryID
PartCategoryName
PartCategoryParentID

PartTable
PartID
PartName
PartCategoryID

There are two relationships: One from PartCategoryTable.PartCategoryID to PartCategoryTable.PartCategoryParentID and the other is from Part.PartCategoryID to PartCategoryTable.PartCategoryID.

The end result would look identical to Windows Explorer, where PartCategories are Folders, and Parts are files.

The ideal result would be so that I could associate this with a typed DataSet.

I hope this makes sense.  If not, please let me know.
Kyle

Parents
  • 69832
    Offline posted

    UltraTree's OutlookExpress ViewStyle is designed to present recursive relations such as 'PartCategoryTable.PartCategoryID to PartCategoryTable.PartCategoryParentID'. I am not able to visualize, however, how you would present the two relations as Windows Explorer does, since Explorer presents the folders in a tree (for this you would use the Standard ViewStyle) and files in a ListView. I'm not sure if this helps, but the UltraListView 'Infragistics FileExplorer' sample that ships with the SDK demonstrates how to do this, although it uses the local machine's file system as data, and does not utilize data binding.

  • 305
    posted in reply to Brian Fallon

    Thanks for the quick response!

    For an 'already-in-Windows' visual example, do the following:
    1. Go to your Desktop.
    2. Right-click and go to "New-Shortcut."
    3. Click "Browse..."
    4. A "Browse for Folder" dialog should appear.  If you drill down to a folder that has both folders AND files, you'll see what I'm aiming for.

    I found a forum posting that is IDENTICAL to what I want, but the answer seems to stop just shy of enough information.
    http://forums.infragistics.com/forums/p/13130/48568.aspx

    I've gotten the relationships set up the way I want.  I hide all the nodes except for the true root-most node.  Now, when I expand my first node ("COMPONENTS"), it shows the names of the relationships ("IPart4" and "PARTCATEGORY_PARTCATEGORY").  This is where I thought the above post would come in handy.  Can someone expand upon Mike's info?

    But, to top it ALL off, I seem to get a few odd behaviors that is making my life quite frustrating:
    1. Sometimes, when I start the application, it seems as though the Tree doesn't load the data.  It comes up blank.  To resolve this, I just restart my little test app.
    2. Sometimes there is a long delay when expanding the nodes.  Othertimes, it's really fast.
    3. When I have the following code in the InitializeDataNode event, it throws an exception.  If I comment out the e.Node.Visible = False line, it doesn't throw the exception.
    Select Case e.Node.Level
    Case 0
      If e.Node.Cells("PartCategoryParentID").Text.Trim() <> "0" Then
        e.Node.Visible = False
      End If
    Case Else
      If e.Node.Nodes.Count = 0 Then
        e.Node.Visible = False
      End If
    End Select
    4. Even if I comment out the e.Node.Visible = False line, but place a breakpoint, using F5 to continue, it will throw an exception.

    Is the 9.1.2023 UltraWinTree buggy?

    Full Stack Trace:
    System.ArgumentException: Item has already been added. Key in dictionary: 'PARTCATEGORY_PARTCATEGORY'  Key being added: 'PARTCATEGORY_PARTCATEGORY'
       at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
       at System.Collections.Hashtable.Add(Object key, Object value)
       at Infragistics.Win.UltraWinTree.NodeClientAreaUIElement.CacheNodeElements(Hashtable table, UIElementsCollection oldElements, Int32 startIndex)
       at Infragistics.Win.UltraWinTree.NodeClientAreaUIElement.PositionChildElements()
       at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
       at Infragistics.Win.UIElement.VerifyChildElements(Boolean recursive)
       at Infragistics.Win.UIElement.VerifyChildElements()
       at Infragistics.Win.UltraWinTree.UltraTreeUIElement.PositionChildElements()
       at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
       at Infragistics.Win.UIElement.VerifyChildElements(Boolean recursive)
       at Infragistics.Win.UIElement.VerifyChildElements()
       at Infragistics.Win.UltraWinTree.UltraTreeNode.BringIntoViewHelper(Boolean includeChildNodes, Boolean includeHorizontal, Boolean includeVertical, Boolean leftOnly)
       at Infragistics.Win.UltraWinTree.UltraTreeNode.BringIntoViewHelper(Boolean includeChildNodes, Boolean includeHorizontal)
       at Infragistics.Win.UltraWinTree.UltraTree.SetActiveNode(UltraTreeNode node, Boolean bringIntoView, Boolean adjustHorizontalPosition)
       at Infragistics.Win.UltraWinTree.UltraTree.set_ActiveNode(UltraTreeNode value)
       at Infragistics.Win.UltraWinTree.UltraTreeNode.internalExpand(Boolean value, Boolean notify, Boolean updateVisibleNodes)
       at Infragistics.Win.UltraWinTree.UltraTreeNode.set_Expanded(Boolean value)
       at Infragistics.Win.UltraWinTree.UltraTreeNode.Toggle()
       at Infragistics.Win.UltraWinTree.ExpansionIndicatorUIElement.Toggle()
       at Infragistics.Win.ExpansionIndicatorUIElement.OnMouseDown(MouseEventArgs e, Boolean adjustableArea, UIElement& captureMouseForElement)
       at Infragistics.Win.ControlUIElementBase.ProcessMouseDownHelper(Object sender, MouseEventArgs e)
       at Infragistics.Win.ControlUIElementBase.ProcessMouseDown(Object sender, MouseEventArgs e)
       at Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e)
       at Infragistics.Win.UltraControlBase.OnMouseDown(MouseEventArgs e)
       at Infragistics.Win.UltraWinTree.UltraTree.OnMouseDown(MouseEventArgs e)
       at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Reply Children
No Data