Silverlight pop-up Window--show

Source: Internet
Author: User
Tags silverlight

Background

Years later came to the company internship, there is no project in the first week, there is nothing to do, at this time a senior and I said that they have a system based on Silverlight developed, and the use of pop-up windows there are many problems, so if you can, I would like to make a pop-up window function, Its child elements can be any of the custom controls.

I am very happy to enter the company only a few days to have such a task, every time I go to different companies internship, it's always a very short time to be "entrusted with the task (more of my own narcissism, of course)" for the development of the infrastructure available, thanks to all the companies that have been so trusting and able to see me since sophomore year, I think only in such an environment can do all the best ...

Anyway, this is the case with this task, so how much knowledge do I have about Silverlight? The answer is, 0. People who know me know that I am very, very not art-level, so for almost all the foreground development of the technology are at a respectful distance, and such a novel Silverlight is to make me look and timid.

But this is the case, just enter the company can not say I will not do, so I bite the bullet, the end result is this:

First of all, half a day to hold the Silverlight model, including the understanding of the XAML syntax such as DependencyProperty, Attachedproeprty, and so on, basically familiar with the relevant APIs, as for the control tree and other ideas, WinForm and WebForm are basically the same model, so they are relatively fast to know.

Then with half a day of time, toss out a pop-up window prototype, looks really quite comfortable, pop-up a window and then close, pop-up two windows again successively closed, and did not appear particularly big problems

Then, in 5 minutes, found that this thing is not perfect, there are a lot of problems, so from the architectural completely down the previous work, it is obvious that my implementation is based on a wrong design, and therefore need to redesign the entire model and to implement again

After half a day's effort, finally has a more ideal design, and completed this version of the implementation

Our choices

We have a variety of options in Silverlight for features like pop-up windows, before introducing my work, let's look at the pros and cons of the choices

Select 1:messagebox

It is true that there is a mesasgebox in Silverlight, as in WinForm, call MessageBox.Show, but there are a lot of problems, of course, before we have to look at the good side

Advantages: MessageBox is synchronized, that is, the Show method call can directly get the return value, synchronous programming in simplicity compared to asynchronous programming has a very big advantage, so it can be a good choice

Disadvantages: Know why each JS framework to a MessageBox Mody, is because of alert this thing is too ugly, and now we face more gorgeous Silverlight application, in the feast for the eyes while enjoying, do not have to see A and alert window a The same guy pops up and disappears?

Select 2:popup

Popup is a control provided by the Silverlight base class library that can complete the pop-up functionality directly

Advantages: Simple to operate, can be expressed in XAML, encapsulated pop-up features, style customizable, as an official solution is very powerful

Disadvantage: According to the predecessor, the popup contains a DataGrid and other complex controls, there will be bugs appear, this is the need for me to do a full pop-up window out of the main reason ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.