Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic TemplatedNode with CustomDraw Additional2? (Read 1472 times)
Joel D.
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 27
Location: Seattle
Joined: Feb 6th, 2017
TemplatedNode with CustomDraw Additional2?
Nov 23rd, 2021 at 2:08am
Print Post  
Does TemplatedNode have an equivalent to ShapeNode's CustomDraw.Additional2 functionality, where I could let WpfDiagram do a full pass on drawing the TemplatedNode and then I get to add additional drawing that is not constrained by the node's bounds?  (At least that's how I think CustomeDraw.Additional2 works.)

Cheers,
Joel.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: TemplatedNode with CustomDraw Additional2?
Reply #1 - Nov 23rd, 2021 at 12:16pm
Print Post  
If you are looking for a way to render graphics outside of node.Bounds, you can achieve that by setting negative margins on some Xaml element in the template:

Code
Select All
<Style TargetType="{x:Type diag:TemplatedNode}">
    <Setter Property="Template">
        <Setter.Value>
            <DataTemplate DataType="{x:Type diag:TemplatedNode}">
                <Grid>
                    <Rectangle Fill="Blue" Margin="-10,-10,-10,-10"  />
                    <Rectangle Fill="Red" />
                </Grid>
           </DataTemplate>
        </Setter.Value>
    </Setter>
</Style> 



If you need to run low-level rendering code via DrawingContext API, you could override UIElement.OnRender in a custom element class and add that to the node's template.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Joel D.
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 27
Location: Seattle
Joined: Feb 6th, 2017
Re: TemplatedNode with CustomDraw Additional2?
Reply #2 - Nov 23rd, 2021 at 4:55pm
Print Post  
I'll try that out.

Thanks so much!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint