PDA

View Full Version : Creating a Custom Window in WPF



robf
June 8th, 2009, 06:12 PM
Can someone please provide xaml which could be used to create the simple custom window shown at this url?

http://www.kirupa.com/blend_wpf/custom_wpf_windows.htm

much appreciated!

kirupa
June 8th, 2009, 10:43 PM
Hi Robf,
Have you tried following the instructions in the tutorial? All you have to do is change a few properties and draw rectangles to emulate the shape.

I have another variation of that posted here where source code actually is available: http://blog.kirupa.com/?p=256

Cheers!
Kirupa :)

Lucan Balthasa
July 4th, 2009, 11:25 PM
n the Project panel, locate the file Window1.xaml and expand it to reveal your project’s code-behind file, which is named Window1.xaml.cs. (If you chose Microsoft Visual Basic as the language when you created your project, the code-behind file will be named Window1.xaml.vb.) Double-click the code-behind file to open it for editing. : The code-behind file will open in Microsoft Visual Studio 2008 if it is installed. Otherwise, the code-behind file will open in the application that is mapped to the file extension of the code-behind file. For example, if you have opened a .cs or .vb file in Notepad, Expression Blend will open the file in Notepad. For help opening code-behind files, see Edit a code-behind file (http://msdn.microsoft.com/en-us/library/cc294633.aspx).

In the Window1.xaml.cs file, paste the following class definition source code just before the last closing brace (}) in the file. (For Visual Basic, paste the appropriate code just before End Namespace or just after the last End Class.)
C#

public class ImageButton : Button
{
public ImageSource Source
{
get { return base.GetValue(SourceProperty) as ImageSource; }
set { base.SetValue(SourceProperty, value); }
}
public static readonly DependencyProperty SourceProperty =
DependencyProperty.Register("Source", typeof(ImageSource), typeof(ImageButton));
}

kirupa
July 5th, 2009, 05:01 PM
Lucan - did you intend to post your response to another thread? What you posted seems a bit off-topic.

Cheers!
Kirupa :)