Alessandro Del Sole's Blog

/* A programming space about Microsoft® .NET® */
posts - 159, comments - 0, trackbacks - 0

My Links


Your host

This is me! This space is about Microsoft® .NET® and Microsoft® Visual Basic development. Enjoy! :-)

These postings are provided 'AS IS' for entertainment purposes only with absolutely no warranty expressed or implied and confer no rights.

Microsoft MVP

My MVP Profile

I'm a VB!

Watch my interview in Seattle

My new book on VB 2015!

Pre-order VB 2015 Unleashed Pre-order my new book "Visual Basic 2015 Unleashed". Click for more info!

My new book on LightSwitch!

Visual Studio LightSwitch Unleashed My book "Visual Studio LightSwitch Unleashed" is available. Click the cover!

Your visits

Follow me on Twitter!

CodePlex download Download my open-source projects from CodePlex!

Article Categories


Post Categories

.NET Framework


Help Authoring

Microsoft & MSDN

Setup & Deployment

Visual Basic 2005/2008/2010

aprile 2009 Blog Posts

XAML code snippets in Visual Basic 2008

As you probably know, Microsoft Visual Studio 2008 offers an important mechanism for reusable code snippets. This feature is not available for the XAML code editor in WPF applications. So if we need to use XAML code snippets, we can run external tools such as the Snippet Manager which allows draggin'n'dropping snippets versus the XAML editor. By the way, I personally like to have all that I need inside the IDE (if possible!). We could consider to take the advantage of an internal IDE feature such as the drag'n'drop of text onto Visual Studio's toolbox that is good also for XAML code snippets....

posted @ domenica 19 aprile 2009 15:33 | Feedback (296) | Filed Under [ Visual Studio 2008 Visual Basic Windows Presentation Foundation ]

ADO.NET Entity Framework - 3rd party providers

One of the most interesting features in ADO.NET Entity Framework is that it can be extended with external providers for databases different from Microsoft SQL Server, whose provider is shipped by default with .NET Framework 3.5 Service Pack 1. There is a list of available 3rd party providers for ADO.NET ENtity Framework on the MSDN data development portal, both RTM and beta providers. Click here to be redirected to the MSDN page and you'll see important names such as Oracle, MySQL, PostgreSQL. If you work with ADO.NET Entity Framework, maybe you are interested into such topic. Alessandro

posted @ martedì 14 aprile 2009 12:31 | Feedback (0) | Filed Under [ LINQ/EF/OData ]

BevelBitmapEffect in WPF

In Windows Presentation Foundation, according to the hyerarchical structure of XAML, we can apply a lot of graphical effects not only to images but also to controls. In this sample we're going to see how to use the BevelBitmapEffect effect, which renders the control to which it's applied in a 3D way (we could say "buttonized"). We'll see how to apply it to an image and to a button. Run Visual Basic 2008 and create a new WPF empty project. The, type the following XAML code from within the Window element:     <StackPanel>       <Button Width="150" Height="60" Margin="10,10,10,10">         <Button.BitmapEffect>         <BevelBitmapEffect BevelWidth="10" EdgeProfile="CurvedIn"                            Smoothness="0.5" Relief="0.3" LightAngle="320"...

posted @ martedì 14 aprile 2009 12:24 | Feedback (0) | Filed Under [ Windows Presentation Foundation ]

Style inheritance in WPF

In Windows Presentation Foundation, styles support inheritance. In fact it's possible to declare a base style and styles which derive from the base. The main difference is that when defining a style you cannot specify the type of control the style is bound to. Or better, the type of object which can receive the style must be of type IFrameworkInputElement. The following sample will allow you to understand. First of all, we declare a base stile with XAML, from within the resources:     <Style x:Key="MyStyle">       <Setter Property="Button.FontFamily" Value="Courier New"/>       <Setter Property="Button.FontSize" Value="12" />       <Setter...

posted @ martedì 14 aprile 2009 12:22 | Feedback (0) | Filed Under [ Windows Presentation Foundation ]

WPF: menus with different fonts

When implementing menus in WPF applications, you can assign different fonts (each with different properties) to each single header or command. Consider the following XAML:   <DockPanel LastChildFill="True">     <Menu DockPanel.Dock="Top" VerticalAlignment="Top">       <MenuItem Name="FileMenu" Header="File" FontFamily="Script MT Bold" FontSize="14" FontStyle="Italic" FontWeight="Medium">           <MenuItem Name="FileVivaldiCommand" Header="Command with Vivaldi Font" FontFamily="Vivaldi" FontSize="16" FontWeight="Heavy">           <MenuItem.Background>             <LinearGradientBrush>               <GradientStop Color="Red" Offset="0" />               <GradientStop Color="Orange" Offset="0.5" />               <GradientStop Color="Yellow" Offset="1" />             </LinearGradientBrush>           </MenuItem.Background>         </MenuItem>       </MenuItem>     </Menu>   </DockPanel> We have drawn a File menu whose layout is set using the Script TM Bold font, with size of 14, italic, medium intensity. The Name has been assigned if you would interact with...

