Directory Freebies VS CheatSheet Forum

RSS

Email

Translate

Home About Archive Privacy Contact Advertise Write for Dev102

Hi

 

Yesterday I was trying to create a control with a partially transparent background,. I am writing this because what I thought was so straight forward, was not.

Here is a simple example:

   1: <Grid>
   2:    <Button Height="23" Margin="94,103,109,0" Name="button1" 
   3:            VerticalAlignment="Top">Button</Button>
   4:    <Border Margin="57,61,21,101" Name="border1" 
   5:            Background="blue" />
   6: </Grid>

When we run this example we will get the following:


Continue Reading...
Posted by Amit on Aug 26th, 2008 | Filed under .Net, WPF | 2 Comments

Many times I want to make my WPF Controls have a 3D effect. For examples Headers of lists and such. Saddly there is no built in way to do it so we have to come up with a custom solution. I don’t want to use Bitmap effects due to performance reasons, I must say I don’t have much experience with them but from what I have I am not a big fan.

Here is my solution for a 3D effect on WPF Controls.

First of all a Quick demonstration. Which one looks better.

WPF 3D Border Style

I don’t know about you but the second one is much nicer with that 3D effect.

How is it done? As I said before I don’t like using Bitmap effects if I don’t have to, so this is done with combining 2 borders together. The simple upper  one is a regular border with TextBlock


Continue Reading...
Posted by Shahar Y on Aug 7th, 2008 | Filed under .Net, WPF | 17 Comments

Usually, the WPF controls are declared in the .xaml file and not in the code behind (.xaml.cs file). However, we might need to use some of those controls in the code behind in order to manipulate them. How can we get the handle of such a control if it “resides” in the xaml file? Take a look at the following xaml code:

<Window x:Class="WpfApplication2.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300" MouseLeftButtonDown="window_Clicked">
    <Grid>
        <TextBlock x:Name="fullNameControl" FontSize="20"
                   Text="{Binding Path=FullName}">
        </TextBlock>
    </Grid>
</Window>

There is a TextBlock called fullNameControl, in the code behind I change its background color to gold when the window is clicked:


Continue Reading...
Posted by Shahar Y on May 23rd, 2008 | Filed under .Net, Utilities, WPF | 2 Comments

We all know the propertyGrid control, which provides a user interface for browsing the properties of an object. What about having a WPF propertyGrid? Well, yesterday I  noticed that there is a work in progress on an open source WPF property grid. Tomer Shamam announced in his blog Essential WPF that he accepted Microsoft Israel OPEN UP challenge (open source contest) and created a new project - WPF property grid. As he stated, it is currently only a Proof of concept and the interface and its usage may change in next releases. I think that its worth tracking…


Continue Reading...
Write Article for Dev102

Write for Dev102!

We pay for user submitted tutorials and articles that we publish. Anyone can send in a contribution

Learn More