Example on how to use static resource(xml) data in xaml and bind it with combo box

<XmlDataProvider x:Key="RuleOperators" XPath="Items">
                            <x:XData>
                                <Items xmlns="">
                                    <Item Label="-- Select --" Value=""/>
                                    <Item Label="Is Equal to" Value="="/>
                                    <Item Label="Is Not Equal to" Value="!="/>
                                    <Item Label="Is Less than" Value="&lt;"/>
                                    <Item Label="Is Less than or Equal to" Value="&lt;="/>
                                    <Item Label="Is Greater than" Value="&gt;"/>
                                    <Item Label="Is Greater than or Equal to" Value="&gt;="/>
                                </Items>
                            </x:XData>
                        </XmlDataProvider>

<ComboBox ItemsSource="{Binding Source={StaticResource RuleOperators}, XPath=*, Mode=OneTime}" SelectedValue="{Binding Value, UpdateSourceTrigger=PropertyChanged}" SelectedValuePath="@Value"  DisplayMemberPath="@Label" />
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s