Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Getting Additional information for node (Read 2346 times)
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Getting Additional information for node
Mar 29th, 2010 at 2:30pm
Print Post  
Hi Stoyo

As you described in your previous thread, I am using one more Grid in my template (for derived node from shape node). This node don't have any child controls.

The childs for this control will be provided later on dynamically ( Trying to achive something like decorations - the only difference is that decorations gets resized and this won't get resized)

Majorly, the child for this additional grid will always be a grid and I need these child will be provided by application which captures some event ( like UpdateVisual addes decorations grid)

Which event I should override for this which raises event for my application. My application will build necessary child object and return it to the function which raised the event and later on fill the child in my grid hosted in generic.xaml file.

Just for your info - I am able to write UpdateVisual function in my derived class but it doesn't get triggered.
Code
Select All
protected virtual void UpdateVisuals()
{
base.UpdateVisuals();
}
 



Regards
Rajesh
  
Back to top
WWW  
IP Logged
 
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Re: Getting Additional information for node
Reply #1 - Mar 30th, 2010 at 6:29am
Print Post  
Hi Stoyo

Help file says that UpdateVisual function can be overridden but in the mindfusion assembly it is internal.

I think, this internal specifier needs to be removed.

-Rajesh
  
Back to top
WWW  
IP Logged
 
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Re: Getting Additional information for node
Reply #2 - Mar 30th, 2010 at 8:03am
Print Post  
Hi Stoyo

I will be able to get the updatevisual function triggered. I was missing override keyword.

-Rajesh
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Getting Additional information for node
Reply #3 - Mar 30th, 2010 at 8:05am
Print Post  
Hi Rajesh,

UpdateVisuals() is declared as protected internal, so it can be called both by derived classes and by other classes from the mindfusion.diagramming assembly. Try declaring your method using the override keyword:

protected override void UpdateVisuals() ...

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Re: Getting Additional information for node
Reply #4 - Mar 30th, 2010 at 1:51pm
Print Post  
Hi Stoyo

I am having problems with UpdateVisuals -

As I described previously, I have a derived class from ShapeNode and this class has its own genric.xaml file having following object -


<Grid x:Name="ChildGrid" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">

This object stored in global class level variable in OnApplyTemplate function as below -

childGrid = (Grid)base.GetTemplateChild("ChildGrid");

In my UpdateVisual function I have following code -
Code
Select All
protected override void UpdateVisuals()
{
if ((this.childGrid != null) && (childGridItems == null))
{
childGridItems = new Grid();
childGridItems.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(30, GridUnitType.Star) });
childGridItems.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(30, GridUnitType.Star) });
childGridItems.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(30, GridUnitType.Star) });
childGridItems.ShowGridLines = true;
childGrid.Children.Add(childGridItems);
}
base.UpdateVisuals();
}
 




If this.ChildGrid != null check is not added, I get exception, since UpdateVisual gets triggered from base class when bounds are set. [ Seen from Stack ]

Adding this.ChildGrid != null, check doesn't show me the grid which is added, when shapenode is shown on screen. If I try to resize node, then the child grid is visible since at that time again "UpdateVisual" gets triggered.

Can you tell me at what location should I do above coding [ For eq. If i need to raise event where should I do it ? ]

The childGrid object doesn't get set unless and until, OnApplyTemplate function gets triggered.
Or SetBounds function should not trigger UpdateVisual if "OnApplyTemplate" doesn't get executed and it should be executed once OnApplyTemplate gets executed.

Also - I shouldn't execute above code in "OnApplyTemplate" because when this code is executed, it is possible that shape is not set.

Let me know, How i achive this ?

-Regards
Rajesh
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Getting Additional information for node
Reply #5 - Mar 30th, 2010 at 5:18pm
Print Post  
Hi Rajesh,

The control calls UpdateVisuals when it needs to update an item's visual tree when a property setter affects it, so you could do the same when a property related to these childGridItems changes.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint