Archive for the 'WPF' Category

Thank You from PHINUG

A big thanks to those who participated in the Philippine Launch Wave of Visual Studio 2008, Windows Server 2008, and SQL Server 2008. The event was a huge success not only for Microsoft Philippines but for the user groups who was present during the launch delivering mini-sessions as well as the breakout session.

We had to change topic on the day prior the launch as our prepared topic was quite different from what was advertised. Our supposed topic was a Windows Presentation Foundation using Visual Studio 2008 but what was advertised was “Visual Studio 2008”. Personally, I think that the topic is too technical for a launch event but I have decided to have this topic to be delivered in future events. Fortunately, we were able to get speakers from the core group of PHINUG: Jonjon Limjap on Language Enhancements for C# 3.0 and VB 9.0, Edu Lorenzo for LINQ and of course, yours truly for Windows Presentation Foundation.

The Speakers

Jonjon on his Language Enhancements talk

Edu on his LINQ talk

me, on WPF

I had to cut my time short in our breakout session due to time constraint but I do hope I was able to convey the message I am doing for WPF. There were a lot of people who were interested with the new developer technologies and from students, professionals, business owners, we were able to at the least address their concerns on migrating, etc.

Most of the things that we presented on stage are demos and if I’m not mistaken, we only have 5 slides on stage that includes the welcome and thank you messages. No downloads yet at this point (well at least for me) and I’ll post the demos on our next event.

Again, thank you to those who came, who dropped by our event, and I hope the group was able to help you out with your concerns.

Using Hexadecimal Color Values in WPF 3.5

I am currently preparing for my WPF content for the Philippine Launch Wave of Visual Studio 2008, Windows Server 2008, and SQL Server 2008. As a seasoned web developer, I am quite accustomed to the colors that I frequently use in hexadecimal and I intend to use these colors in my demo. I have a basic XAML file that has a Window with a ListBox, TextBlock and Slider in it. I am trying to show how LINQ works in a WPF 3.5 application.


<window x:Class="WpfApplication1.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="500" Width="500">
    <grid>
        <listBox Name="listBox1" SelectionChanged="listBox1_SelectionChanged" Margin="0,0,0,120" />
        <textBlock Height="105" Name="textBlock1"  FontSize="{Binding ElementName=slider1, Path=Value}" VerticalAlignment="Bottom">Label</textBlock>
        <slider Height="21" Margin="203,0,-5,0" SizeChanged="slider1_SizeChanged" ValueChanged="slider1_ValueChanged" Minimum="10" Maximum="50" Name="slider1" VerticalAlignment="Bottom" Value="10" />
    </grid>
</window>

While working on a certain functionality that I want to display, I became curious if I can use the colors in my sample application. The color, which I don’t exactly know the name but I refer to it as maroonish red (the UP blood in me), has an hexadecimal value of “#cd0001”. I tried appending that value in the Foreground property of the TextBlock (textBlock1 mentioned above) but it doesn’t work.


// This code won't work

textBlock1.Foreground = "#cd0001";

// Even this

textBlock1.Foreground = (Brush)"#cd0001";

To have a workaround on this, you need to use the BrushConverter class in able to use your hexadecimal based colors as a brush.


BrushConverter bc = new BrushConverter();
Brush brush;
brush = (Brush)bc.ConvertFrom("#cd0001");
textBlock1.Foreground = brush;

And it works! If you are more familiar with the colors that you want in hexadecimal, you can replace the hex value in the text above and most likely that would work.

Enjoy!

Post Event Resources

Here are the post event resources of the Developer Track of the Community Launch of Windows Vista and 2007 Office System.

Usage Notes:

1. Rename14042007.png to 12042007.zip (Right click, “Save Link/Target As”)
2. Change the c:\manny.wmv file in the source code of DemoWPF to any WMV file that you have in your computer.

For questions and other concerns, you can post a comment here.


Blog Stats

  • 3,957 hits
August 2017
S M T W T F S
« Nov    
 12345
6789101112
13141516171819
20212223242526
2728293031