Page 1 of 1

ListView button column not working

Posted: 14 Oct 2017, 09:48
by fixer007
Hi Noesis community!
i've try to use the code shown at this topic: viewtopic.php?f=3&t=1176 But its not working in my case. on the button click the command function should be executed, but its not. I have try many ways to solve it, but its still not working. Please, help me, i think there is a simple solution, but i cant see it as i beginner in using Noesis and WPF. My Unity3D version is 5.6.0f3 and Noesis version is 2.1.0b4. Project archive in Google Drive: ... sp=sharing
Thank you!
    xmlns:d="" xmlns:mc="" mc:Ignorable="d"
    x:Name="ButtonsControl" Height="190.345" Width="241.799">

    <ListView ItemsSource="{Binding MPValues}">
                <GridViewColumn  Header="#" DisplayMemberBinding="{Binding LiteralIndex}"/>

                <GridViewColumn >
                            <Button  Command="{Binding Path=DataContext.DeleteCommand, ElementName=DetailsController}" CommandParameter="{Binding LiteralIndex}" Content="Delete" />

using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using UnityEngine;
using Noesis.Samples;

public class Item
    public int LiteralIndex { get; set; }

public class Context
    public DelegateCommand DeleteCommand { get; private set; }
    public ObservableCollection<Item> MPValues { get; private set; }

    public Context()
        DeleteCommand = new DelegateCommand(OnDelete);
        MPValues = new ObservableCollection<Item>();

        for (int i = 0; i < 20; ++i)
            MPValues.Add(new Item { LiteralIndex = i });

    private void OnDelete(object param)
        int literalIndex = (int)param;
        int numItems = MPValues.Count;
        for (int i = 0; i < numItems; ++i)
            Item item = MPValues[i];
            if (item.LiteralIndex == literalIndex)

public class TestBehavior : MonoBehaviour
    void Start()
        var gui = GetComponent<NoesisView>();
        gui.Content.DataContext = new Context();



Re: ListView button column not working

Posted: 18 Oct 2017, 22:27
by sfernandez
Hi, the problem is with the Command binding. You are specifying:
<Button Command="{Binding Path=DataContext.DeleteCommand, ElementName=DetailsController}".../>
But the name of your root control (which contains the context exposing the DeleteCommand) is "ButtonsControl", so the binding should be:
<Button Command="{Binding Path=DataContext.DeleteCommand, ElementName=ButtonsControl}".../>

Re: ListView button column not working

Posted: 28 Oct 2017, 14:36
by fixer007
Yeah! Its working awesome!
Thank you very much!

Re: ListView button column not working

Posted: 28 Oct 2017, 14:54
by jsantos
Closing this!