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
Home
Contact
About
RSS
Atom
Comments RSS
Go
Tags
.NET
.NET 4
.NET 4.0
.NET 4.5
.NET2
64 bit
AI
AJAX
Algorithms
ASP.NET
Audio
Azure
BUILD
C#
C# 3.0
C# 4.0
C# 5.0
C++
C++/CX
C++0X
C++11
CLR
CLR Explorer
COM
COM Apartments
Console
courses
D&D
Debugging
DEV
Developer Academy 3
Device Drivers
DirectCompute
DirectX
food
Fun
Games
Graphics
Intel
Intellisense
Internals
Interop
ITPRO
LINQ
LINQ to XML
Mathematics
Media Foundation
MEF
Memory Map Viewer
Metro
MFC
Multithreading
Native API
Native Development
NLP
Numerics
OFFTOPIC
OpenDay
PARSING
PDC2008
ReSharper
Robotics
Roslyn
Silverlight
Silverlight 2
Task Parallel Library
TECH
teched
teched_il
TechEd2010
TechedIsrael2008
thoughts
Threading
Tips
Tutorial
video
Vista
Visual Basic
Visual C++
Visual Studio
Visual Studio 11
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
Visual Studio 2012
WebTech
Win32
WinDbg
Windows 8
Windows Devices User Group
Windows Phone
Windows Phone 8
Windows Phone User Group
Windows Platfrom User Group
Windows Runtime
Windows7
WPF
XAML
XNA
מכללת הי-טק
Archives
May 2013 (2)
April 2013 (2)
March 2013 (3)
February 2013 (2)
January 2013 (2)
December 2012 (3)
November 2012 (3)
October 2012 (5)
September 2012 (6)
August 2012 (4)
July 2012 (2)
June 2012 (4)
May 2012 (5)
April 2012 (4)
March 2012 (7)
February 2012 (7)
January 2012 (6)
December 2011 (6)
November 2011 (5)
October 2011 (5)
September 2011 (5)
August 2011 (5)
July 2011 (3)
June 2011 (3)
May 2011 (3)
April 2011 (3)
March 2011 (8)
February 2011 (4)
January 2011 (5)
December 2010 (5)
November 2010 (13)
October 2010 (4)
September 2010 (5)
August 2010 (7)
July 2010 (1)
June 2010 (3)
May 2010 (4)
April 2010 (1)
March 2010 (2)
February 2010 (2)
January 2010 (3)
December 2009 (1)
November 2009 (4)
October 2009 (5)
September 2009 (3)
August 2009 (1)
July 2009 (4)
June 2009 (3)
May 2009 (2)
April 2009 (3)
March 2009 (2)
February 2009 (5)
January 2009 (3)
December 2008 (2)
November 2008 (4)
October 2008 (7)
September 2008 (6)
August 2008 (5)
July 2008 (6)
June 2008 (3)
May 2008 (5)
April 2008 (2)
March 2008 (9)
February 2008 (4)
January 2008 (9)
December 2007 (6)
Navigation
Home
All Posts
RSS
Popular Tags
Browse by Tags
All Tags
»
WPF
»
Silverlight
(
RSS
)
.NET
.NET 4
.NET 4.5
C#
C# 5.0
C++
C++/CX
DEV
DirectX
Graphics
Shaders
Tips
video
Visual Studio
Visual Studio 2010
Visual Studio 2012
Windows 8
Windows Phone
Windows Phone 8
Windows Runtime
XAML
XNA
XAML Tip: Graphics with ItemsControl
23 February 13 12:04 AM
|
pavely
| with
no comments
Sometimes in a WPF or Windows Store or Windows Phone application we need to draw some things based on some collection of data items. Suppose we have the following simple data item: class CarData { public double Distance { get; set; } public string Image { get; set; } } Suppose we have a collection of CarData objects, and the requirement was to show a set of images along a line with a particular distance, like in the following screenshot: The distance from the left is determined by the Distance property...
Preview of Blend 5 available
25 December 12 03:41 AM
|
pavely
| with
no comments
When Visual Studio 2012 came out, one thing was sorely missing. An Expression Blend tool that can handle WPF 4.5 applications. Blend for Visual Studio that is currently available only supports Windows 8 Store Apps, but not WPF (or Silverlight). A few days ago, Microsoft released a preview of Blend 5 (with Sketchflow), that’s able to work with WPF and Silverlight, along with Windows 8 Store apps. The tool can be downloaded from here: http://www.microsoft.com/en-us/download/details.aspx?id=30702 Microsoft...
Windows 8 Metro: Detecting scroll changes in ListView
02 July 12 09:27 PM
|
pavely
| with
no comments
I had a requirement in a Metro app I’m working on to detect scrolling in a ListView ( GridView is practically the same), or more precisely, detect whether the selected item goes off the visible ListView area, and if so, switch some items in the ListView so that the selected item be visible again; this is not an entirely accurate description, but it’s close enough for our purposes. An easy one, right? Searching the ListView class (and its bases) yields no useful results on scrolling. In WPF, the ScrollViewer...
INotifyPropertyChanged implementation with C# 5.0
20 March 12 10:40 PM
|
pavely
|
6 comment(s)
The INotifyPropertyChanged interface has become a very popular interface, typically used in MVVM scenarios (WPF/Silverlight). It looks simple, with a single member, which is an event, and its basic implementation by some data type may be something like this: class Book : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged( string propName) { var pc = PropertyChanged; if (pc != null ) pc( this , new PropertyChangedEventArgs (propName...
WPF/Silverlight Tip: Transparent Hit Testing
23 February 12 08:56 AM
|
pavely
| with
no comments
Hit testing is the process of finding out which elements (if any) contain a certain point (typically the location of the mouse pointer). Sometimes, however, there is a need to disregard some elements in a hit testing scenario. Consider this simple program that allows moving of circles: One can grab a circle and drag it around. Here’s the MouseLeftButtonDown event handler on the containing Canvas: void OnMouseDown( object sender, MouseButtonEventArgs e) { var shape = e.Source as Shape ; if (shape...
A UniformGrid for Silverlight/Windows Phone
07 February 12 10:00 PM
|
pavely
|
1 comment(s)
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
|
3 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...
WPF/Silverlight Data Binding Tip: FallbackValue
25 June 11 03:44 PM
|
pavely
| with
no comments
Consider the following piece of XAML (part of an Image Viewer application), that wants to set the Window title (in WPF) based on the currently loaded image file: Title ="{ Binding ImagePath , StringFormat =Image Viewer ({ 0} )}" This assumes that a DataContext exists, and exposes a property named ImagePath . This works well if such an object actually exists. But what happens when the application starts up and there is no image loaded yet, meaning the DataContext remains null? The Title...
Some Short Videos I Made
26 May 11 02:30 PM
|
pavely
| with
no comments
I’ve created a few short videos, covering some introductory material – still may be useful for some… The audio quality is not the best possible, but should be fairly understandable. All the videos are in Hebrew (sorry, non-Hebrew speakers! You can still watch me type code samples, it may have some value) The videos are: Introduction to C# 5.0 asynchronous programming Introduction to the Managed Extensibility Framework (MEF) Understanding XAML (Part 1) Understanding XAML (Part 2) They are also...
Silverlight Quirk: Content Alignment not respected for ListBox
23 August 10 08:38 PM
|
pavely
|
2 comment(s)
Silverlight and WPF have many similarities, and many differences as well. One of the subtle ones I’ve discovered is with respecting the HorizontalContentAlignment property in a ListBox. Here’s the same application, written in WPF and Silverlight with the following ListBox (bound to a collection of Book objects) and its item template: < ListBox HorizontalContentAlignment = "Stretch" x : Name = "_list" > < ListBox...