首页 > 解决方案 > 将代码 xaml.cs 与其他类 .cs 组合

问题描述

我有个问题。在 WPF 中,我有一个列表视图,并且有可供选择的选项(单选按钮)。选项列表取自其他类的函数,并且可以正常工作(在 XAML.cs 中)。如果我从列表视图中选择选项,我想将选择选项的索引发送到其他类的函数(在 .cs 中)。我寻找我的问题的答案,但没有。请寻求帮助。谢谢你。对不起我的语言,但我不是母语人士。一段代码 XAML.cs 。我想发送变量表

    void selitemtables(object sender, SelectionChangedEventArgs args)
    {
        TranslateTable t = (TranslateTable)Listview_table.SelectedItem;
        int table = (int)Listview_table.SelectedIndex;

        MessageBox.Show(table.ToString());
        //MessageBox.Show("Selected: "+t);          
    }

我想在 .cs 中将变量表发送到这个函数

        public int chooseTable(int index)
    {

        return index;
    }

我想将表作为参数发送到 chooseTable(int index)

标签: c#xaml

解决方案


推荐阅读