音乐播放列表,鼠标右键点击列表时,出现添加到歌单,做成每次右键点击时,后台新增选项了(也可以前台绑定数据源每次增删改后更新数据源)
TextBlock text = new TextBlock(); text.Text = "添加到歌单-" + list.Name; text.MouseDown += musicaddtolist; text.Margin= new Thickness(5); ListBoxItem item = new ListBoxItem(); item.DataContext = list; item.Content = text; this.musicRightConList.Items.Add(item);标签:控件,text,item,添加,后台,new,wpf From: https://www.cnblogs.com/fangxinliu/p/16913761.html