Questions tagged [xname]

26 questions
8
votes
1 answer

How can I get the x:Name of an object from code?

Given a reference to an object defined in XAML, is it possible to determine what (if any) x:Name the object has, or can I only do this by accessing the FrameworkElement.Name property (if the object is a FrameworkElement)?
devios1
  • 36,899
  • 45
  • 162
  • 260
6
votes
1 answer

Accessing controls using C# code behind in Xamarin.Forms

I can't access a label defined in the xaml file from the code behind C# code. I tried the x:name="l" property but it tells me that "'l' is not defined": Could anyone help me how to access controls from C# code behind by providing an example?
Yossef Nagy
  • 409
  • 1
  • 7
  • 12
4
votes
3 answers

How to get an XElement with special characters in XML tag

I have an XML document I'm trying to traverse, which is SDMX-compliant. Here's a short sample: 107.92 However, when I…
jehuty
  • 528
  • 1
  • 6
  • 20
4
votes
1 answer

Code-behind can't find control declared in XAML

After googling for sometime, x:Name should be a solution to my problem. In my wtfapp.xaml there is a TextBlock that will be created during runtime: In the code-behind, it should be accessible so I…
Wahyu
  • 4,203
  • 1
  • 19
  • 21
4
votes
2 answers

What does the x: thing in WPF serve for?

I've seen it a lot and I don't know what it means. I'd say it has something to do with namespaces? I've already googled it but it wasn't clear to me what it's purpose is. Could anyone explain what it is and in which situations it is usually…
devoured elysium
  • 101,373
  • 131
  • 340
  • 557
3
votes
3 answers

XDocument.Descendants(itemName) - Problems finding qualified name

I'm trying to read a XML-RSS-Feed from a website. Therefore I use a async download and create a XDocument with the XDocument.Parse() Method. The Document intends to be very simple, like this:
dognose
  • 43
  • 1
  • 4
2
votes
1 answer

Silverlight & JS: Get the Name or uid from XAML, through Javascript

I am trying to obtain the element from my Xaml, through Javascript, so I can add new elements to it at runtime. This way, if a user inputs the number '20', then 20 elements will be added to…
2
votes
2 answers

Access inner element in the ControlTemplate

Here goes my code:
AgentFire
  • 8,944
  • 8
  • 43
  • 90
1
vote
0 answers

Enforce x:Name for certain UserControls?

My department has started using Ranorex for automated GUI test about a year ago. In order to work corrently, Ranorex will have to identfy certain UserControls for which we are using a PreBuild event in our projects that makes sure that basically…
Ralf
  • 293
  • 5
  • 15
1
vote
2 answers

Can I get access from code behind (of a ResourceDictionary) to a named control?

Is it possible to get access from a code behind (of a ResourceDictionary) to a named control? E.g. for me it is necessary to create lots of folder picking dialogs. A dialog may contain several rows for each folder that has to be chosen. Each row…
1
vote
1 answer

x:Name in XAML WPF - Visual Studio Community 2017 BUG

I have used Visual Studio Community 2015 and there was no problem. Since I updated to 2017...well...there is some issues... When I drop new object to grid in WPF...no default name...both in the property window and the XAML code...mostly I design…
panzer
  • 133
  • 9
1
vote
1 answer

How to use a public method in a custom control without using x:Name

I have my custom control MyControl, which has a public method Start(). public partial class MyControl : UserControl { // This must be private. private int _idNumber; public MyControl() { InitializeComponent(); } …
user4134476
  • 385
  • 4
  • 22
1
vote
1 answer

Loop down multiple controls/elements in C# (Store App)

I have multiple images that I want to loop over and set properties of. Snippet from the xaml, as you can see their names follow up: Life1, Life2, ...
Glenn
  • 635
  • 2
  • 11
  • 23
1
vote
1 answer

XName x = "string"?

I forgot casting mechanism when i encounter it :) . So can u make me remember it again ? Because it looks not acceptable for me at the moment.
Freshblood
  • 6,285
  • 10
  • 59
  • 96
1
vote
1 answer

Secondary xmlns on the child element of my XML

I am creating an xml file and trying to append the Namespace to the root Node. doc = new XDocument(new XElement(XName.Get("urlset", "http://www.sitemaps.org/schemas/sitemap/0.9"), However, when I do this it appends an empty namespace on the…
1
2