posted @ martedì 14 aprile 2009 12:21 | Feedback (0) | Filed Under [ Windows Presentation Foundation ]

WPF: applying styles to Tooltips

Using styles in Windows Presentation Foundation, you can change also the layout of controls like Tooltip, those small text blocks which describe a particular object each time you pass over with the mouse pointer. Try to type the following XAML code from within a new empty WPF project, inside the Window element:     <Grid>       <Grid.Resources>         <Style x:Key="MyTooltip" TargetType="{x:Type ToolTip}">           <Setter Property = "HorizontalOffset" Value="50"/>           <Setter Property = "VerticalOffset" Value="50"/>           <Setter Property = "Background" Value="Orange"/>           <Setter Property = "Foreground" Value="Red"/>           <Setter Property = "FontSize" Value="14"/>           <Setter Property = "FontWeight" Value="Bold"/>           <Setter Property = "FontFamily" Value="Courier New"/>         </Style>       </Grid.Resources>        ...

posted @ martedì 14 aprile 2009 12:20 | Feedback (0) | Filed Under [ Windows Presentation Foundation ]

Opacity Mask in WPF

In Windows Presentation Foundation, the most of controls expose a property called OpacityMask which allows to create transparency areas along the object itself and diffuse those areas in different manners. Let's see a practical sample on a Button. Start Visual Studio 2005 and create a new empty WPF project, then type the following XAML from within the Grid:       <Button Width="220" Height="75">         <Button.OpacityMask>           <LinearGradientBrush >             <GradientStop Color="Transparent" Offset="0"/>             <GradientStop Color="Black" Offset="0.5"/>             <GradientStop Color="Transparent" Offset="1"/>           </LinearGradientBrush>         </Button.OpacityMask>         This is a button with OpacityMask       </Button> We can use Brush objects to apply a gradient transparency to the...

posted @ martedì 14 aprile 2009 12:18 | Feedback (0) | Filed Under [ Windows Presentation Foundation ]

ADO.NET Data Services: deleting entities with associations

Probably this topic is more generally related to the ADO.NET Entity Framework programming, but in my case this was an issue I was experiencing with the ADO.NET Data Services, exposing an entity data model (I recorded some videos about). Imagine you have a client application that sends a DELETE Http requests to a Data Service for deleting entities on the database. It's not unusual that your entity will have associations with other entities and so on. The "delete" action gets performed on the Entity Data Model, because this is just a .NET representation of the data source, but you'll probably get errors...

posted @ sabato 11 aprile 2009 12:04 | Feedback (0) | Filed Under [ Visual Basic Windows Communication Foundation ]

WPF: Master-details sample with a customized DataGrid and Visual Basic 2008

In my previous blog post I discussed about creating a small "master-details" example within a WPF application, writing Visual Basic code. We learnt how setting up the new DataGrid control from the WPF Toolkit for presenting and editing data using the default layout.   The DataGrid is a flexible control. It allows to customize columns so that the UI gets more user friendly. This is accomplished customizing cells' template. There are some native templates, such as the following:    ·         DataGridTextColumn, which allows viewing/editing text; ·         DataGridCheckBoxColumn, which allows viewing and settings boolean value via a CheckBox; ·         DataGridComboBoxColumn, which allows selecting values to be...

posted @ venerdì 3 aprile 2009 15:36 | Feedback (0) | Filed Under [ Visual Basic Windows Presentation Foundation ]

WPF: master-details sample with the DataGrid control and Visual Basic 2008

The WPF Toolkit, an open source controls library that completes the standard ones offered by WPF, exposes a new DataGrid control for WPF developers working on .NET Framework 3.5 SP 1. Before going on reading this blog post, you'll need to download and install the WPF Toolkit.   In this post I'd like to show you how to build a simple master-details sample built on the top of the ADO.NET Entity Framework and using the DataGrid for presenting and editing tabular data. In our code example we'll retrieve the customer's list for our virtual Northwind Traders company and...

posted @ venerdì 3 aprile 2009 14:47 | Feedback (0) | Filed Under [ Visual Basic Windows Presentation Foundation ]

Powered by:
Powered By Subtext Powered By ASP.NET