I have a XamDataGrid and a textbox. I want to display selected data from XamDataGrid to that textbox. I tried by many ways but can't. Please support for me how can I do. I used VB.NET and Datasource : SQL server.
Please give me a sample how to do it.
Below is my Xaml
<Window x:Class="donvi" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="donvi" Height="321" Width="623" xmlns:igDP="http://infragistics.com/DataPresenter" Name="Window1" xmlns:c1grid="http://schemas.componentone.com/wpf/C1DataGrid"> <Grid> <igDP:XamDataGrid Name="XamDataGrid1" ScrollingMode="Deferred" SortRecordsByDataType="True" Margin="0,0,220,28"> <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings AutoArrangeCells="Never" RecordSelectorLocation="None" SelectionTypeCell="None" SelectionTypeRecord="Extended" SelectionTypeField="None" AutoGenerateFields="False" AllowAddNew="False" AllowDelete="False" /> </igDP:XamDataGrid.FieldLayoutSettings> <igDP:XamDataGrid.FieldLayouts > <igDP:FieldLayout> <igDP:FieldLayout.Fields> <!-- ============== --> <!-- Example Column --> <!-- ============== --> <igDP:Field Name="donvi" Label="Don vi" Row="0" Column="1"> <igDP:Field.Settings> <igDP:FieldSettings CellClickAction="SelectRecord" AllowGroupBy="True" AllowEdit="False"> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field> </igDP:FieldLayout.Fields> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> </igDP:XamDataGrid> <TextBox Height="23" HorizontalAlignment="Right" Margin="0,90,58,0" Name="TextBox1" VerticalAlignment="Top" Width="120" /> </Grid></Window>
Thank you for your support
Please, make sure the ElementName is correctly set to the name of the grid. Try to change xamDataGrid1 to XamDataGrid1 and let me know if this will solve the issue:
<TextBox Height="23" HorizontalAlignment="Right" Margin="0,90,58,0" Text="{Binding Path=ActiveRecord.DataItem, ElementName=XamDataGrdi1}" Name="TextBox1" VerticalAlignment="Top" Width="120" />
Thank you for your support.But it's not successful. Below it's my XAML
<Window x:Class="donvi" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="donvi" Height="321" Width="623" xmlns:igDP="http://infragistics.com/DataPresenter" Name="Window1" xmlns:c1grid="http://schemas.componentone.com/wpf/C1DataGrid"> <Grid> <igDP:XamDataGrid Name="XamDataGrid1" ScrollingMode="Deferred" SortRecordsByDataType="True" Margin="0,0,220,28"> <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings AutoArrangeCells="Never" RecordSelectorLocation="None" SelectionTypeCell="None" SelectionTypeRecord="Extended" SelectionTypeField="None" AutoGenerateFields="False" AllowAddNew="False" AllowDelete="False" /> </igDP:XamDataGrid.FieldLayoutSettings> <igDP:XamDataGrid.FieldLayouts > <igDP:FieldLayout> <igDP:FieldLayout.Fields> <!-- ============== --> <!-- Example Column --> <!-- ============== --> <igDP:Field Name="donvi" Label="Don vi" Row="0" Column="1"> <igDP:Field.Settings> <igDP:FieldSettings CellClickAction="SelectRecord" AllowGroupBy="True" AllowEdit="False"> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field> </igDP:FieldLayout.Fields> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> </igDP:XamDataGrid> <TextBox Height="23" HorizontalAlignment="Right" Margin="0,90,58,0" Text="{Binding Path=ActiveRecord.DataItem, ElementName=xamDataGrdi1}" Name="TextBox1" VerticalAlignment="Top" Width="120" /> </Grid></Window>
Hello,
What you can do is bind the text property of the TextBox to the Active Record of the XamDataGrid:
Text="{Binding Path=ActiveRecord.DataItem, ElementName=xamDataGrdi1}"