Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <stackpanel> // with datacontext set from code to dataset.tables["ord"]
- <TextBox Text="{Binding Something}"/>
- <TextBox Text="{Binding Anotherthing}"/>
- <TextBox Text="{Binding ???}"/> // that's my problem, how to show related Emp.Name
- </stackpanel>
- <StackPanel>
- <StackPanel.Resources>
- <ObjectDataProvider x:Key="ds" ObjectType="{x:Type mynamespace:MyDataSet}" />
- </StackPanel.Resources>
- <!-- We set the data context to the collection of rows in the table -->
- <StackPanel DataContext="{Binding Source={StaticResource ds}, Path=USERS.Rows}">
- <ListBox ItemsSource="{Binding}"
- DisplayMemberPath="NAME"
- IsSynchronizedWithCurrentItem="True" />
- <TextBox Text="{Binding Path=NAME}"/>
- <TextBox Text="{Binding Path=COUNTRIESRow.NAME}"/>
- </StackPanel>
- </StackPanel>
- using System.Data;
- public partial class OrdDataTable : DataTable
- {
- public string EmpName
- {
- get { return this.EmpRow.Name; }
- }
- }
- <TextBox Text="{Binding NAME}"/> //shows correctly current user's name
- <TextBox x:Name="tbC" Text="{Binding COUNTRIESRow.NAME}"/> //doesn't show related country name
- tbC.Text = ds.USERS[0].COUNTRIESRow.NAME;
- BindingExpression path error: 'COUNTRIESRow' property not found on 'object' 'USERSDataTable' (HashCode=6518513)'. BindingExpression:Path=COUNTRIESRow; DataItem='USERSDataTable' (HashCode=6518513); target element is 'TextBox' (Name='tbC'); target property is 'Text' (type 'String')
- <StackPanel>
- <StackPanel.Resources>
- <ObjectDataProvider x:Key="ds" ObjectType="{x:Type mynamespace:MyDataSet}" />
- </StackPanel.Resources>
- <!-- Notice we set the data context to the first item in the array of tables -->
- <StackPanel DataContext="{Binding Source={StaticResource ds}, Path=USERS[0]}">
- <TextBox Text="{Binding NAME}"/>
- <TextBox Text="{Binding COUNTRIESRow.NAME}"/>
- </StackPanel>
- </StackPanel>
Add Comment
Please, Sign In to add comment