Welcome Guest!
 VB Helper Q & A
 Previous Message All Messages Next Message 
RE: Content in WPF  Rod Stephens
 Aug 19, 2009 06:29 PDT 

    1/ Trying if I could change some controls properties at run time, I
   changed the Text property (Caption ) of a Button : Button1.Content
   ="Hello". When I tried this to the window : Me.Content ="Hello", it
   erased all controls and write "Hello" on the top left corner.

What does that mean, and how can I change the Text property for the
Window like we do with forms?

The Content property usually means the main content of a control. In the
case of a Window, it means the controls contained in it so if you reset
the Window's Content property, it replaces the Window's main child,
which holds all of the other controls and everything disappears as you

Try changing the Window's Title property instead.

 2/ What means the statment in the yellow band that appears in the top of
Window1.xaml which says " An assebly or ..." and asks to click to

The yellow band that says "Click to reload" means Visual Studio is
confused. If you click the yellow band, it will try to reload the XAML
code and display the interface.

Unfortunately it gets confused pretty easily and doesn't automatically
try to reload when you make changes to the code.

I'm not sure what your specific error message means. If you post the
whole text of the message, we may be able to give you a better idea of
how to fix it, although the messages are often pretty vague and you can
learn more by thinking about what changes you made last.

 3/ I have built many controls with VB 2005, that I used in my
applications. Is there a way to use them with WPF or I have to rebuild
all of them?!

You should be able to host them in a WindowsFormsHost object. It's a WPF
control that sits on your WPF window and that can contain a Windows
Forms control. See these links:



It's not perfect but it should give you a relatively easy way to reuse
those controls.


Rod Stephens, Visual Basic MVP

Beginning Database Design Solutions

Visual Basic 2008 Programmer's Reference
 Previous Message All Messages Next Message 
  Check It Out!

  Topica Channels
 Best of Topica
 Art & Design
 Books, Movies & TV
 Food & Drink
 Health & Fitness
 News & Information
 Personal Finance
 Personal Technology
 Small Business
 Travel & Leisure
 Women & Family

  Start Your Own List!
Email lists are great for debating issues or publishing your views.
Start a List Today!

© 2001 Topica Inc. TFMB
Concerned about privacy? Topica is TrustE certified.
See our Privacy Policy.