Welcome Guest!
 VB.NET Helper
 Previous Message All Messages Next Message 
VB .NET Helper Newsletter  Rod Stephens
 Dec 19, 2008 15:49 PST 

Building the VB Helper bookstore (http://astore.amazon.com/vbhelper) was
pretty fun so I built another one for recreational reading: Books To
Keep (http://www.bookstokeep.com).

It lists some of my personal favorites. Most of them are creative,
silly, or deal with unusual concepts.

If you have a chance, take a look and let me know what you think. If you
find you like the same kinds of books I do, there's plenty there to keep
you busy for a while.

I'm a bit restricted on the site's design (Amazon's tools built it) but
I'm always happy to listen to feedback.
-----
Sorry to spam the VB 6 only people with XAML examples. You really need
.NET (at least the Framework) to display XAML pages but in theory at
least you could build them without learning .NET.

(And you need one of the newer flavors of VB .NET to build WPF
applications.)

These really belong in a new category of newsletter but I don't really
want to make another one (three is plenty).

Unless someone objects, I'll probably include XAML-only examples in both
the VB 6 and .NET newsletters and put other WPF content in the .NET
newsletter only.
-----
I found some pretty interesting articles recently:

    "What VB Devs Should Know About C#" by Bill Wagner
    
http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2893

    "What C# Devs Should Know About VB" by Kathleen Dollard
    
http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2894

    "On the Benefits of Learning Multiple Languages" by Patrick Meader
    
http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2895
-----
Have a great week and thanks for subscribing!

Rod
RodSte-@vb-helper.com
----------
*** Now Available ***

Beginning Database Design Solutions
http://www.amazon.com/exec/obidos/ASIN/0470385499/vbhelper/

Visual Basic 2008 Programmer's Reference
http://www.amazon.com/exec/obidos/ASIN/0470182628/vbhelper/
==========

    Both Contents:
1. New HowTo: Make a list of critter images with their names in XAML
2. New HowTo: Display a loose XAML page in an HTML IFRAME element
==========
++++++++++
<Both>
++++++++++
==========
1. New HowTo: Make a list of critter images with their names in XAML
http://www.vb-helper.com/howto_xaml_critter_list.html
http://www.vb-helper.com/HowTo/howto_xaml_critter_list.zip

(Image at http://www.vb-helper.com/HowTo/howto_xaml_critter_list.jpg)

This example demonstrates several useful XAML techniques.

First, this is a loose XAML page. It uses a Page element as its root
rather than a Window because the Window class requires extra permissions
on the client computer.

Attributes on the Page set the Page's FontFamily and FontSize. These are
inherited by controls contained in the Page unless they are overridden
in those controls.

The Page's Resources section stores resourcs for the Page. In this
example, that includes a Style for Image controls and a Style for Label
controls. The Styles use Setters to define properties that should be set
for those controls.

Note that some properties cannot be set in a loose XAML page. For
example, BitmapEffects are implemented in unmanaged code, which requires
extra permissions so is not allowed in a loose XAML page.

Note also that the Page would not accept a FontWeight attribute,
although the Label control's Style did so I set it in that Style.

The Page's Background property defines the Page's background brush. In
this case, it is a linear gradient brush shading from light blue at the
top to dark blue at the bottom.

Finally the Page contains a StackPanel oriented horizontally. That
contains a series of StackPanels oriented vertically, each containing an
Image and a Label. Note that the JPEG files must be in the same location
as the XAML file.

The Image and Label controls set their Style properties to the Styles
previously created in the Page's resources. Those Styles set the
controls' HorizontalAlignment properties to Center so the images and
text are centered in their entries in their StackPanels.

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    FontFamily="Comic Sans MS" FontSize="20"
 
    <Page.Resources>
        <Style x:Key="ImageStyle" TargetType="{x:Type Image}">
            <Setter Property="HorizontalAlignment" Value="Center"/>
            <Setter Property="Margin" Value="5"/>
            <Setter Property="Height" Value="50"/>
        </Style>
        <Style x:Key="LabelStyle" TargetType="{x:Type Label}">
            <Setter Property="Foreground" Value="Blue"/>
            <Setter Property="HorizontalAlignment" Value="Center"/>
            <Setter Property="FontWeight" Value="Bold"/>
            <Setter Property="Margin" Value="5"/>
        </Style>
    </Page.Resources>
    <Page.Background>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="#FF80FFFF" Offset="0"/>
            <GradientStop Color="#FF042CFF" Offset="1"/>
        </LinearGradientBrush>
    </Page.Background>
    <StackPanel Orientation="Horizontal" Margin="5">
        <StackPanel>
            <Image Source="Frog.jpg" Style="{StaticResource
ImageStyle}"/>
            <Label Content="Frog" Style="{StaticResource LabelStyle}"/>
        </StackPanel>
        <StackPanel>
            <Image Source="Butterfly.jpg" Style="{StaticResource
ImageStyle}"/>
            <Label Content="Butterfly" Style="{StaticResource
LabelStyle}"/>
        </StackPanel>
        <StackPanel>
            <Image Source="Shark.jpg" Style="{StaticResource
ImageStyle}"/>
            <Label Content="Shark" Style="{StaticResource LabelStyle}"/>
        </StackPanel>
        <StackPanel>
            <Image Source="Tiger.jpg" Style="{StaticResource
ImageStyle}"/>
            <Label Content="Tiger" Style="{StaticResource LabelStyle}"/>
        </StackPanel>
        <StackPanel>
            <Image Source="Platypus.jpg" Style="{StaticResource
ImageStyle}"/>
            <Label Content="Platypus" Style="{StaticResource
LabelStyle}"/>
        </StackPanel>
    </StackPanel>
</Page>

IMPORTANT: This XAML page should display in a XAML-enabled browser such
as Internet Explorer or Firefox, assuming you have the .NET Framework
version 3.5 or later installed. I was able to get it to run locally by
double-clicking the file or by browsing to it with Internet Explorer or
Firefox. However, when I move the file to my Web site neither browser
can open it. Internet Explorer gives a typically uninformative error
message and Firefox displays the file as text.

If you know what the problem is, please <A
HREF="mailto:RodSte-@vb-helper.com">let me know</A>!
==========
2. New HowTo: Display a loose XAML page in an HTML IFRAME element
http://www.vb-helper.com/howto_xaml_in_iframe.html
http://www.vb-helper.com/HowTo/howto_xaml_in_iframe.zip

(Image at http://www.vb-helper.com/HowTo/howto_xaml_in_iframe.jpg)

The HTML file simply uses an IFRAME element with SRC attribute set to
the XAML page's URL. This example sets the IFRAME's width to half the
browser's available width and its height to 150.

<HTML>
<BODY>

Here's the XAML page:


<IFRAME SRC="CritterList.xaml"
    WIDTH="50%" HEIGHT="150" />

</BODY>
</HTML>
==========
Archives:
    http://www.topica.com/lists/VBHelper
    http://www.topica.com/lists/VB6Helper
    http://www.topica.com/lists/VBNetHelper
    
http://www.vb-helper.com/cgi-bin/mojo/mojo.cgi?flavor=archive&list=VB_Helper_Newsletter


Post questions at:
    http://www.topica.com/lists/VBHelperQA
	
 Previous Message All Messages Next Message 
  Check It Out!

  Topica Channels
 Best of Topica
 Art & Design
 Books, Movies & TV
 Developers
 Food & Drink
 Health & Fitness
 Internet
 Music
 News & Information
 Personal Finance
 Personal Technology
 Small Business
 Software
 Sports
 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.