.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

WPF Application Z-Order Bug when closing "nested" dialogs

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

I have encountered a very easily reproduced and exceedingly frustrating bug in WPF when using "nested" dialogs (i.e. windows "owned" by the window that opens them).  Here  is a quick description of a situation that causes the problem:  

MainAppWindow opens WindowA modelessly.  WindowA is owned by MainAppWindow.

WindowA opens WindowB modelessly (or modally, doesn't see to matter).  WindowB is owned by WindowA.

Close WindowB - everything is as expected: WindowA is on top of MainAppWindow and app is in foreground of desktop.

Close WindowA - WindowA closes but MainAppWindow is dropped to background of desktop (i.e. behind any other open applications).

The following simple application demonstrates the problem.  Just click construct 2 nested dialogs them close them in reverse order.  You will need to have another application like notepad in the background so that you can see the WPF app main window get dropped behind it.

To Reproduce:

   - create a new WPF application in Visual Studio (I'm using 2008, sp1) and copy/paste the following code for the Window1.xaml and Window1.xaml.cs files.  I have been able to reproduce this issue on XP, Win7 and Vista.


<Window x:Class="OwnedWindowZOrderIssue.Window1"


View Complete Post

More Related Resource Links

Using an Application Resource in Nested UserControl

Hello This problem has been niggling me for months and I just can't seem to get to the bottom of it. I have a UserControl, let's call it 'UC_List', and the ListBox in it uses a Style which I have declared in my Application.xaml file. When working with UC_List.xaml everything seems fine. I then place 'UC_List' into a UserControl, let's call it 'UC_Summary'. I have declared the namespace at the top of UC_Summary.xaml. The xaml code in UC_Summary now has an Error: Could not create an instance of type 'UC_Summary'. Now I cannot see anything in the Design window, only a warning saying 'Problem Loading, the document contains errors that must be fixed...' However when I run the application everything works fine! After a lot of trial and error I found that the cause of the problem seems to be the Style referenced in the Application.xaml. If I declare the Style in UserControl.Resources at the top of UC_List the error goes away and the graphics in UC_Summary return. I've so far duplicated my Styles into individual UserControls to work around the problem but this could easily lead to inconsistancies. If anyone can suggest anything I would be really pleased to try it. Thank you. Regards Chris

Nested UserControl Render Order

I have a custom control created in codebehind, and I have in the same control an ordinary asp.net button. Like this: protected void Page_Load(object sender, EventArgs e) { } private void MyTable() { Table table = new Table(); TableRow row = new TableRow(); TableCell cell = new TableCell(); CheckBox check = new CheckBox(); check.ID = "theId"; check.Text = "My Check"; check.AutoPostBack = true; cell.Controls.Add(check); row.Cells.Add(cell); table.Rows.Add(row); this.Controls.Add(table); } protected override void CreateChildControls() { MyTable(); base.CreateChildControls(); } And in the asmx something like this:<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MyUserControl.ascx.cs" Inherits="Tester.MyUserControl" %> <asp:Button ID="Button1" runat="server" Text="Button" /> ok... now. When I render my control it looks like: [BUTTON] [ ] My Check But I really need that the button render after the checkbox. Any idea how can I do that?

Closing down a mdb database properly for .net application

Hi I designed a simple database with 2 tables using MS SQL Express 2008 which I tried to open using MS C# Express 2008 but when I try to set up the Database Connection using the Database Connection Wizard I get error := The file cannot be opened because it is being used by another process. Please close all applications that might access this file and try again. I even Disconnected the Instance in SQLExpress Instance before closing down MS SQL Express 2008. If a reboot the PC then I can use the Database Connection Wizard from c# (but I don't want to have to reboot my PC as its annoying). Does anyone have the simple answer please. Thank you Matthew

The type initializer for 'Nested' threw an exception for BDC USING Application Definition Designer



Is anyone know what this error could mean?

The type initializer for 'Nested' threw an exception.

when i am executing instance method using "Application Definition Designer" for BDC.

Same ADF file works fine locally but getting above error message when executing on server.(both sharepoint are different) and install on different machines.

When executing BDC catalog file in sharepoint. We are getting below error message.

An error occurred while retrieving data from CustomerBDC_Instance. Administrators, see the server log for more information.

Event log:

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

- <System>

<Provider Name="Office SharePoint Server" />

<EventID Qualifiers="0">5703</EventID>




<TimeCreated SystemTime="2010-10-22T12:20:39.000Z" />



<Computer>[LOCAL COMPUTER ADDRESS]</Computer>

<Security />


- &l

Cleanup when closing the application



I am developping a Silverlight Application that receive WCF callback notification.

So when the user loads the control, it automatically subscribes to a WCF service.

Now I would like to Unsubscribe automatically when the user leaves this page or close the browser.

Is there a Silverlight Event raised allowing to unsubscribe automatically?



Dialogs and ViewModel - Using Tasks as a Pattern

The ViewModel/MVVM pattern continues to gain popularity, with a blog post showing up every so often, and with tweets and retweets popping up even more often :-). At the same time, there are some interesting topics beyond the core pattern that continue to fuel experimentation. A big one amongst those is how should applications use dialogs when using the view model pattern.

The crux of the problem is the desire to keep the view model independent of UI concerns, and ensure it can be tested in a standalone manner, but that often comes to odds when you want the view model to launch a dialog, and/or do some work after the dialog is closed.

Microsoft's Collaborative Application Markup Language (CAML) Loop

discovered an interesting error recently while working with Microsoft's Collaborative Application Markup Language (CAML) that, surprisingly, had received no ink. Partly what surprises me about this is that the error may require you to rewrite large sections of your code if you haven't previously considered this SharePoint limitation. I'll start with some context, but first of all the error is:

Integrating a Legacy Web Application in SharePoint

This month we will continue with the theme of deploying Microsoft's SharePoint as a company intranet by describing a method for integrating a legacy Web application inside a SharePoint site.

In many companies the intranet site is not just a home page with announcements. It houses Web applications used by many different departments. In last month's article, I built a page to search the employee table in Northwind (the sample database included in Microsoft's SQL Server). This month, I will move the Web pages used to add/remove records from the table into the SharePoint intranet.

