Declare a Nullable int (int?) using XAML

Posted by Nate Zaugg on Stack Overflow See other posts from Stack Overflow or by Nate Zaugg
Published on 2010-05-17T15:58:19Z Indexed on 2010/05/18 19:00 UTC
Read the original article Hit count: 503

Filed under:

I am trying to bind a combo box to a property on my ViewModel. The target type is short? and I would like to have null be an option. Basically I would like the value of the first item in the combo box be {x:Null}.

<ComboBox Grid.Row="9" Grid.Column="1" SelectedValue="{Binding Priority}">
            <clr:Int16></clr:Int16>
            <clr:Int16>1</clr:Int16>
            <clr:Int16>2</clr:Int16>
            <clr:Int16>3</clr:Int16>
            <clr:Int16>4</clr:Int16>
            <clr:Int16>5</clr:Int16>
            <clr:Int16>6</clr:Int16>
            <clr:Int16>7</clr:Int16>
            <clr:Int16>8</clr:Int16>
            <clr:Int16>9</clr:Int16>
            <clr:Int16>10</clr:Int16>
</ComboBox>

Any Suggestions?

© Stack Overflow or respective owner

Related posts about xaml