.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

XML databinding - accessing attributes of ParentNode from childNode in XAML

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :WPF
Hi All, I would like to get the ParentNode of a given childNode for the xml databinding in XAML. So what should I do ??? For instance: [XML] <Answer           Margin="40,1,1,1"           TabIndex="4"           Name="Answer"           DataType="bool"           Value="N">           <Option             Name="Y"             DisplayText="Yes"             MaxLength="1"             Width="20" />           <Option             Name="N"             DisplayText="No"             MaxLength="1"             Width="

View Complete Post

More Related Resource Links

Accessing Generic Type in XAML

Hello, How can I access a Type with generic parameter in XAML. class SampleClass<T> { } now in XAML: i want to access xmlns:local="Ref to SampleClass" How it will create the instance of SampleClass<T>?

Databinding: Is code behind considered Imperative and is XAML considered Declaritive?

I'm just learning WPF and I wanted to know if databinding via code behind (create binding object, set properties, etc) is considered imperative programming and if the use of XAML extensions is considered declaritive programming.   I know the question is a bit odd, after all, who cares what it's called.  I'm just curious - I need to learn the lingo.  :D

Nested Databinding of Object Accessing Parent Property


I'm wondering if there's a way to access a parent properties in databinding, of if I am going to have to re-write some objects to pass down data.

Pseudo Example:

Cars Generic of Car
Car Properties: Id, Makes

Makes Generic of Make
Make Properties: Id, Name, Models

Models Generic of Model
Model Properties: Id, Name


repeater (datasource = cars)
---repeater (datasource = Makes)
..........<%# Eval("Name") %>
------repeater (datasource = Models)
..................<%# Eval("Name") %>  <%# Eval("??? Make.Id ???") %>

So in the nested repeaters, I somehow need to access the parent's Id. In this example the Make's Id.
Is this possible?

Or do I need to add Property to child objects that refer to the parents?


Databinding a Listbox from XAML not working



I'm trying to bind a Listbox to data.  I am able to do it in the code-behind.  However, I would rather do it in the XAML,  but I can't seem to get it working.

In my code-behind it looks like this:

 Binding myNewBindDef = new Binding("SettingItems");
 myNewBindDef.Mode = BindingMode.OneWay;
 myNewBindDef.Source = manager;
 BindingOperations.SetBinding(AvailableSettings, ListBox.ItemsSourceProperty, myNewBindDef);

That works fine....the manager object has a "SettingItems" property  which is an observable collection.

When I try to do the same in the XAML

<ListBox Name="AvailableSettings" Width="150" ItemsSource="{Binding Source=Manager, Path=SettingItems, Mode=OneWay}" ...etc>

This doesn't work...Any ideas of what I am doing wrong?


Accessing XML attributes in SQL Server


I have  a xml column whose contains data like this:

<?mso-infoPathSolution solutionVersion="" productVersion="12.0.0" PIVersion="" name="urn:schemas-microsoft-com:office:infopath:FormName:-myXSD-2007-09-12T13-38-32" ?>

<?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.2"?>

<my:mesChamps xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml"



I need to select rows where the name attribute

Accessing the different controls inside a GridView control

how we can access a particular control which resides inside a GridView control. In this article I will show you how you can access different controls inside a GridView control. We will see how we can access a TextBox control, a DropDownList control and a ListBox control. If you are working with ASP.NET 1.X then you might want to check out my article Accessing Different Controls Inside a DataGrid.

Accessing SharePoint 2010 Data with Server-Side APIs

Accessing SharePoint data in server-side solutions is one of the most common tasks that you will perform as a SharePoint developer. SharePoint 2010 provides powerful server-side APIs that enable you to retrieve, add, edit, and delete SharePoint data programmatically. SharePoint 2010 also includes the new LINQ to SharePoint technology that enables you to work with SharePoint data efficiently and easily.

What's new in XAML of .NET 4.0

With .NET 4.0 Microsoft will bring up a improved version of XAML. This arcitle shows you the language enhancements they made.
Easy Object References with {x:Reference}

Built-in Types

Generics in XAML with x:TypeArguments

