总结补充
1.wpf 在xaml 字符串格式化
<TextBlock VerticalAlignment="Center" Foreground="#000080" HorizontalAlignment="Left" Text="{Binding, StringFormat='yyyy-MM-dd HH:mm:ss'}"></TextBlock>
2.wpf mvvm消息传递
注册:
Messenger.Default.Register<string>(this, "WinClosed", (message) =>
{
this.Close();
});
消息发送:
Messenger.Default.Send<string>(string.Empty, "WinClosed");
3.wpf 自带消息弹出窗口
MessageBox.Show("信息!", "提示", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
4.wpf mvvm RideoButton的使用
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" >
<Label Foreground="OrangeRed" FontWeight="ExtraBlack" >检索类型:</Label>
<RadioButton MinWidth="100" Margin="10,0,0,0" Name="IsCheckedApplyCode" GroupName="ssif_1" IsChecked="{Binding CheckedValue, Converter={StaticResource}, ConverterParameter='1'}">1</RadioButton>
<RadioButton MinWidth="100" Margin="10,0,0,0" Name="IsCheckedTransfusionCode" GroupName="ssif_1" IsChecked="{Binding CheckedValue, Converter={StaticResource}, ConverterParameter='2'}">2</RadioButton>
<RadioButton MinWidth="100" Margin="10,0,0,0" Name="IsCheckedSickNo" GroupName="ssif_1" IsChecked="{Binding CheckedValue, Converter={StaticResource}, ConverterParameter='3'}">3</RadioButton>
<RadioButton MinWidth="100" Margin="10,0,0,0" Name="IsCheckedBardCode" GroupName="ssif_1" IsChecked="{Binding CheckedValue, Converter={StaticResource}, ConverterParameter='4'}">4</RadioButton>
</StackPanel>
/// <summary>
/// The <see cref="CheckedValue" /> property's name.
/// </summary>
public const string CheckedValuePropertyName = "CheckedValue";
private string _CheckedValue = "1";
/// <summary>
/// 搜索类型
/// </summary>
public string CheckedValue
{
get
{
return _CheckedValue;
}
set
{
if (_CheckedValue == value)
{
return;
}
_CheckedValue = value;
if (value == "1")
{
SearchTpye = Convert.ToInt32(SearchType.ApplyCode);
}
if (value == "2")
{
SearchTpye = Convert.ToInt32(SearchType.TransfusionCode);
}
if (value == "3")
{
SearchTpye = Convert.ToInt32(SearchType.ApplyNumber);
}
if (value == "4")
{
SearchTpye = Convert.ToInt32(SearchType.Barcode);
}
RaisePropertyChanged(CheckedValuePropertyName);
}
}