Priyank Thakkar
Priyank Thakkar

Reputation: 4852

Element Name Attribute in WPF Databinding

What is the use of element name attribute in WPF databinding.

e.g.

<Window x:Class="WpfApplication1.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300" Name="win">
    <TextBox x:Name="txtData" width="100" height="26" Text={Binding ElementName=win,Mode=TwoWay,Path=Data}/>
<Window>

Regards, Priyank Thakkar

Upvotes: 0

Views: 1265

Answers (1)

devdigital
devdigital

Reputation: 34369

It's for binding to another element in your application - see http://msdn.microsoft.com/en-us/library/system.windows.data.binding.elementname.aspx

In your case you are attempting to bind to the Window element with the name win.

Upvotes: 1

Related Questions