what''s this Event'' name?

hello,everyone:

now, I add some components into a InkCanvas,when I select a component and delete it, I want to get this event.

what's this event's name?

please~!

thanks!

[239 byte] By [bruce.du] at [2008-1-9]
# 1

can nobody know this problem?

maybe I didn't express it clearly.

I want to delete a component that is included in the inkcanvas, for example:

Code Snippet
<InkCanvas EditingMode ="Select" Name ="myInkCanvas" Background ="LightGreen">
<Button InkCanvas.Top ="50" InkCanvas.Left ="50" Width ="80" Height ="30">Click me</Button>
</InkCanvas>

when I select the button control, and then press the key "Delete" on the keyboard, the button will be deleted directly.

but Before I delete the control, I want to give some warning information,

so how can I get a event before the control is deleted.

It had better cancel the delete operation when I need, although I pressed the key "Delete".

thanks!

bruce.du at 2007-10-2 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 2
I think the normal event raised on erasing/deleting a stroke is StrokeErasing
However, a button is a control and not a stroke, so when I tested the event was not raised.

I have a work-around which u could try

In XAML
<Window x:Class="WindowsApplication4.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="WindowsApplication4" Height="500" Width="500" Loaded="onLoad"
>
<Grid>
<InkCanvas EditingMode ="Select" Name ="myInkCanvas" Background ="LightGreen">
<Button InkCanvas.Top ="50" InkCanvas.Left ="50" Width ="80" Height ="30">Click me</Button>
</InkCanvas>
</Grid>
</Window>

In code-behind
public Window1()
{
InitializeComponent();
this.PreviewKeyDown += new KeyEventHandler(Window_PreviewKeyDown);
}

void Window_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Delete)
{

if (MessageBox.Show("Do u really want to delete this element", "Question", MessageBoxButton.YesNo) == MessageBoxResult.No)
{
e.Handled = true;
}
}
}

Would this work for u?

Cheerios,
Serene
Sereneo at 2007-10-2 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...

Visual Studio Orcas

Site Classified