Sharepoint - Display the Sharepoint context menu in list items on another column instead of Title column?

i found the solution. it's really simple:

    SPList list = site.RootWeb.Lists["Tasks"];
    SPField field = list.Fields["Priority"];
    field.ListItemMenu = true;
    field.ListItemMenuAllowed = SPField.ListItemMenuState.Required;
    field.Update();
    list.Update();

and that's all.


You can add these options to Field xml - LinkToItem="TRUE" LinkToItemAllowed="Required" ListItemMenu="TRUE" to display Item Context Menu.

So it looks like:

    <Field Type="Text" ID="{87AC637E-BB54-48A4-BB7A-93973F6814A1}" StaticName="Country"
 LinkToItem="TRUE" LinkToItemAllowed="Required" ListItemMenu="TRUE" ClassInfo="Menu"
 AuthoringInfo="$Resources:core,Linked_Item_With_Menu;" Name="Country" 
DisplayName="$Resources:resource,Field_Country;" Required="TRUE"
></Field>

You're not going to be able to do this without deploying a new column through a feature.

Looking at how the current title with menu column is generated:

<Field ID="{<a new guid here>}" Name="LinkTitle" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="LinkTitle" Group="$Resources:core,Base_Columns;" ReadOnly="TRUE" Type="Computed" DisplayName="$Resources:core,Title;" DisplayNameSrcField="Title" ClassInfo="Menu" AuthoringInfo="$Resources:core,Linked_Item_With_Menu;">

    <FieldRefs>
        <FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" />
        <FieldRef ID="{bc91a437-52e7-49e1-8c4e-4698904b2b6d}" Name="LinkTitleNoMenu" />
        <FieldRef ID="{1344423c-c7f9-4134-88e4-ad842e2d723c}" Name="_EditMenuTableStart2" />
        <FieldRef ID="{2ea78cef-1bf9-4019-960a-02c41636cb47}" Name="_EditMenuTableEnd"/>
    </FieldRefs>

    <DisplayPattern>
        <FieldSwitch>
            <Expr>
                <GetVar Name="FreeForm" />
            </Expr>
            <Case Value="TRUE">
                <Field Name="LinkTitleNoMenu" />
            </Case>
            <Default>
                <Field Name="_EditMenuTableStart2" />
                <Field Name="LinkTitleNoMenu" />
                <Field Name="_EditMenuTableEnd" />
            </Default>
        </FieldSwitch>
    </DisplayPattern>
</Field>

Then it looks like you might get away with changing the references to LinkTitleNoMenu to the internal name of the field you want to show. However, you must make sure that the column you reference to is also a Site Column.

Do also ensure you change the static and display names of the column (replacing out 'LinkTitle' with something new of your choosing).