c# - How to retrieve the data out of a Silverlight DataContext Object -
i have silverlight application collection of form fields , buttons.
i've created method stub handles click event in xaml.cs. when inspect sender during debug, can see base type textblock, , in datacontext object within textblock see custom type's properties. 1 of them guid - sender's type, cast textblock , can see datacontext, not sure how type's field value out of object:
private void sometextfield_mouseleftbuttondown(object sender, system.windows.input.mousebuttoneventargs e) { var datacontext = (textblock) sender; var assetguid = datacontext.datacontext. / // intellsense not show fields, indexers, or getters - says "get or set datacontext fields in datacontext". }
as stated, if debug , place watch on sender, go 2 levels deep can see objects fields.
thanks.
if can see in debug mode, datacontext of textblock needed object, have cast object.
private void sometextfield_mouseleftbuttondown(object sender, system.windows.input.mousebuttoneventargs e) { var datacontext = (textblock) sender; var assetguid = ((yourobject)datacontext.datacontext).getguid() / // intellsense not show fields, indexers, or getters - says "get or set datacontext fields in datacontext". }
you need this, because datacontext defined return value object (datacontext)
is need?
br,
tj
Comments
Post a Comment