Dharmendra  Singh
Dharmendra Singh

Reputation: 159

Uwp Bind Co-ordinate values using mvvm

 <Viewbox>
    <Grid>
        <Path Stroke="Black"  StrokeThickness="2">
            <Path.Data>                    
                <PathGeometry>
                    <PathFigure  x:Name="UpperCircle" StartPoint="0,150">
                        <ArcSegment IsLargeArc="True"
                            Size="50, 50"
                            Point="300, 150"
                            SweepDirection="Clockwise" />
                    </PathFigure>
                    <PathFigure  x:Name="LeftLine"
                                StartPoint="{Binding StartPoint.X,ElementName=UpperCircle},150"                                    
                                >
                        <LineSegment Point="50,280" />
                    </PathFigure> 
                </PathGeometry>
            </Path.Data>
        </Path>
    </Grid>
</Viewbox>

Hi I want to bind LeftLine X VALUE from Start point of Upper Circle.I have tried using binding but it is not working?

Upvotes: 0

Views: 37

Answers (1)

Anran Zhang
Anran Zhang

Reputation: 7727

{Binding} is a markup extension, a special syntax in XAML. And StartPoint="{Binding StartPoint.X, ElementName=UpperCircle},150" is not XAML-compliant.

Try this:

<PathFigure  x:Name="LeftLine"
        StartPoint="{Binding ElementName=UpperCircle,Path=StartPoint}" 
        >
    <LineSegment Point="50,280" />
</PathFigure>

If you want to know about XAML syntax and Binding, the following documents can help you:

  1. XAML overview
  2. Data binding overview

Best regards.

Upvotes: 1

Related Questions