Question

I have a working MultiBinding with a Path.Data (Path here is System.Windows.Shapes.Path). The Converter return type is System.Windows.Media.PathGeometry.

<Path.Data>
  <MultiBinding Converter="{StaticResource ResourceKey=ToPathGeometryMultiConverter}">
    <Binding Path="A"/>
    <Binding Path="B"/>
    <Binding Path="C"/>
  </MultiBinding>-->
</Path.Data>

Now I want to change the structure a bit and add several geometries in a GeometryGroup. I don't know the syntax how to add MultiBinding here.

<Path.Data>                    
  <GeometryGroup>       
    <PathGeometry> 
     <!-- HOW CAN I MULTIBIND HERE --> 
    </PathGeometry>
  </GeometryGrounp>
<Path.Data>

Whatever I tried I always got a compile error.

Was it helpful?

Solution

You may bind the PathGeometry.Figures property and have a converter that returns a PathFigureCollection, but I'm afraid you have to live with the fact that the VS Designer complains about the XAML.

<Path.Data>
    <GeometryGroup>
        <PathGeometry>
            <PathGeometry.Figures>
                <MultiBinding Converter="{StaticResource PathFiguresConverter}">
                    <Binding Path="A"/>
                    <Binding Path="B"/>
                    <Binding Path="C"/>
                </MultiBinding>
            </PathGeometry.Figures>
        </PathGeometry>
    </GeometryGroup>
</Path.Data>

OTHER TIPS

You can try to put your binding code instead of PathGeometry tags

<Path.Data>                    
    <MultiBinding Converter="{StaticResource ResourceKey=ToPathGeometryMultiConverter}">
       <Binding Path="A"/>
       <Binding Path="B"/>
       <Binding Path="C"/>
    </MultiBinding>  
<Path.Data>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top