DCSIMG
.NET - Pavel's Blog
Sign in | Join | Help

Pavel's Blog

Pavel is a software guy that is interested in almost everything
software related... way too much for too little time

Browse by Tags

A UniformGrid for Silverlight/Windows Phone
07 February 12 10:00 PM | pavely | with no comments
The UniformGrid panel in WPF has some useful features, especially as an items panel in an ItemsControl . I blogged about the usefulness of the UniformGrid here . But what about Silverlight? It has no UniformGrid , but we can create one as a custom panel. This would be usable in Silverlight for the desktop and for Windows Phone, and would be a simple enough example to show in one post. The layout process In WPF/Silverlight, layout is a two step process. The first step is Measure: the panel asks each...
WPF Tip: Displaying Images in different Pixel formats
30 January 12 12:25 AM | pavely | 1 comment(s)
If we want to show an image in WPF, we typically use an Image element and connect its Source property to some image resource within our project: < Image Source ="Penguins.jpg" /> The Source property is not a string, it’s an ImageSource – an abstract type with several concrete implementations that provide a “real” image source. The above markup works thanks to the help of a type converter, that makes the source a BitmapImage – one of the simplest sources, that presents the image as...
From Enumerable to Observable
18 January 12 12:56 PM | pavely | with no comments
The IEnumerable<T> interface represents a collection of objects of type T, and is used heavily thanks to the C# foreach construct. Better yet, in the LINQ world, this is the interface that is “extended” via extension methods by the System.Linq.Enumerable class. This makes IEnumerable<T> both easy to use as well as powerful. But is it the best interface for getting data out of a possible collection? Recap: what is IEnumerable<T> ? IEnumerable<T> has only one method: GetEnumerator...
Using the Async CTP With Windows Phone
07 January 12 12:05 PM | pavely | with no comments
The Async CTP that exposes C# 5.0 features to be used with asynchronous programming is not just for the full .NET Framework. There are versions for Silverlight (4 and 5) and even Windows Phone (which can be viewed as Silverlight 4, but has a separate supporting assembly). To demonstrate, I’ve adapted my sample of the Mandelbrot set to Windows Phone, while taking advantage of the async features to keep the UI responsive. After creating the initial Silverlight for Windows Phone project, I’ve added...
WPF Tip: Binding to the Selected Item in a Master-Details View
06 December 11 04:00 PM | pavely | with no comments
Master-details is a common way to display data. A master view provides minimal data for a collection of objects (e.g. book names), and when selecting one such item, a details view provides more information for the selected item (e.g. a book’s name, author, publication date, etc.). In WPF, data binding (in XAML) is typically used to achieve the connection between an object and its details without using any code. Let’s see how we can achieve this. Let’s say we want to show a list of book names, and...
תגים:, , , ,
WPF Tip: SharedSizeGroup
26 November 11 05:54 PM | pavely | with no comments
Suppose we want to display a set of objects in a ListBox (or other ItemsControl ) using a DataTemplate that uses a Grid : < ListBox HorizontalContentAlignment ="Stretch" x : Name ="_list" > < ListBox.ItemTemplate > < DataTemplate > < Border Margin ="2" BorderBrush ="Blue" BorderThickness ="2" Padding ="2"> < Grid > < Grid.ColumnDefinitions > < ColumnDefinition Width ="Auto" /> < ColumnDefinition...
תגים:, , , ,
My C# 5.0 Async Session at Microsoft
22 November 11 03:36 PM | pavely | with no comments
Today I presented a session on C# 5.0 asynchronous programming. Thank you all for coming, it was a pleasure to present this interesting stuff. The presentation and demos are attached to this post. The NetFlix and RSS aggregator demos are part of the Async CTP installation. Any questions or comments are very welcome! OpenHouseAsyncProgC#5.NET4.5.zip OpenHouseAsyncProgC#5.NET4.5.zip
Mandelbrot Set with C# 5.0 Async support
21 November 11 07:09 PM | pavely | 1 comment(s)
I’ve always been fascinated by the Mandelbrot set . It’s an intriguing set, and the fractals created are truly mind boggling. (for more information on the Mandelbrot, and other such sets, you can start with the above Wikipedia link). As part of my preparation for tomorrow’s session on C# 5.0 asynchronous programming, I’ve decided to create a WPF application to view and explore the Mandelbrot set, while taking advantage of those new asynchronous features. This turned out to be rather fun. Here’s the...
Event: Asynchronous Programming with C# 5.0 & .NET 4.5
31 October 11 09:35 AM | pavely | 1 comment(s)
On November 22nd, I’ll be presenting a half-day session on asynchronous programming with C# 5.0 and .NET 4.5. If C# is your thing, this should be interesting. All details and registration is in this link: http://isrmsdn-async-nov11.eventbrite.com/
תגים:, , , ,
The Roslyn Project CTP is Available for Download
19 October 11 11:54 PM | pavely | with no comments
The so called “Roslyn” project from Microsoft has been finally released with this early CTP. What is “Roslyn”? It’s an attempt to make the internals of a C# or VB compiler exposed. The usual way we think about a compiler is as a black box – some input goes in – some output comes out. During the compilation process, the compiler builds various tables and gathers a lot of information on the input. After the output is generated, the compiler throws everything away. That’s really too bad. In today’s...
WPF 4.5 New Feature: Live Shaping
02 October 11 08:39 PM | pavely | 1 comment(s)
The BUILD conference concentrated on the new Windows Runtime (WinRT) component of Windows 8, but .NET 4.5 was also introduced, providing enhancements and new features. WPF & Silverlight seemed to have suffered a blow (some would say a knockout), as the new Windows 8 “Metro” model is not built on the same types, but rather wraps new native C++/COM libraries (that’s WinRT for you). Still, line of business applications will not be “Metro” anytime soon, so I think saying goodbye to WPF is premature...
תגים:, , , ,
Dynamic Live Tiles in Windows Phone 7
30 September 11 03:22 AM | pavely | 1 comment(s)
One of the attractive features of Windows Phone 7 is the tiles in the start menu. It’s pretty easy to point the main application tile (and secondary tiles) to static URLs. It’s a bit more difficult to create a dynamic image for a live tile. Starting with tiles The easiest way to start is by tweaking the WM Manifest.xml file (or even easier, but less flexible) the Project Properties Application Tab: The title appears as text under the background image. Ideally, the image should be 173x173 pixels in...
תגים:, , ,
Encapsulation & Exposure
26 September 11 10:55 PM | pavely | 2 comment(s)
I like to keep a tight leash on my classes. No unnecessary exposure. Consider the following simple class: class PersonnelManager {     List < Person > _people = new List < Person >();     public void Add ( Person person ) {         // do some validation         _people . Add ( person );         // maybe some extras     } } I want to expose...
תגים:, ,
WPF Tip: Using a MouseDoubleClick event where none exists
03 August 11 10:46 AM | pavely | with no comments
Consider the following simple piece of XAML:        < Border Margin ="10" BorderBrush ="Black" BorderThickness ="2">             < Grid Margin ="4">                 < Rectangle Fill ="Red" />                ...
תגים:, , , ,
The Cost of Training
29 July 11 03:38 PM | pavely | 2 comment(s)
A large part of my job is training. I’ve been doing that professionally on and off for the past 13 years. I remember the “good old days” of teaching C and C++, then COM (Component Object Model). These two, C++ and COM (with ATL, no doubt) where the backbone of any productive development on the Microsoft platform, and it all seemed to be possible to do, each with its own training course: 5 days of C++, 5 days of COM (non consecutive, as it’s pretty unrealistic to take some software guy and teach C...
More Posts Next page »