随笔分类 -  WPF

摘要:VS2008下的实现方式:1.在项目里面引入一个图片,编译属性设为资源,然后在App.xaml.cs里面重载OnStartup方法: public partial class App : Application { protected override void OnStartup(StartupEventArgs e) { SplashScreen splashScreen = new SplashScreen("pic.jpg"); splashScreen.Show(true); base.OnStartup(e); } }如果是窗体... 阅读全文
posted @ 2011-12-20 19:30 .net万剑 阅读(3316) 评论(0) 推荐(0)
摘要:<TextBox x:Name="tbSeach" Height="25" Width="60" HorizontalAlignment="Center" VerticalAlignment="Top" TextChanged="tbSeach_TextChanged"/> private void tbSeach_TextChanged(object sender, TextChangedEventArgs e) { _seachfooList = new Li 阅读全文
posted @ 2011-07-21 15:23 .net万剑 阅读(4073) 评论(2) 推荐(3)
摘要:WPF的DataGrid是自动刷新的,哪个Cell的值有变化就会刷新这个是绑定完成的,不过有个前提条件就是,当你改变绑定数据源的数值的时候,必须要让你的UI知道这个数据发生变化了,比如如果你的属性完成了INotifyPropertyChanged接口,这样无论你DataGrid发生变化,还是属性发生变化,你的UI和你后台的数据是时刻同步的,同时 属性变化的时候DataGrid也会自动刷新。View Code public class Export : INotifyPropertyChanged { public decimal _GoodsAPrice; public int GoodsCo 阅读全文
posted @ 2011-06-22 16:08 .net万剑 阅读(2787) 评论(2) 推荐(0)
摘要:int selectIndex = dgExport.SelectedIndex; ICollectionView view = (ICollectionView)CollectionViewSource.GetDefaultView(dgExport.ItemsSource); List<Export> items = new List<Export>(); items = (List<Export>)view.SourceCollection; items.RemoveAt(selectIndex); dgExport.Items.Refresh(); 阅读全文
posted @ 2011-06-20 17:25 .net万剑 阅读(7957) 评论(1) 推荐(1)
摘要:<Window.Resources> <DataTemplate x:Key="ItemTemplate"> <TextBlock Text="{Binding}" Foreground="Red" /> </DataTemplate> <DataTemplate x:Key="SelectedTemplate"> <TextBlock Text="{Binding}" Foreground="White" / 阅读全文
posted @ 2011-06-01 11:22 .net万剑 阅读(886) 评论(0) 推荐(0)
摘要:添加命名空间:using System.Windows.Forms;using System.Drawing;随后引用一个Dll : C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll现在我们就能直接使用winform的调色板控件了。 ColorDialog colorDialog = new ColorDialog(); colorDialog.AllowFullOpen = true; colorDialog.ShowDialog(); System.Windows.Media.SolidColorBrush s 阅读全文
posted @ 2011-05-30 10:55 .net万剑 阅读(3223) 评论(0) 推荐(2)
摘要:第一种方法:直接在Page或frame加载页面 Click here 第二种方法:调用系统浏览器加载指定页面 Click here privatevoid Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e){ Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri)); e.Handled =true;} 阅读全文
posted @ 2011-05-30 09:26 .net万剑 阅读(4990) 评论(2) 推荐(1)
摘要:1 CheckBox cbSelect = (CheckBox)(ListBoxView.Items[i] as ListBoxItem).Template.FindName("cbSelect", ListBoxView.Items[i] as ListBoxItem);2 TextBlock textblackConnPointNum = (TextBlock)(ListBoxView.Items[i] as ListBoxItem).Template.FindName("textblackConnPointNum", ListBoxView.Ite 阅读全文
posted @ 2011-05-24 12:41 .net万剑 阅读(13272) 评论(0) 推荐(2)
摘要:WPF 和WinForm的MeeageBox不同View Code if(MessageBox.Show("内容", "标题", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes){} 阅读全文
posted @ 2011-05-10 10:03 .net万剑 阅读(5478) 评论(0) 推荐(1)
摘要:后台代码: 1 private static bool boolean = true; 2 3 public static bool Boolean 4 { 5 get { return MainWindow.boolean; } 6 set { MainWindow.boolean = value; } 7 } 8 9 private void errorBtn_Click(object sender, RoutedEventArgs e)10 {11 dialogWindow.Title = "Error";12 dialogWindow = new DialogWin 阅读全文
posted @ 2011-04-15 19:49 .net万剑 阅读(1712) 评论(0) 推荐(0)
摘要:1 <Button Style="{DynamicResource DefalutButton}" FocusVisualStyle="{x:Null}" Height="21" Tag="111" Width="49" Canvas.Left="72" Canvas.Top="172" HorizontalAlignment="Left" Margin="2.333,60,0,0" VerticalAlign 阅读全文
posted @ 2011-04-07 16:05 .net万剑 阅读(4243) 评论(0) 推荐(0)
摘要:KeyDown事件:2011-04-28优化Tab And RightCtrl private void tbCount_KeyDown(object sender, KeyEventArgs e) { TextBox txt = sender as TextBox; //屏蔽非法按键 if ((e.Key >= Key.NumPad0 && e.Key <= Key.NumPad9) || e.Key == Key.Decimal || e.Key.ToString() == "Tab") { if (txt.Text.Contains(&qu 阅读全文
posted @ 2011-03-14 15:11 .net万剑 阅读(10863) 评论(2) 推荐(5)