locked
PathFigure XAML Binding RRS feed

  • Question

  • Hello all,

    Currently I'm working in a WPF application where there is a particular windows where I will have some Canvas containing a PathFigure. This PathFigure is a public property of one of my business logic objects (PieceShape property)

    I'm having some difficulties to propery bind this property to the Canvas. Here is what I'm performing:

                                        <Canvas Height="48" Width="48" Background="AliceBlue">
                                            <Canvas.Children>
                                                <Path Stroke="Red" StrokeThickness="1">
                                                    <Path.Data>
                                                        <PathGeometry Figures="{Binding PieceShape, IsAsync=True}">
                                                            
                                                        </PathGeometry>
                                                    </Path.Data>
                                                </Path>
                                            </Canvas.Children>
                                        </Canvas>
    Besides I'm not getting any compilation or exception in the application, the path is not shown in the canvas, and in the XAML editor I get an "Object Reference not set to an instance of an object".

    If I remove the Binding for the code above, I got no messages from the editor.

    What am I missing here?

    Thanks in advance,

    Igor
    Project Manager at INOVATIVA Tecnologia www.inovativatec.com
    • Moved by Jay_WangMicrosoft employee Monday, February 22, 2010 9:32 AM Designer issue (From:Windows Presentation Foundation (WPF))
    Thursday, February 18, 2010 12:48 PM

All replies

  • Hello all,

    Currently I'm working in a WPF application where there is a particular windows where I will have some Canvas containing a PathFigure. This PathFigure is a public property of one of my business logic objects (PieceShape property)

    I'm having some difficulties to propery bind this property to the Canvas. Here is what I'm performing:

                                        <Canvas Height="48" Width="48" Background="AliceBlue">
    
                                            <Canvas.Children>
    
                                                <Path Stroke="Red" StrokeThickness="1">
    
                                                    <Path.Data>
    
                                                        <PathGeometry Figures="{Binding PieceShape, IsAsync=True}">
    
                                                            
    
                                                        </PathGeometry>
    
                                                    </Path.Data>
    
                                                </Path>
    
                                            </Canvas.Children>
    
                                        </Canvas>
    
    
    Besides I'm not getting any compilation or exception in the application, the path is not shown in the canvas, and in the XAML editor I get an "Object Reference not set to an instance of an object".

    If I remove the Binding for the code above, I got no messages from the editor.

    What am I missing here?

    Thanks in advance,

    Igor
    Project Manager at INOVATIVA Tecnologia www.inovativatec.com

    The bound PieceShape property I was using in fact as a List<PathFigure>. In changed that to be a PathFigureCollection object. Now, the application runs propery when i execute it, but in the WPF Designer on VS 2010 RC, I stil get this exception:

    NullReferenceException was thrown on "DataTemplate": Object Reference not set to an instance of an object.

    at Microsoft.Expression.DesignModel.Core.PathGeometrySerializationHelper.GetPathFigureCollectionAsString(DocumentCompositeNode pathFigureCollectionNode, StringBuilder stringBuilder) at Microsoft.Expression.DesignModel.Core.PathGeometrySerializationHelper.GetPathGeometryAsString(DocumentCompositeNode pathGeometryNode) at Microsoft.Expression.DesignModel.Core.PathGeometrySerializationHelper.SerializeAsAttribute(DocumentCompositeNode compositeNode) at Microsoft.Expression.DesignModel.Core.DefaultXamlSerializerFilter.GetValueAsString(DocumentNode node) at Microsoft.Expression.Platform.WPF.InstanceBuilders.DocumentNodeObjectReader.GetString(DocumentNode node) at Microsoft.Expression.Platform.WPF.InstanceBuilders.DocumentNodeObjectReader..ctor(DocumentNode root) at Microsoft.Expression.Platform.WPF.InstanceBuilders.FrameworkTemplateInstanceBuilder.InstantiateTemplate(IDocumentRoot xamlDocument, TemplateSerializerContext context) at Microsoft.Expression.DesignModel.InstanceBuilders.FrameworkTemplateInstanceBuilderBase`7.Instantiate(IInstanceBuilderContext context, ViewNode viewNode) at Microsoft.Expression.DesignModel.Core.ViewNodeManager.Instantiate(ViewNode viewNode)

    Any clues?

    Regads,

    Igor.


    Project Manager at INOVATIVA Tecnologia www.inovativatec.com
    Friday, February 19, 2010 11:31 AM