Thursday, July 28, 2011

What is the different between a StackPanel and a VirtualizingStackPanel

Although it is easy to understand after you’ve tried to use them. I would like to use others explanation about this question. It may help me easy to recall its difference.

First, the original information comes from stackoverflow.com. I reduced its content for easier and faster reading. Go to the original one if you still don’t know what is it mean.

Wednesday, July 27, 2011

How to Bring Parent Window to Front in WPF application

After you close your child window you always like to have your parent window to present in front of you right away. In Windows Form Applications we can use BringToFront() method to bring your window or control to the front of your screen. How can we do in WFP applications?

There is a easy way to make it happen.

In your parent window set it on focus when the child window is closed. How can we know the child window is closed? Just add a closed even handler to your child window after you introduce it and before you use it.

        private void button1_Click(object sender, RoutedEventArgs e)

        {

            YourChildWindow newChildWindow = new YourChildWindow();

            newChilddWindow.Closed += new EventHandler(newChildWindow_Closed);

            newChildWindow.Show();

        }

 

        void newChildWindow_Closed(object sender, EventArgs e)

        {

            this.Focus();

        }

Tuesday, July 26, 2011

Build an ImageButton in a WFP Project

I found a interest article from one of the MSDN blogs.

Here is a easier way to do it if you are in hurry.

        <Button Name="btnClose" ToolTip="Close" Click="btnClose_Click">

            <Image Source="/MyStudyTool;component/Images/CloseButton.png" />

        </Button>

Related Topics:

Using Attached Properties to Create a WPF Image Button

How to Develop Full Screen WPF Applications

As the topic says, here is the answer.

And this is the best solution that I have tried.

Try this in your Window1.xaml in your Window statement:

WindowStyle = "None" to get a window without border

WindowState = "Maximized" to make the window full screen

How to Use the WebBroswer Control

WebBroswer control could be used in WPF applications and Windows Form applications. However, there are quite difference while you try to apply it to these two type of applications. This document will focus on these difference then the complete usage of them.

If you are more interest in more detail about how the control does please go to the MSDN web site : WebBrowser Control (Windows Forms) , WebBrowser Control (WPF) , WebBrowser Control (Windows Phone 7)

How to prevent someone copy information from your website

The first thing that I want to do when I start my blog is how to prevent someone else copy information from my blog. I did some search on the Internet before I dig in to it. Then I realized there are two things we should do to prevent it happen: disable showing context-menu and disable mouse right click and ctrl + c.