ChildWindow Positioning

Silverlight ChildWindow is centered over the parent control. I have extended ChildWindow to open it at a specific position. Here is a live demo : childwindow-positioning-demo And here is the code : public partial class ChildWindowEx : ChildWindow { Point _pt = new Point(0,0); public ChildWindowEx() { InitializeComponent(); } public ChildWindowEx(Point pt) : this() { _pt = pt; } protected override Size ArrangeOverride(Size finalSize) { Grid grid = Utils.FindChild(this, “ContentRoot”); if (grid != null) { grid.Arrange(new Rect(_pt.X, _pt.Y, grid.DesiredSize.Width, grid.DesiredSize.Height)); return finalSize; } return base.ArrangeOverride(finalSize); } } Visual Studio 2010 Solution : download

Remove ListBoxItem Highlighting

A Silverlight/Wpf ListBoxItem is highlighted when selected or when the mouse hovers over it. I need to display a list of items that are not highlighted when selected. This is a common scenario when displaying an inactive list for simply listing out some information. ListBoxItem’s default template can be easily inspected and modified using Expression Blend – Select a ListBoxItem in Objects and Timeline pane, Right click and select Edit template > Edit a Copy. Name you template and save it at the scope of your choice. This will create a copy of the template and allow you to modify it. Switch to the xaml view. Locate the VisualStates of MouseOver, Selected and Focused, and blank them out – The […]