Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Custom RowStyle based on Depth,Similar to Odd/Even row style

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
Halftime



Joined: 12 Nov 2006
Posts: 7
Location: Charlotte NC

PostPosted: Thu Nov 16, 2006 6:37 pm    Post subject: Custom RowStyle based on Depth,Similar to Odd/Even row style Reply with quote

To make the visual display of the data more appealing and logical I'm trying to set the background color based on the depth of the item being displayed. This would make all items at odd depths displayed with the same background color and would improve the readability of the data being displayed.

My code works properly for the depth, except the left and right portion of the cirtualtree are not showing the updated color. Below is a simple example that demonstrates the problem -add the code to the getCellData event and you can see the problem.


Style oNewStyle = new Style(e.CellData.EvenStyle);
oNewStyle.BackColor = Color.FromArgb(255,0,0);

e.CellData.EvenStyle = oNewStyle;
e.CellData.OddStyle = oNewStyle; //oOddStyle;

Also how would you drag data from a virtual tree to Excel or Notepad ?

Any help is appreciated.

Thanks,

[/img]
_________________
Michael Miller
HalfTime Technologies
Back to top
View user's profile Send private message Visit poster's website
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Thu Nov 16, 2006 9:44 pm    Post subject: Reply with quote

You would also need to set the style for the whole row by handling GetRowData event.

If you are dragging data to Excel or Notepad then the built in mechanism for dragging Rows around and between Virtual Tree won't help much - because Excel and Notepad won't understand the data format (an array of rows) being dragged. So you will need to implement your own mechanism. You can do this by creating a custom RowWidget class (see the section in the help on Custom Widgets) and overriding the DoDragDrop method.

The default implementation is:

Code:
protected virtual void DoDragDrop()
{
    SelectOnMouseUp = false;
    Dragging = true;
    Tree.EditWidget = null;
    SetDragCursors();
    WidgetControl.DoDragDrop(this, Tree.SelectedRows.GetRows(), DragDropEffects.All);
    DestroyDragCursors();
    Dragging = false;
}


You would need to change the second parameter of the WidgetControl.DoDragDrop call to data that Excel and Notepad can understand - probably a string or DataObject.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group