c# - WPF XAML Using Mouse Action Event -
i learning wpf 4.5 unleashed book. when tried incorporate mouse action event such mouseenter or mousedoubleclick button typing code manually, compiler told me not find reference mouse action event. however, when use double tab shortcut, works well. possibly issue? have bold trouble code below.
<window x:class="wpfapplicationlearning0001.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="513.265" width="748.469"> <dockpanel> <menu dockpanel.dock="top"> </menu> <stackpanel name="buttonbar" orientation="horizontal" dockpanel.dock="right"> <stackpanel.layouttransform> <rotatetransform angle="90"> </rotatetransform> </stackpanel.layouttransform> **<button name="panel1button" mouseenter="panel1button_mouseenter"> toolbox </button>** </stackpanel> <grid background="white" margin="0,0,2,3"> <grid.rowdefinitions> <rowdefinition height="auto"/> <rowdefinition/> <rowdefinition/> <rowdefinition/> </grid.rowdefinitions> <grid.columndefinitions> <columndefinition width="auto" /> <columndefinition/> </grid.columndefinitions> <label grid.row="0" grid.column="0" grid.columnspan="2" background="black" foreground="white" horizontalcontentalignment="center" content= "start page"/> <groupbox grid.row="1" grid.column="0" background="white" foreground="black" header="start" /> <groupbox grid.row="2" grid.column="0" background="white" foreground="black" header="recent" /> <groupbox grid.row="3" grid.column="0" background="white" foreground="black" header="option" /> <groupbox grid.row="1" grid.column="1" grid.rowspan="3" background="white" foreground="black" header="get start"> <listbox> <listboxitem>article number1</listboxitem> <listboxitem>article number2</listboxitem> <listboxitem>article number3</listboxitem> <listboxitem>article number4</listboxitem> </listbox> </groupbox> </grid> </dockpanel>
the double click not puts in xaml code, put creates code behind in .cs file of:
private void panel1button_mouseenter(object sender, mouseeventargs e) { }
until add code behind yourself, if doing manually, error correct. in addition, when manually coding sure include (object sender, mouseeventargs e)
in function call or may not recognize valid function call mouseevent.
Comments
Post a Comment