Creating context menu with Windows Phone7

Posted by Unknown
Creating context menu with Windows Phone7

In this post am going to explain about creating a context menu in windows phone

in order to implement context menu i have taken one button here when i have long press on the button i want to show the context menu

in the context menu item i want to add the option pin to start screen

Here you can find the code bellow:


<button background="{StaticResource BrushGold}" click="btnAppStatus_Click" height="120" horizontalcontentalignment="Stretch" margin="0,0,0,32" padding="0" verticalcontentalignment="Stretch" x:name="btnAppStatus">
                                    <grid>
                                        <grid .background="">
                                            <lineargradientbrush endpoint="0.5,1" startpoint="0.5,0">
                                                <gradientstop color="#FFFF9E27" offset="0">
                                                <gradientstop color="#FFF58904" offset="1">
                                            </gradientstop></gradientstop></lineargradientbrush>
                                        </grid>
                                        <grid .columndefinitions="">
                                            <columndefinition>
                                            <columndefinition width="Auto">
                                        </columndefinition></columndefinition></grid>
                                        <textblock fontsize="32" horizontalalignment="Left" margin="12,0,0,0" text="Where's my app?" textwrapping="Wrap" verticalalignment="Top" width="200">
                                        <img grid.column="1" horizontalalignment="Right" margin="0" opacity="0.7" source="Images/appSearch.png" />
                                    </textblock></grid>
                                    <toolkit:contextmenuservice .contextmenu="">
                                        <toolkit:contextmenu x:name="MyContextContext">
                                            <toolkit:menuitem click="MenuItem_Click" header="Pin To StartScreen"></toolkit:menuitem>
                                        </toolkit:contextmenu>
                                    </toolkit:contextmenuservice>
                                </button>

i hope this will helps you.....
Labels:

Post a Comment

 
test