WPF 开发备忘录
运营日:
select t.* |
;f:datetime -时间日期格式
;f:fen -表示单价分
--
在查询结果后面增加一行自定义数据
union all
select distinct ' ' as name, a from v
instr(字段,'关键字')>0
例如 like %关键字% 等同于 instr(字段,'关键字')>0
ComboBox 静态值绑定
No.1
[数据字典方式]
-----
#>前台代码:
<ComboBox Name="name" ItemsSource="{Binding}" />
#>后台代码:
public MainWindow()
{
InitializeComponent();
Dictionary<int, string> mydic = new Dictionary<int, string>()
{
{1,"a"},
{2,"b"},
{3,"c"}
};
combobox.ItemsSource = mydic;
combobox.SelectedValuePath = "Key";
combobox.DisplayMemberPath = "Value";
payId.SelectedIndex = 0;
}
No.1
[增加一项]
-----
#>VM代码:
public List<BasiStationInfo> StationInfo { get; private set; }
public void GetStationInfo()
{
string line_id = SysConfig.GetSysConfig().LocalParamsConfig.LineCode;
string sql = string.Format("select * from basi_station_info where line_id='{0}'", line_id);
StationInfo = DBCommon.Instance.GetTModelValue<BasiStationInfo>(sql);
BasiStationInfo info = new BasiStationInfo();
info.station_id = "0000";
info.station_cn_name = "全部车站";
StationInfo.Insert(0, info);
}
No.2
-----
#>VM代码:
public List<BasiStationInfo> StationInfo { get; private set; }
string sqlStation = "select * from basi_station_info t ";
this.StationInfo = DBCommon.Instance.GetTModelValue<BasiStationInfo>(sqlStation);
if (this.StationInfo == null)
this.StationInfo = new List<BasiStationInfo>();
this.StationInfo.Insert(0, new BasiStationInfo() { station_id = "全部车站", station_cn_name = "全部车站" });
this.station_id = "全部车站";
No.3
[代码示例]
-----
#>VM代码:
private List<ModeCodeInfo> modeInfo;
/// <summary>
/// 发起方
/// </summary>
public List<ModeCodeInfo> ModeInfo
{
get { return modeInfo; }
set { modeInfo = value; NotifyPropertyChanged("ModeInfo"); }
}
public void GetModeInfo()
{
this.ModeInfo.Clear();
this.ModeInfo.Add(new ModeCodeInfo() { set_origin_id = "全部", set_origin = "全部" });
this.ModeInfo.Add(new ModeCodeInfo() { set_origin_id = "FAS", set_origin = "1" });
this.ModeInfo.Add(new ModeCodeInfo() { set_origin_id = "SC", set_origin = "2" });
this.SetOriginID = "全部";
}
#>Model代码:
public class ModeCodeInfo
{
private string _set_origin;
/// <summary>
/// 发起方
/// </summary>
public string set_origin
{
get { return _set_origin; }
set { _set_origin = value; NotifyPropertyChanged("set_origin"); }
}
private string _set_origin_id;
/// <summary>
/// 发起方名称
/// </summary>
public string set_origin_id
{
get { return _set_origin_id; }
set { _set_origin_id = value; NotifyPropertyChanged("set_origin_id"); }
}
public override string ToString()
{
return set_origin_id;
}
}
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 智能桌面机器人:用.NET IoT库控制舵机并多方法播放表情
· Linux glibc自带哈希表的用例及性能测试
· 深入理解 Mybatis 分库分表执行原理
· 如何打造一个高并发系统?
· .NET Core GC压缩(compact_phase)底层原理浅谈
· 手把手教你在本地部署DeepSeek R1,搭建web-ui ,建议收藏!
· 新年开篇:在本地部署DeepSeek大模型实现联网增强的AI应用
· Janus Pro:DeepSeek 开源革新,多模态 AI 的未来
· 互联网不景气了那就玩玩嵌入式吧,用纯.NET开发并制作一个智能桌面机器人(三):用.NET IoT库
· 【非技术】说说2024年我都干了些啥