index > Windows Presentation Foundation ("Avalon") > XamlWriter : Does NameScope.RegisterName set x:Name attribute ?

XamlWriter : Does NameScope.RegisterName set x:Name attribute ?

Is that correct to think so ?

are there rules to follow for this to appends ?

public

gumtoo

Parsing x:Name will set a Name property if it exists (setting x:Name and Name are synonomous).

Not all objects have a Name property (or RuntimeNamePropertyAttribute (sp?) pointing to a property)

However, you are trying to modify the object tree such that it will persist with an x:Name.
Since TranslateTransform3D has no RNPA pointing to a property, it can't be persisted in the way you hope.

RegisterName is used when you dynamically add an element to a tree...and it has a name. You need to call RegisterName yourself. It never sets a property on an object...

So, using XamlWriter, I know of no way to do this.

Sorry.

Rob Relyea
WPF Team
http://rrelyea.spaces.live.com

Rob Relyea

thank you Rob, i wanted to be sure i wasn't missing something. i'll try something else.

could you comment on the third case bellow ?

1st case :

> Parsing x:Name will set a Name property if it exists (setting x:Name and Name are synonomous).

this one easy, got it.

2nd case : an winFx app

if i put x:Name on a TranslateTransform3D it is added as a property on the code behind partial class .cs.gs

3rd case : loose xaml, ( this one i don't understand )

if i put x:Name on a TranslateTransform3D and have a storyboard targeting it ( this works).

where the x:Name is registered ?

thanks

gumtoo
the 3rd case ends up call RegisterName, which will find the nearest INameScope (or the implied one at the root of the document) and register the name and its corresponding object.
Rob Relyea
reply 4

You can use google to search for other answers

 

More Articles

• Running application from installer
• Show page in new window with WBA
• Graph Drawing in xaml
• Bug in CollectionView
• Code formatting on Forum
• Property trigger ExitActions
• Text Box instantly updating?
• MenuItem DataTrigger error trying to change Header
• Tables & ItemsControl
• Scroll a ListView to bottom?
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• Problem:"Cannot locate resource 'wi
• WPF Bug or What????
• ComboBox doesn't handle NotifyCollection
• Access a control in datatemplate of a Li
• TextBox sizing inside a stackpanel
• How to use a DataTemplateSelector withou
• MenuItem ItemsSource
• Not able to get "A Visual" fro
• What's the distinction between "c:&
• window allways on top
• How to access ObjectDataProvider resourc
• Doubt Regarding RichTextBox !!
• Can i pass URL query strings from one xa
• Cannot re-initialize ResourceDictionary
• Minimum threshold for the Thumb

Hot Articles

• WPF = 50% C# + 50% XAML?
• Change style/dependencyproperties on chi
• Custom Window
• Feature lag: Binding ConverterParameter
• How do I catch a PropertyChange event in
• Outlook Bar like control in WPF
• FlowDocument and web links
• WPF RichTextBox paste bug ???
• XAMLdev.com - XAML Resources
• ScrollViewer with non scrolling area (fi
• Unified way to add and remove child elem
• How to check if a click was on a transpa
• WPF Architectural Question
• Reusable 3d Control
• Possible bug: Hyperlink in a ListBox doe

Recommend Articles

• WPF Text blurry
• Forms , XAML , Events
• Questions about RenderTargetBitmap
• XAMLPad for June CTP neeeeeeded
• objectdataprovider.refresh()
• Does "System.Windows.Controls.Label
• OnMediaEnded and weird MediaElement.Pla
• How can I make a mouseOver also cause a
• Data Binding and element serialization.
• custom control problems
• RC1 of .NetFx 3.0 released on September
• date picker not available, someone alrea
• Content Loaded Event for FlowDocumentRea
• Items.SourceCollection is not flushed wh
• GridViewColumnHeader: Prevent column reo