小编Siv*_*mar的帖子

如何在Relay Command中获取Listview ItemClick Vallue

嗨我正在使用MVVM模式在Windows商店应用程序中工作,我在接收listview itemclick值在relay命令中有一些问题.现在我得到了所选的项目值.但是不知道如何获得itemclickValue.在这里,我附上了我的代码.

XAML

 <ListView x:Name="lstItem" ItemTemplate="{StaticResource ItemTemplate}"  ItemsSource="{Binding ItemList}" Padding="130,0,0,0" SelectedItem="{Binding SelectedItem,Mode=TwoWay}">
            <Triggers:Interactions.Triggers>
                <Triggers:EventTrigger EventName="SelectionChanged">
                    <Triggers:InvokeCommandAction Command="{Binding SelectedItemCommand}" CommandParameter="{Binding SelectedItem,Mode=TwoWay}"/>
                </Triggers:EventTrigger>
            </Triggers:Interactions.Triggers>
        </ListView>
Run Code Online (Sandbox Code Playgroud)

ViewModel代码

private Item _selectedItem;
    public Item SelectedItem { get { return _selectedItem; } set { _selectedItem = value; NotifyPropertyChanged("SelectedTrends"); } }



private RelayCommand<Item> _selectedItemCommand;
    public RelayCommand<Item> SelectedItemCommand
    {
        get
        {
            return this._selectedItemCommand
                ?? (this._selectedItemCommand= new RelayCommand<Item>(item=>
                {
                    MessageDialog messagedialog = new MessageDialog(item.Name,"Test");
                    messagedialog.ShowAsync();
                }));
        }

    }
Run Code Online (Sandbox Code Playgroud)

c# mvvm windows-8 winrt-xaml windows-store-apps

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

Add-AzTableRow 命令在 Azure Cloud Shell 中不可用

我正在尝试使用 Azure Cloud Shell 在我的表存储中插入新行,但我面临以下异常。所以让我知道我们需要用来插入的任何其他命令。

块引用

 Add-AzTableRow: The term 'Add-AzTableRow' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Run Code Online (Sandbox Code Playgroud)

块引用

下面是命令:

$partitionKey1 = "partition1"
$partitionKey2 = "partition2"


Add-AzTableRow `
    -table $cloudTable `
    -partitionKey $partitionKey1 `
    -rowKey ("CA") -property @{"username"="Chris";"userid"=1}
Run Code Online (Sandbox Code Playgroud)

azure-storage azure-table-storage azure-cloud-shell

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