How to use a custom item template containing a Path tag in a ComboBox (excluding out of range exception)

I have a field 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 as simple as 0,1 0,0.5 0.5,0 0,1

(simple curve). When I select an item in my combo box, the entire silverlight app goes white. An exception is thrown "Value out of range" which I handle, but then it turns white after that.

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

0


source to share


1 answer


I didn't exactly find an "answer" for this, but I did find a job. Instead of creating a property of type PathGeometry, if you change the property to use String, that will work equally well (using path markup syntax).



+1


source







All Articles