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 

about tree_GetRowData

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



Joined: 29 Mar 2011
Posts: 4

PostPosted: Fri Apr 29, 2011 9:50 am    Post subject: about tree_GetRowData Reply with quote

Follow the code:

private void tree_GetRowData(object sender, GetRowDataEventArgs e)
{
RowBinding binding = tree.GetRowBinding(e.Row);
binding.GetRowData(e.Row, e.RowData);

..........
}


I want to know the red cod what to do. If I remove the red code ,what influence will be caused?
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Sat Apr 30, 2011 12:01 am    Post subject: Reply with quote

Is this code from a sample?

The code is getting the design time RowBinding associated with the given row and using it to set the default RowData properties. This is a common approach if you are using design time Object Binding or DataSet Binding and just want to override the binding settings for a specific row.

If you are not using design time binding then you shouldn't do this - because tree.GetRowBinding will return null and the next line will fail.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
cpbird



Joined: 29 Mar 2011
Posts: 4

PostPosted: Sat Apr 30, 2011 9:03 am    Post subject: Reply with quote

Fellow the code:
private void tree_GetRowData(object sender, GetRowDataEventArgs e)
{
RowBinding binding = tree.GetRowBinding(e.Row);
binding.GetRowData(e.Row, e.RowData);

if (e.Row.Item != null)
{
DSCPLMain.epcProjectVariantRow variantRow = e.Row.Item as DSCPLMain.epcProjectVariantRow;
if (variantRow != null)
{
if (!variantRow.IsIsPBMNull() && variantRow.IsPBM == 1)
{
e.RowData.OddStyle = new Style(e.RowData.OddStyle, pbmVariantRowStyle);
e.RowData.EvenStyle = new Style(e.RowData.OddStyle, pbmVariantRowStyle);
}
}
}
}

Through debug,I found that,whatever the 'binding.GetRowData(e.Row, e.RowData);' run, the 'e.Row.Item ' still has data.
I think that if the code 'binding.GetRowData(e.Row, e.RowData);' can be removed. Because that is time-consuming.
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon May 02, 2011 12:36 am    Post subject: Reply with quote

The GetRowData event is used to set the Icon and style for the row. If you don't set these (either programmatically or by calling the binding.GetRowData method) then you just get the default style and no icon. If you remove this and it doesn't affect the look of your tree then you don't need it.
_________________
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