Questions tagged [elementname]

Gets or sets the name of the element to use as the wpf binding source object.

Binding.ElementName Property is useful when you want to bind to the property of another element in your application.

37 questions
69
votes
6 answers

ElementName Binding from MenuItem in ContextMenu

Has anybody else noticed that Bindings with ElementName do not resolve correctly for MenuItem objects that are contained within ContextMenu objects? Check out this sample:
Josh G
  • 14,068
  • 7
  • 62
  • 74
39
votes
2 answers

Getting element's name in XPATH

If I selected an element using XPATH how can I get its name? I mean something like text() function in //element/[@id=elid]/text().
Ariyan
  • 14,760
  • 31
  • 112
  • 175
20
votes
2 answers

Binding ElementName. Does it use Visual Tree or Logical Tree

Having {Binding ElementName=foo}, will it lookup visual or logical tree? Of logical and visual trees in WPF | Data See, Data Do When does the logical tree matter? When looking up a name, such as in {Binding ElementName=Foo}, the search walks up…
alex2k8
  • 42,496
  • 57
  • 170
  • 221
20
votes
3 answers

ElementName vs. RelativeResource?

What of the following TextBlocks' Bindings costs more performance:
Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632
13
votes
3 answers

Differences between ElementName="" and RelativeSource self?

What are the differences between making a binding self-referential via name versus self-referential via RelativeSource? For example:
Greg D
  • 43,259
  • 14
  • 84
  • 117
7
votes
2 answers

Jquery - Finding what element $(this) is

Possible Duplicate: Can jQuery provide the tag name? Hi! This question is so basic i am ashamed asking but i tried to find the answer for 30 minutes without any result. How do i find out what kind of element has been clicked in the code…
Marreone
  • 117
  • 1
  • 3
  • 7
5
votes
2 answers

How add named element to R vector with name from a variable

I want to add an element, say 100, to vector V and use the value of variable x as the new element's name. I know it can be done like this: V = c(V, 100) names(V)[length(V)] = x but I'm looking for an easy single-line solution, if there is one. I…
tedtoal
  • 1,030
  • 1
  • 10
  • 22
5
votes
1 answer

RelativeSource works on (nested) sub-property, while ElementName does not

The problem with the code below is: the binding to SomeClassProp.SubTextProp doesn't work (the source property is not being set to textbox content), while to TextProp it does. XAML:
lxa
  • 3,234
  • 2
  • 30
  • 31
4
votes
2 answers

Cannot find source for binding with reference

I want to bind my MultiDataTrigger.Conditions to radio button, but it's not working. here is my scenario. In wpf, I have a GridPanel, which suppose to have radiobuttons in it. I generate dynamic radiobuttons into GridPanel, like this: RadioButton…
VHanded
  • 2,079
  • 4
  • 30
  • 55
3
votes
1 answer

Add Attribute to XMLROOT ElementName

I have a class with the class attribute : [XmlRoot(ElementName = "RootXML")] public class Apply { /My Properties } now to create an xml from the above class I use below function : public virtual string RenderXml() { XmlTextWriter writer =…
Zaki
  • 5,540
  • 7
  • 54
  • 91
2
votes
2 answers

Binding a DataPager to ComboBox?

I have a comboxbox defined like this (basically): 5 10 20
AlvinfromDiaspar
  • 6,611
  • 13
  • 75
  • 140
2
votes
1 answer

Silverlight binding errors in the output window

I know that if there's an issue with the Path attribute in my binding expression, I'll get a binding error message in my output window, but is there anyway to debug a ElementName attribute issue? I have tried things that I'm pretty sure don't exist…
MStodd
  • 4,716
  • 3
  • 30
  • 50
2
votes
0 answers

Adding x:Name causes compilation error "Type name *** does not exist"

I am running into an issue when I try to add thex:Name attribute to a custom user control. Here is the code of the user control which overrides the ListView item to provide sorting when the user clicks the column…
BrianKE
  • 4,035
  • 13
  • 65
  • 115
2
votes
1 answer

How to set ElementName and Path on a DataTrigger from a separate XAML resource dictionary (a different file)

I have a textbox surrounded by a border with rounded corners. They both have the same background color to make them appear as a single data entry box. When the user clicks in the textbox, the background of the textbox and the border change color.…
2
votes
1 answer

Value from Binding ElementName producing empty string

I have a Datagrid which has a DataGridTemplateColumn containing a ListView whose Itemsource is bound to an array of string. Within that ListView I have defined an ItemTemplate as I want the Foreground of each item in the list to be dependant on…
Sakuya
  • 660
  • 5
  • 23
1
2 3