Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
350
Switching Datasources
posted

Hi,

on application startup a xamDataGrid is bound to static resource:

<Grid.Resources>
    <XmlDataProvider x:Key="Data" XPath="/Ntn">
        <x:XData>
            <Ntn xmlns="">
                <Note GridHeaderSA="SA" GridHeaderKA="KA" GridHeaderEx="Ex" GridHeaderM="M" />
            </Ntn>
        </x:XData>
    </XmlDataProvider>
</Grid.Resources>

This xmlDataProvider is bound as datasource:

<igDP:XamDataGrid DataSource="{Binding Source={StaticResource Data},XPath=Ntn}" />

At runtime data is gathered and loaded into an ObservableCollection and this collection is bound to the xamDataGrid:

Me.gridNtn.DataSource = myDataCollection

Now would like to create the following behaviour:

If data is loaded correctly, i would like to view this in the grid. If loading fails, the grid should "fallback" to the static resource. But how to do this in Code?

In short terms: is it possible to bind a xamDataGrid to static resource in code?

thanks in advance

Stephan