XCommand In an open source codeplex project, there is a better way to handle the Command / CommandParameter binding based on this event. Find here xcommand.codeplex.com
Here is the sample code below:
<Grid> <TextBlock Margin="20,30,20,0" VerticalAlignment="Top" Height="80" x:Name="XTextBlock" Foreground="{Binding FgColor, Mode=TwoWay}" XCmd:MouseMove.Command="{Binding TextBlockPointerMovedCommand}" XCmd:MouseLeftButtonDown.Command="{Binding TextBlockPointerPressedCommand}" XCmd:MouseLeave.Command="{Binding TextBlockPointerExitedCommand}" Text="{Binding Description, Mode=TwoWay}"> </TextBlock> <Grid Grid.Column="1" Background="{Binding BgColor, Mode=TwoWay}" XCmd:MouseMove.Command="{Binding GridPointerMovedCommand}" XCmd:MouseMove.CommandParameter="{Binding ElementName=XTextBlock, Path=Text}" XCmd:MouseLeftButtonDown.Command="{Binding GridPointerPressedCommand}" XCmd:MouseLeftButtonDown.CommandParameter="{Binding ElementName=XTextBlock, Path=Text}" > </Grid> </Grid>
Hope this will be helpful.
Xdevpro
source share