Posts

Showing posts with the label Dependency property

How to get mouse cursor position in WPF MVVM applications using Dependency Properties

Image
Very useful StackOverflow link , Mark Green 's answer, from which I have borrowed heavily here, with one or two modifications in order to fully work in a Visual Studio 2015 environment. Step 1: Create a new WPF project Step 2: Create an example WPF window MainWindow.xaml [code language="xml"] <Window x:Class="MousePositionMvvm.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:MousePositionMvvm" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" mc:Ignorable="d" Title="MainWindow" Height="450" Width="525"> <Window....