小编Sux*_*orm的帖子

比较数组LINQ

如何与linq中的数组进行比较并获取至少有一个交集的所有元素?例:

selectes = {1,5,7} 
Bands[0].SongsID {1,9} 
Bands[1].SongsID {5,6}
Bands[2].SongsID {4,6}
Run Code Online (Sandbox Code Playgroud)

我需要选择Bands[0]Bands[1].我试过这个:

var selectes2 = Bands.Where(t => t.SongsID.Intersect(selectes));
Run Code Online (Sandbox Code Playgroud)

乐队类:

public class Band
{
    public int ID                { get; set; }
    public string Name           { get; set; }
    public DateTime YearOfCreate { get; set; }
    public string Country        { get; set; }
    public int[] SongsID         { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

c# linq

2
推荐指数
1
解决办法
58
查看次数

ListView UWP 上的右键菜单

我有一个通过鼠标右键调用上下文菜单的代码。

private void GridColections_RightTapped(object sender, RightTappedRoutedEventArgs e)
    {

        MenuFlyout myFlyout = new MenuFlyout();
        MenuFlyoutItem firstItem = new MenuFlyoutItem { Text = "OneIt" };
        MenuFlyoutItem secondItem = new MenuFlyoutItem { Text = "TwoIt" };
        myFlyout.Items.Add(firstItem);
        myFlyout.Items.Add(secondItem);
        FrameworkElement senderElement = sender as FrameworkElement;
        myFlyout.ShowAt(senderElement);
    }
Run Code Online (Sandbox Code Playgroud)

但菜单出现在我的列表视图的中心。不在我点击鼠标的地方。如何修复它?

c# win-universal-app windows-10 uwp

1
推荐指数
1
解决办法
2304
查看次数

标签 统计

c# ×2

linq ×1

uwp ×1

win-universal-app ×1

windows-10 ×1