views:

135

answers:

0

Hello,

I want to know if the following in XAML is possible: I have a FlowDocument used for printing. The FlowDocument is bound to a DataSource from which I get the current data. The data is a XML-Document which is also bound to an gui where the Data is inputted. The gui contains some comboboxes with a text-representation of the data-values. In the comboboxes I used selectedvalue to set the selected-element. The list with possible values and text-equivalents is in a separate XML-document. With comboboxes there is no problem to translate the value to text using selectedvalue-property of the comboboxes. But how can i translate a value which comes from a xml-document to a text which comes from another xml-document (in this document there are the value-text-pairs) using Bindings in XAML. Or is it necessary to write a converter. Or is there another way I don't know.

Here are some code-examples i thought about yet:

 <!-- this are my DataProviders -->
 <FlowDocument.Resources>
        <!-- Following contains the Values--> 
        <XmlDataProvider x:Key="xmlFileRes" IsAsynchronous="False"></XmlDataProvider>
         <!--Following contains the Value-Text-Pairs-->
        <XmlDataProvider x:Key="Stammdaten" IsAsynchronous="False"></XmlDataProvider>
 </FlowDocument.Resources>

Element that should contain Text-Values, there are more of these elements. Currently the datasource is bound directly.

    <Paragraph>
   <TextBlock Text="{Binding Source={StaticResource xmlFileRes}, XPath=/form/Kostentrager, Mode=OneWay}"/>
     </Paragraph>

I thought it could be something like that:

<Binding Source="{StaticResource StammdatenFileRes}" 
         XPath="/stammdaten/listen/kostentr[@value={StaticResource xmlFileRes},XPath=/form/Kostentrager}]" />

I would be pleased, if somebody can give me an advice,

Greetings, Martin