.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

Attached Behavior in PRISM - OnDetaching not executing

Posted By:      Posted Date: October 19, 2010    Points: 0   Category :WPF


I have an attached behavior. I'm using it in a PRISM based application, and it is listening to events from the EventAggregator.

Unfortunately the OnDetaching() method does not trigger at all, so I don't know when to Unsubscribe from the PRISM events. This is a problem for me because the behaviors are not getting disposed as the PRISM events are keeping them alive.

Is there a way to find all the attached behaviors on a control, and perhaps iterate over them to dispose them?

If not, any other work arounds?

View Complete Post

More Related Resource Links

Custom Editing Behavior for DataGridView TextBox Columns

For various reasons I'm using a DataGridView instead of a ListView, and while configuring the DataGridView to look like a ListView wasn't much of a problem, there's one thing that got on my nerves, which is the behavior of textbox cells in edit mode: It is much too easy to leave the edit mode accidentally, simply by pressing the cursor keys at the wrong time. For example when the text caret is positioned behind the last character of the textbox cell content, and you press the right arrow key

Run Button Behavior: Suggestion/Bug


Note: This could be a bug or considered as suggestion. I am not looking for solution.

1: I have ImageWatermark.cshtml open and currently in focus.

2: I have Photo1.jpg selected in left Files workspace.

3: Now if I Click "Run", instead of opening ImageWatermark.cshtml it trys to open Photo1.jpg and it fails.

So ideally I would expect the "open file (ImageWatermark.cshtml) to run rather than running the selection from Workspace.

Word Automation - Multiple DCOM Errors/Behavior

Before I get started, I already know that Microsoft does not support and highly discourages server-based MS Office automation.  I've read a multitude of posts and smarmy "*wink*, here's a link" replies, so I'm looking for actual help here, not condescending reprimands.

