Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background Image of Vertex #103

Open
josse995 opened this issue Aug 2, 2019 · 3 comments
Open

Background Image of Vertex #103

josse995 opened this issue Aug 2, 2019 · 3 comments
Labels

Comments

@josse995
Copy link

josse995 commented Aug 2, 2019

Hello everyone!

I am trying to set an image as background of a vertex, but I don't find how to do it.
It is possible to do this? If it is possible, how could I do it?

Thanks!

@panthernet
Copy link
Owner

Hi, you should change the VertexControl template in XAML.
This is the default template:

    <Style TargetType="{x:Type graphx:VertexControl}">
        <Setter Property="Background" Value="#FFE3E3E3"/>
        <Setter Property="BorderThickness" Value="5,3,5,3"/>
        <Setter Property="Padding" Value="10,5,10,5"/>
        <Setter Property="BorderBrush" Value="#FF393939"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type graphx:VertexControl}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            CornerRadius="10,10,10,10"
                        Padding="{TemplateBinding Padding}">
                        <Grid>
                            <ContentPresenter Content="{TemplateBinding Vertex}" />
                            <graphx:VertexLabelControl x:Name="PART_vertexLabel" Content="{Binding Vertex, RelativeSource={RelativeSource TemplatedParent}}" />
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="graphxRoot:GraphAreaBase.PositioningComplete" Value="False">
                <Setter Property="Visibility" Value="Hidden"/>
            </Trigger>
        </Style.Triggers>
    </Style>

@josse995
Copy link
Author

Thank you for the reply!
Thanks to you response, I started thinking that VertexControl is like a container, and then, I find out easy to add whatever you want!

Thank you for your hard work!
(Sorry for the late response BTW :( )

@panthernet
Copy link
Owner

np, have fun!

@panthernet panthernet added the FAQ label Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants