WPF – Image ‘is not part of the project or its Build Action is not set to Resource’

Try doing a full rebuild, or delete the build files and then build the file. Visual Studio doesn’t always pick up changes to resources, and it can be a pain to get it recompile. Also try using a full URI as that helped me when I had the same problem. Something like pack://application:,,,/MyAssembly;component/bug.png

Cant drag and move a WPF Form

I am using a main window to hold pages (creating a navigation style program), and in the code behind of my main window, I inserted this… protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) { base.OnMouseLeftButtonDown(e); // Begin dragging the window this.DragMove(); } … and it works like a charm. This is with windowstyle=none. Its nice in the … Read more

WPF ListBox with a ListBox – UI Virtualization and Scrolling

It is possible to achieve smooth scrolling VirtualizingStackPanels in WPF 4.0 without sacrificing virtualization if you’re prepared to use reflection to access private functionality of the VirtualizingStackPanel. All you have to do is set the private IsPixelBased property of the VirtualizingStackPanel to true. Note that in .Net 4.5 there’s no need for this hack as … Read more

What is the best way to simulate a Click with MouseUp & MouseDown events or otherwise?

I would use a Button control and overwrite the Button.Template to just show the content directly. <ControlTemplate x:Key=”ContentOnlyTemplate” TargetType=”{x:Type Button}”> <ContentPresenter /> </ControlTemplate> <Button Template=”{StaticResource ContentOnlyTemplate}”> <Label Content=”Test”/> </Button>