That notwithstanding, here is my problem.  I have developed a simple method that will open a local Word document, modify some header information, and then save the document as a new file.  As expected, it works great as a console/windows app, but as soon as I went to ASP.NET, DCOM jacked my world up when accessing the app remotely from a different domain account (that has access to the ASP.NET app.  For reference, my method is shown below:


1    public static string ModifyAndSaveBuildDocument(string localFilePath, BuildDocumentType docType, string buildNumber, DateTime buildDate, string projectName)
2            {
3                try
4                {
5                    ProjectConfiguration config = (ProjectConfiguration)ConfigurationManager.GetSection("ProjectConfiguration");

On page loading or executing all CSS flags are ignored and website is plain without formatting


 My problem is whenever i execute my app the first page that loads is the login page pointed to by my web.config file forms authentication, this page is meant to show CSS formatting for the info i am displaying but it is not. Any help with this problem would be great. A cut and paste of my problem is shown below as you can see there is no CSS.

jsfdnjldfngjfg here it is

Account Login
User Id:
Forgot Password?

I have inserted all the link as in:




Silverlight: Composite Web Apps With Prism


This article reviews the Prism project developed by the Microsoft patterns & practices group and demonstrates how to apply it to composite Web applications using Silverlight.

Shawn Wildermuth

MSDN Magazine July 2009

Prism: Patterns For Building Composite Applications With WPF


We introduce you to the benefits of building composite applications with the Composite Application Guidance for WPF from Microsoft patterns & practices.

Glenn Block

MSDN Magazine September 2008

ModalPopup/UpdatePanel from codebehind, inconsistent behavior onClick


First post bear with me please:

I have a simple form with a list of linkbuttons, each fires the same onclick event which sets an indicator image.  I have a dummy button with style="display:none" which I have set as the TargetControlID of the modal.

onClick event from the imagebutton, the modal is shown via modal.Show().  The cancel button inside the modalpopup fires an event which turns off the indicator image and hides the modal via modal.Hide(). 

The events fire perfectly, it's very simple!  Although after doing some testing I noticed the modalpopup is not presented after the 6-10th cycle of clicking the open event, then clicking cancel.  The grey background appears but it is behind the main panel and the modal is either presented behind this or is just simply not displaying. 

I spent hours researching various methods, implemented the CancelControlID to see if it was somehow tied to my call of modal.Hide() that fails.

This occurs with an updatepanel only.  The behaviour is much cleaner this way, so I would hope to be able to implement this.  I have basically eliminated everything but these two events!  Please help

Item cannot be found.(rsItemNotFound) when executing a report from a sharepoint Website

I have managed to integrate Report server with Sharepoint .
I created a report with it's data connection with microsoft Visual Studio 2005 , tested it , than deployed it to the specified document libraries in sharepoint.
Everything works fine till now.But when i try to execute the report from the document library in sharepoint the Message :
  • The item 'Reports/Report1.rdl' cannot be found. (rsItemNotFound) '. Even though the report1.rdl is inside the website and is returned when i do the search. Regards.

  • Using the BDC API how to catch the returned code when executing a stored procedure?

    using BDC API, how can i catch the return code a stored procedure returns?

    I tried Entity.Execute to execute a generic method. However, it returns an empty Entity table.

    I know you can do it by setting up an output variable. I prefer returning an integer for tracking errors.

    Any ideas?



    Executing Command Logic in a View Model

    Through the use of the Windows Presentation Foundation's (WPF) advanced data-binding capabilities, the logical structure of a user interface can relatively easily be disconnected from its presentation. Bindable components can now contain nearly all of an application's user interface logic and in most circumstances, replace the need for controller objects from the classic Model-View-Controller (MVC) pattern. So it's no wonder that a new pattern for UI design has appeared

    Video: SharePoint 2010: Executing Code in the Sandbox

    Find out how the Sandboxed Solutions Service provides for a complete isolation system that ensures code running in a sandboxed solution cannot reach out to access information beyond the scope of the deployment. (Length: 12:01)

    Workflow which is activated when infopath form created but need attached to another costing form als


    I have a requirement to create an infopath form which is simple enough to create and is pretty much done.

    It however has a secret which they didn't really mention in the doc or their "simple workflow requriemetns" and this is  that it goes some where for costing.

    The idea of this is to automate a paper trail so I am thinking that this costing which is to be attached to this document should not simple be an upload onto the form but part of the workflow tasks.

    My questions are.

    If I have the follow workflow requiremetns.


    1. User fill in form and submit

    2. workflow then starts

    3. (cost part next?) one group of people liase with accountants to ensure funding is posible and attach to form. two option I see here.

    opt 1

    The costing part is part of the workflow but if I do this I need the field to be read only for everyone except for a couple of groups is it possible in infopath to do this?

    Opt 2

    The costing is in a different library which the workflow create the new file this has it own workflow with a task to complete it and when completed workflow marks a field as complete before the main workflow will move on to next steps.

    I would need to link the two forms together preferably in both directions would be nice what the best way to do this?

    4 Once costing is co

    Bizzare behavior of Digest authentication with HttpListener.


    While trying to use Digest authentication with HttpListener, I expected it to act fairly close to how Basic does. Basic works fine with no surprises. With Digest, however: 

    1. HttpListener/http.sys driver takes on itself to authenticates user, without even passing request to my code (listener.GetContext() never gets unblocked) so ASP.NET application never has a chance to authenticate the user. I can see responses generated by "Microsoft-HTTPAPI/2.0" with WWW-Authenticate headers. I thought application should have a chance to authenticate the request with Digest user identity in the header. Is it possible to do?
    2. While insisting on Digest-authenticating users on its own, "Microsoft-HTTPAPI/2.0"/HttpListener/http.sys successfully authenticates domain users, but not computer users. I tried user name that includes computer name, realm name, computer name in the FQDN format - nothing works. Why such inconsistency?

    Thank you,


    Case statement is never executing


    Can some please advise as to why the case statement is never running


    Imports Microsoft.VisualBasic
    Imports AjaxControlToolkit
    Public Class MultilevelAccordion
        Inherits System.Web.UI.UserControl
        Implements System.Web.UI.ITemplate
        Dim templateType As AccordionItemType
        Sub New(ByVal type As AccordionItemType)
            templateType = type
        End Sub
        Sub New()
        End Sub
        Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) _
              Implements System.Web.UI.ITemplate.InstantiateIn
            Dim ph As New PlaceHolder()
            Select Case (templateType)
                Case AccordionItemType.Header
                    Dim myLabel As Label = New Label()
                    myLabel.ID = "HeaderLabel"
                    AddHandler ph.DataBinding, New EventHandler(AddressOf Item_DataBinding)
                Case AccordionItemType.Content
                    AddHandler ph.DataBinding, New EventHandler(AddressOf Item_DataBinding)
            End Select
        End Sub
        Shared Sub Item_DataBinding(ByVal sender As Object, ByVal e As AccordionItemEventArgs)
            Dim ph As PlaceHolder = CType(sender, PlaceHolder)
            Dim headerValue As String = _

    Error Executing CLR Stored Procedure "Item has already been added. Key in dictionary"

    Hello, I'm consuming a web service through assemblies in a Sql Server 2005 database. The client was made with VB.net 2005. Everything was fine in the deploy phase but once I compile the assembly generated in my sql server database and try to execute the CLR stored procedure defined in the assembly it crashes throwing the following error: Error: There was an error generating the XML document. Inner Exception: Item has already been added. Key in dictionary: 'SqlCifin.InfoComercial.ParametrosConsultaDTO' Key being added: 'SqlCifin.InfoComercial.ParametrosConsultaDTO' Where SqlCifin is the name of the assembly, InfoComercial is the web reference namespace and ParametrosConsultaDTO is a complex type defined in the WSDL to encapsulate the request parameters. I tried almost everything but nothing seems to work: Already checked the enviroment variables and . I would appreciate any help you can provide me.  PD: I'm using WSE 3.0. Thanks, Andres Diab.
    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