Hello,
To simplify my question, I have project with one RadGridView and 2 text boxes. textBox2 is binded to textBox1 and TextBlock inside RowDetailsTemplate is also binded to that same textBox1 exactly same way. Binding to inside RowDetailsTemplate does not work, binding from textBox1 to textBox2 works ok.
Can you please point me what I do wrong?
XAML is:
and the code behind is:
To simplify my question, I have project with one RadGridView and 2 text boxes. textBox2 is binded to textBox1 and TextBlock inside RowDetailsTemplate is also binded to that same textBox1 exactly same way. Binding to inside RowDetailsTemplate does not work, binding from textBox1 to textBox2 works ok.
Can you please point me what I do wrong?
XAML is:
<Window x:Class="WpfApplication11.Window1" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
Title="Window1" Height="371" Width="747" xmlns:my="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"> |
<Grid> |
<Grid.RowDefinitions> |
<RowDefinition></RowDefinition> |
<RowDefinition Height="Auto" MinHeight="19"></RowDefinition> |
</Grid.RowDefinitions> |
<my:RadGridView Grid.Row="0" Name="radGridView1" RowDetailsVisibilityMode="VisibleWhenSelected"> |
<my:RadGridView.RowDetailsTemplate> |
<DataTemplate> |
<StackPanel Orientation="Horizontal" Margin="10,10,10,10"> |
<TextBlock Text="Detail from textBox1 is : " /> |
<TextBlock Text="{Binding ElementName=textBox1, Path=Text}" /> |
</StackPanel> |
</DataTemplate> |
</my:RadGridView.RowDetailsTemplate> |
</my:RadGridView> |
<StackPanel Grid.Row="1" Orientation="Horizontal"> |
<TextBox Width="100" Name="textBox1"></TextBox> |
<TextBox Width="100" Text="{Binding ElementName=textBox1, Path=Text}" Name="textBox2"></TextBox> |
</StackPanel> |
</Grid> |
</Window> |
using System; |
using System.Collections.Generic; |
using System.Linq; |
using System.Text; |
using System.Windows; |
using System.Windows.Controls; |
using System.Windows.Data; |
using System.Windows.Documents; |
using System.Windows.Input; |
using System.Windows.Media; |
using System.Windows.Media.Imaging; |
using System.Windows.Navigation; |
using System.Windows.Shapes; |
using System.Data; |
namespace WpfApplication11 |
{ |
/// <summary> |
/// Interaction logic for Window1.xaml |
/// </summary> |
public partial class Window1 : Window |
{ |
public Window1() |
{ |
InitializeComponent(); |
DataToGrid1(); |
} |
private void DataToGrid1() |
{ |
DataTable myDataTable = new DataTable(); |
myDataTable.Columns.Add("Id", typeof(int)); |
myDataTable.Columns.Add("Model", typeof(string)); |
myDataTable.Columns.Add("Color", typeof(string)); |
myDataTable.Columns.Add("Prize", typeof(double)); |
for (int i = 0; i < 6; i++) |
{ |
myDataTable.Rows.Add(i, "BMW", "Blue", 5700); |
} |
myDataTable.AcceptChanges(); |
radGridView1.ItemsSource = myDataTable; |
} |
} |
} |