http://www.cnblogs.com/huangxincheng/archive/2012/06/17/2552322.html
Wpf中Application的生命周期
1:OnStartup方法 => Startup 事件
2: OnSessionEnding方法 => SessionEnding 事件
系统关机前调用。
3:OnExit方法 => Exit事件
应用程序关闭前调用。
4:OnActivated方法 => Activated 事件
应用程序获得焦点的时候触发。
5:OnDeactivated方法 => DeActivated事件
应用程序失去焦点的时候触发。
全局异常获取
this.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler(...);
x:Static
xmal:
<TextBox Height="23" Text="{x:Static local:MainWindow.name}" Margin="87,75,0,0" Name="textBox1" Width="120" />cs:
public static string name = "名字";
x:null
xaml中某某控件设为null就靠它了。
1 <Grid> 2 <TextBox Height="23" Text="{x:Null}" 3 Margin="87,75,0,0" Name="textBox1" Width="120" /> 4 </Grid>
DataTrigger,MultiDataTrigger
6 <Window.Resources> 7 <Style x:Key="childStyle" TargetType="Control"> 8 <Setter Property="Background" Value="BurlyWood"/> 9 <Style.Triggers> 10 <!-- 绑定当前的radio单选框,如果按钮选中,触发字体设置 --> 11 <DataTrigger Binding="{Binding ElementName=radio, Path=IsChecked}" Value="True"> 12 <Setter Property="FontSize" Value="20"/> 13 </DataTrigger> 14 </Style.Triggers> 15 </Style> 16 </Window.Resources> 17 <Grid> 18 <RadioButton Style="{StaticResource ResourceKey=childStyle}" 19 Name="radio" Content="我要变成20号字"></RadioButton> 20 </Grid>