MVC architecture in ASP.Net using C# and Microsoft Data Access Application block

The Model-View-Controller (MVC) pattern separates the modeling of the domain, the presentation, and the actions based on user input into three separate classes [Burbeck92]:

Model. The model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller).

View. The view manages the display of information.

Controller. The controller interprets the mouse and keyboard inputs from the user, informing the model and/or the view to change as appropriate.

High-Performance .NET Application Development & Architecture

It has always been a goal of project architects to plan an effective strategy from the ground up in regards to an new application. All relevant factors are taken into consideration with respect to the application, from its design and layout to a functional website infrastructure. Pre-.NET strategies and design guidelines still effective now were developed with Microsoft's DNA (Distributed interNet Application) platform. This model successfully served the purpose of architecting N(any number of)-Tier (levels) applications. In its basic sense, as in most robust, distributed applications, you'll architect 3 main layers or Tiers: presentation, business rules and data access.

Application architecture in asp .net

Application Architecture is the most important process of developing a good application. Some people tends to jump into coding without any architecture laid. Later we see those people changing the architecture and finally the application had to be developed from the scratch with the correct architecture.

In this article I will describe some details about how you can improve the architecture of you application. This article is targeted to the beginner's audience.

Improving Application Performance in .Net

Application performance has always been a concern for Web Application developers. This article contains guidelines and tips for maximizing application performance in ASP.NET.

Logic behind N -Tier Application Development

In the arena of application development, developers all over the world use various programming languages, technical processes, and technical tools. While using number of technical & non technical elements the processes or methods become complex, for simplification of the application development process, developers use various techniques such as dividing the application architecture into layers or parts. In the professional & technical language this separation or division process is called N-Tier Application Development process, where "N" stands for number and "tire" stands for layers or parts.

How to create 3 tier application using LINQ

As you know that in 3 tier architecture there are three layers

User interface layer. (Is our Form in Windows application and .aspx page in Web application)
Data Access layer. (Which provides interface between Business logic layer and Database)
Business Logic layer.(Which stores your application logic)

Using Lightbox in an ASP.NET Application

The article describes Lightbox as, "... a simple, unobtrusive script used to overlay images on the current page." It delivers a nice, professional looking method for displaying images as overlays through the use of hyperlinks.

Application Architecture: An N-Tier Approach - Part 1


Free Trial: SQL Backup Pro
Sponsored by Red Gate
Exceptional DBAs make the most of their office hours. That's why they love Red Gate SQL Backup Pro. Its faster, smaller, secure SQL Server backups mean more time spare to accomplish more tasks and professional training. Make time to be an Exceptional DBA. Download it now! »

Free Trial: SQL Toolbelt
Sponsored by Red Gate
The SQL Toolbelt is a set of twelve powerful and intuitive tools that will help you burn through SQL Server chores with astonishing speed and accuracy. Download it now! »

Download: SQL Backup Evaluation Center
Sponsored by Red Gate
Download the T-SQL scripts in the SQL Backup Evaluation Center to compare Red Gate SQL Backup Pro's compressed backups with the size of backups created using native SQL Server. Download it now! »

Autodesk Inventor®
Go Beyond 3D To Digital Prototyping With Autodesk Inventor. Learn How.
Virtualization Solutions
Optimize, Simplify, & Save Today. Learn About Microsoft Solutions.
Microsoft SQL Server® 2008 - Free Trial
Download the Free 180-day Trial of SQL Server® 2008 Enterprise Edition!
Hot Careers in Internet Marketing
Get prepared for your new career with online degrees from Full Sail University!
Microsoft Te

Solidify Your C# Application Architecture with Design Patterns

design pattern can solve many problems by providing a framework for building an application. Design patterns, which make the design process cleaner and more efficient, are especially well-suited for use in C# development because it is an object-oriented language. Existing design patterns make good templates for your objects, allowing you to build software faster. This article describes several popular design patterns you can use in your own applications, including the singleton, the decorator, the composite, and the state classes, which can improve the extensibility of your applications and the reuse of your objects.
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