Support for Arbitrary Dictionary Keys

Use of Non-Default Constructors with x:Arguments

Use of Static Factory Methods with x:FactoryMethod

Problem in accessing resource file dynamically.


Steps I have followed are
1.I have created myres.en-GB.resx file at C:.
2.then created locale specific myres.en-GB.resources using resgen at c: only,
resgen c:\myres.en-GB.resx
3.Linked the Resource File to Assembly using AL.exe which is giving me assembly at c: only.
Al /t:lib /embed:myres.en-GB.resources /out:ClassLibrary1.dll
4.I have created one web application using vs 2008 & then build it.
5.Then placed both resource file & dll in web applications Bin\en-GB folder.
6.Anf finally written code at page load like
 CultureInfo info = new CultureInfo("en-GB");
            Thread.CurrentThread.CurrentCulture = info;
            Assembly asd = Assembly.Load("ClassLibrary1");
            ResourceManager res = new ResourceManager("myres.en-GB", asd.GetSatelliteAssembly(info));
            string sdf = res.GetString("Lab1");

but after running application I m getting following error
MissingManifestResourceException", "Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "Cla

Accessing Functions from a Class



I am a PHP developer and am running into a lot of issues with C# and .NET. I would like to be able to do the following in C#. (i'm not sure if it should be done this way though)

C# File:

using System;
using System.Data.Odbc;
using System.Data;
using System.Configuration;

partial class site_functions : System.Web.UI.Page

protected void Main(object sender, EventArgs e)

public static void open_database()
OdbcConnection myConn;
OdbcDataReader MyReader = null;
string strConnection = ConfigurationSettings.AppSettings["dbConnect"];

myConn = new OdbcConnection(strConnection);

public void close_database()

public void Read_Database()
//do something


<%@ Page Language="C#" CodeFile="site-functions.cs" Inherits="site_functions" ContentType="text/html" ResponseEncoding="utf-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "

Custom Attributes + Reflection


I recently started messing around with custom attributes and reflection. In my code below GetCustomAttributes never return a list (it should return atleast one):

Am i defining the custom attrib wrong?

public class GOrder:IOrder
        public string CertProductIDString { get; set; }

        public string GetRESTParams()
            string data = string.Empty;
                System.Reflection.MemberInfo inf = this.GetType();
                object[] attributes;
                attributes =  inf.GetCustomAttributes(typeof(RESTParamAttrib), true);
                foreach (Object attribute in attributes)
                    RESTParamAttrib attrib = (RESTParamAttrib)attribute;
                    data = data + string.Format("\nData: {0}", attrib.Param);

            catch (Exception ex)

                throw ex;

            return data;

    public class RESTParamAttrib:System.Attribute
        public RESTParamAttrib (string param)
            Param = param;

        public string

Office Add-Ins: 3 Solutions for Accessing SharePoint Data in Office 2010


SharePoint 2010 introduces a number of new ways to access business data and present it to the user. We'll show you several options that range from no-code solutions to fully integrated Office add-ins.

Donovan Follette , Paul Stubbs

MSDN Magazine July 2010

Silverlight: Create Animations with XAML and Expression Blend


In this excerpt from his upcoming book, Laurence Moroney explains the basics of Silverlight animation and the animation tools available in Expression Blend.

Lawrence Moroney

MSDN Magazine August 2008

Data Points: Accessing Data from a Mobile Application


This month John Papa takes a look at developing a mobile application that can access data on your application server.

John Papa

MSDN Magazine January 2008

Basic Instincts: Designing With Custom Attributes


One of the most powerful aspects of the Microsoft® . NET Framework is its support for attributes. Attribute-based programming is extremely powerful because it adds a declarative dimension to designing and writing software.

Ted Pattison

MSDN Magazine May 2005

House of Web Services: Accessing Raw SOAP Messages in ASP.NET Web Services


Web Services exchange XML messages. Most of today's Web Service toolkits do their best to hide this fact from developers, by exposing a Web Service's behavior as method invocations against objects instead.

Tim Ewald

MSDN Magazine March 2003

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend