c# - 将代码 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)
解决方案
推荐阅读
- node.js - 序列化子查询
- ibm-mq - 本地队列未出现在队列文件夹下
- python - 多项选择python测验:随机选择的问题,使用文本文件和列表的随机排序答案
- python-3.x - 熊猫根据所选列的重复值排列行
- javascript - DOM node.remove() 不会使 Javascript 变量引用无效。如何解决?
- sql - 如何摆脱我的时间数据中的默认日期“1899-12-30”
- r - 不知道如何将“x”转换为“日期”类
- r - 如何在 r 中编写一个函数来对记录进行计算?
- php - 如何从 Laravel Controller(Laravel 最新版本)的查询结果中导出 excel 文件?
- artifactory - 修复将工件上传到工件时的 CHECKSUM 错误