views:

557

answers:

1

I have a combo box with the following DataTemplate:

<DataTemplate x:Key="ComboBoxDataTemplate">
            <StackPanel>
                <TextBlock Text="{Binding Path='Name'}"/>
                <Path Data="{Binding Path='PathGeometry'}" Width="64" Height="64" Stroke="Black" Stretch="Fill" StrokeThickness="1"/>
            </StackPanel>
        </DataTemplate>

PathGeometry is something simple like 0,1 0,0.5 0.5,0 0,1 (a simple curve). When I select the item in my combo box, the whole silverlight app goes white. An exception is thrown "Value is out of range", which I handle, but then it goes white after that.

Why is the exception thrown? If I remove the {Binding} from the Path tag, and define my own it works fine. It's just the data binding for some reason.

+1  A: 

I haven't exactly found "an answer" for this, but I have found a work around. Rather than building up a property of type PathGeometry, if you change the property to use a String that will work equally well (using the path markup syntax).

Mark Ingram