c# - How to hold image onClick WPF Grid and drag to another position in GRID -


<usercontrol x:class="chess_interface.usercontrols.positioncontrol"          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"          xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"           xmlns:local="clr-namespace:chess_interface.usercontrols"          xmlns:m="clr-namespace:chess_interface"          mc:ignorable="d"           d:designheight="450" d:designwidth="450">   <grid>     <uniformgrid rows="8" columns="1" height="400" horizontalalignment="left">         <label content="8" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="7" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="6" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="5" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="4" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="3" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="2" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="1" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />     </uniformgrid>     <uniformgrid rows="8" columns="1" height="400" horizontalalignment="right">         <label content="8" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="7" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="6" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="5" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="4" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="3" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="2" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="1" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />     </uniformgrid>      <uniformgrid rows="1" columns="8" width="400" verticalalignment="top">         <label content="a" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="b" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="c" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="d" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="e" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="f" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="g" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="h" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />     </uniformgrid>     <uniformgrid rows="1" columns="8" width="400" verticalalignment="bottom">         <label content="a" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="b" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="c" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="d" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="e" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="f" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="g" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />         <label content="h" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" />     </uniformgrid>      <grid x:name="chessboard" width="400" height="400" verticalalignment="center" horizontalalignment="center" mouseleftbuttondown="chessboard_mouseleftbuttondown" mouseleftbuttonup="chessboard_mouseleftbuttonup"  >         <grid.columndefinitions >             <columndefinition width="*" sharedsizegroup="sizegroup"/>             <columndefinition width="*" sharedsizegroup="sizegroup"/>             <columndefinition width="*" sharedsizegroup="sizegroup"/>             <columndefinition width="*" sharedsizegroup="sizegroup"/>             <columndefinition width="*" sharedsizegroup="sizegroup"/>             <columndefinition width="*" sharedsizegroup="sizegroup"/>             <columndefinition width="*" sharedsizegroup="sizegroup"/>             <columndefinition width="*" sharedsizegroup="sizegroup"/>         </grid.columndefinitions>         <grid.rowdefinitions>             <rowdefinition height="*" sharedsizegroup="sizegroup"/>             <rowdefinition height="*" sharedsizegroup="sizegroup"/>             <rowdefinition height="*" sharedsizegroup="sizegroup"/>             <rowdefinition height="*" sharedsizegroup="sizegroup"/>             <rowdefinition height="*" sharedsizegroup="sizegroup"/>             <rowdefinition height="*" sharedsizegroup="sizegroup"/>             <rowdefinition height="*" sharedsizegroup="sizegroup"/>             <rowdefinition height="*" sharedsizegroup="sizegroup"/>         </grid.rowdefinitions>          <border grid.row="0" grid.column="0" background="white"></border>         <border grid.row="0" grid.column="1" background="brown"></border>         <border grid.row="0" grid.column="2" background="white"></border>         <border grid.row="0" grid.column="3" background="brown"></border>         <border grid.row="0" grid.column="4" background="white"></border>         <border grid.row="0" grid.column="5" background="brown"></border>         <border grid.row="0" grid.column="6" background="white"></border>         <border grid.row="0" grid.column="7" background="brown"></border>          <border grid.row="1" grid.column="0" background="brown"></border>         <border grid.row="1" grid.column="1" background="white"></border>         <border grid.row="1" grid.column="2" background="brown"></border>         <border grid.row="1" grid.column="3" background="white"></border>         <border grid.row="1" grid.column="4" background="brown"></border>         <border grid.row="1" grid.column="5" background="white"></border>         <border grid.row="1" grid.column="6" background="brown"></border>         <border grid.row="1" grid.column="7" background="white"></border>          <border grid.row="2" grid.column="0" background="white"></border>         <border grid.row="2" grid.column="1" background="brown"></border>         <border grid.row="2" grid.column="2" background="white"></border>         <border grid.row="2" grid.column="3" background="brown"></border>         <border grid.row="2" grid.column="4" background="white"></border>         <border grid.row="2" grid.column="5" background="brown"></border>         <border grid.row="2" grid.column="6" background="white"></border>         <border grid.row="2" grid.column="7" background="brown"></border>          <border grid.row="3" grid.column="0" background="brown"></border>         <border grid.row="3" grid.column="1" background="white"></border>         <border grid.row="3" grid.column="2" background="brown"></border>         <border grid.row="3" grid.column="3" background="white"></border>         <border grid.row="3" grid.column="4" background="brown"></border>         <border grid.row="3" grid.column="5" background="white"></border>         <border grid.row="3" grid.column="6" background="brown"></border>         <border grid.row="3" grid.column="7" background="white"></border>          <border grid.row="4" grid.column="0" background="white"></border>         <border grid.row="4" grid.column="1" background="brown"></border>         <border grid.row="4" grid.column="2" background="white"></border>         <border grid.row="4" grid.column="3" background="brown"></border>         <border grid.row="4" grid.column="4" background="white"></border>         <border grid.row="4" grid.column="5" background="brown"></border>         <border grid.row="4" grid.column="6" background="white"></border>         <border grid.row="4" grid.column="7" background="brown"></border>          <border grid.row="5" grid.column="0" background="brown"></border>         <border grid.row="5" grid.column="1" background="white"></border>         <border grid.row="5" grid.column="2" background="brown"></border>         <border grid.row="5" grid.column="3" background="white"></border>         <border grid.row="5" grid.column="4" background="brown"></border>         <border grid.row="5" grid.column="5" background="white"></border>         <border grid.row="5" grid.column="6" background="brown"></border>         <border grid.row="5" grid.column="7" background="white"></border>          <border grid.row="6" grid.column="0" background="white"></border>         <border grid.row="6" grid.column="1" background="brown"></border>         <border grid.row="6" grid.column="2" background="white"></border>         <border grid.row="6" grid.column="3" background="brown"></border>         <border grid.row="6" grid.column="4" background="white"></border>         <border grid.row="6" grid.column="5" background="brown"></border>         <border grid.row="6" grid.column="6" background="white"></border>         <border grid.row="6" grid.column="7" background="brown"></border>          <border grid.row="7" grid.column="0" background="brown"></border>         <border grid.row="7" grid.column="1" background="white"></border>         <border grid.row="7" grid.column="2" background="brown"></border>         <border grid.row="7" grid.column="3" background="white"></border>         <border grid.row="7" grid.column="4" background="brown"></border>         <border grid.row="7" grid.column="5" background="white"></border>         <border grid.row="7" grid.column="6" background="brown"></border>         <border grid.row="7" grid.column="7" background="white"></border>     </grid> </grid> 

**i have added images through code chessboard ui want hold image , drop gird cell **

**in code behind have mousedown mouseup events , have 64 border images moving fine on click 1 cell want add drag , drop feature in advance
**


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -