data binding [message #554088] |
Fri, 20 August 2010 03:05  |
Eclipse User |
|
|
|
In the following example I don't know how to write the path to a specific data. e.g. the id of the Property with the name prop1 of the Entity with the name Entity1.
<Composite xmlns="http://www.eclipse.org/xwt/presentation"
xmlns:x="http://www.eclipse.org/xwt" xmlns:j="clr-namespace:testxwt"
xmlns:k="clr-namespace:java.lang" DataContext="{StaticResource MyData}">
<Composite.layout>
<GridLayout numColumns="2" />
</Composite.layout>
<Composite.Resources>
<j:Data x:Key="MyData">
<j:Data.members>
<j:Entity Name="Entity1" Id="1">
<j:Entity.properties>
<j:Property Name="prop1" Id="1" Value="32" Type="String" />
<j:Property Name="prop2" Id="2" Value="27" Type="String" />
</j:Entity.properties>
</j:Entity>
<j:Entity Name="Entity2" Id="2">
<j:Entity.properties>
<j:Property Name="prop1" Id="1" Value="32" Type="String" />
<j:Property Name="prop1" Id="1" Value="32" Type="String" />
</j:Entity.properties>
</j:Entity>
</j:Data.members>
</j:Data>
</Composite.Resources>
<TableViewer Name="DataViewer" input="{Binding Path=members}">
<TableViewer.columns>
<TableViewerColumn width="150" text="Name"
bindingPath="name" />
<TableViewerColumn width="150" text="Id"
bindingPath="id" />
</TableViewer.columns>
<TableViewer.table HeaderVisible="true" />
<TableViewer.control.layoutData>
<GridData horizontalAlignment="FILL" horizontalSpan="2"
grabExcessHorizontalSpace="true" />
</TableViewer.control.layoutData>
</TableViewer>
<Label
text="{Binding ElementName=DataViewer,path=singleSelection.(j:Entity.name)}">
<Label.layoutData>
<GridData horizontalAlignment="FILL"
grabExcessHorizontalSpace="true" />
</Label.layoutData>
</Label>
<TableViewer Name="CompanyViewer"
input="{Binding ElementName=DataViewer,Path=singleSelection.(j:Entity.properties)}">
<TableViewer.columns>
<TableViewerColumn width="150" text="Name"
bindingPath="name" />
<TableViewerColumn width="150" text="Id"
bindingPath="id" />
<TableViewerColumn width="150" text="Type"
bindingPath="type" />
<TableViewerColumn width="150" text="Value"
bindingPath="value" />
</TableViewer.columns>
<TableViewer.table HeaderVisible="true" />
<TableViewer.control.layoutData>
<GridData horizontalAlignment="FILL" verticalAlignment="FILL"
heightHint="200" grabExcessHorizontalSpace="true"
grabExcessVerticalSpace="true" />
</TableViewer.control.layoutData>
</TableViewer>
<Text x:style="SWT.NONE"
text="{Binding Path= the id of the prop1 of Entity1}"
></Text>
</Composite>
Thanks for help
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03142 seconds