随笔分类 - wpf
摘要:IsMouseOver鼠标经过时,IsPressed鼠标点击时 <Style TargetType="{x:Type Button}"> <Setter Property="Foreground" Value="White" /> <Setter Property="Background" Valu
阅读全文
摘要:img_backpic.Source = new BitmapImage(new Uri(path, UriKind.RelativeOrAbsolute)); UriKind有3种类型:RelativeOrAbsolute/Absolute/Relative,这里测试用了RelativeOrAbs
阅读全文
摘要:有一个功能需要在后台修改App.xaml中的<Application.Resources>的Style App.xaml中如下 <Style x:Key="firstColor" TargetType="Border"> <Setter Property="Background" Value="{D
阅读全文
摘要:wpf获取ListBox的选中项,SelectionMode="Extended",可以选中多个,直接用 Aaa[] selects = (Aaa[])this.lb_id.SelectedItems 报错,可用写法: Aaa[] selects = this.lb_id.SelectedItems
阅读全文
摘要:wpf控件的MouseEnter事件中设置5秒后隐藏控件 System.Timers.Timer timer = new System.Timers.Timer(5 * 1000);//5秒 timer.Elapsed += new System.Timers.ElapsedEventHandler
阅读全文
摘要:转载:调用线程无法访问此对象,因为另一个线程拥有该对象。 wpf控件MouseEnter绑定了事件,用Timer设置一段时间后执行时报异常 解决方法: this.Dispatcher.Invoke((Action)delegate () { //实现 }); 或 App.Current.Dispat
阅读全文
摘要:16进制、rgb格式、提供的颜色示例: xxx.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFF")); xxx.Background = new SolidColorBrush(Col
阅读全文
摘要:音乐播放列表,鼠标右键点击列表时,出现添加到歌单,做成每次右键点击时,后台新增选项了(也可以前台绑定数据源每次增删改后更新数据源) TextBlock text = new TextBlock(); text.Text = "添加到歌单-" + list.Name; text.MouseDown +
阅读全文
摘要:参考:http://www.360doc.com/content/17/1113/11/24811_703389993.shtml // 1)子页面后台定义委托 (namespace下class外) //定义委托 internal delegate void ColorChange(object s
阅读全文
摘要:想做成选择颜色后,更换窗体主题颜色 1、在App.xaml中记录当前颜色 <Application.Resources> <SolidColorBrush x:Key="color1" Color="White"></SolidColorBrush> </Application.Resources>
阅读全文
摘要:数据源list,设置ListBoxItem实现 <Page.Resources> <Style TargetType="ListBoxItem"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Lis
阅读全文