Supplementary summary

1.wpf formatted string xaml

<TextBlock VerticalAlignment="Center" Foreground="#000080" HorizontalAlignment="Left" Text="{Binding, StringFormat='yyyy-MM-dd HH:mm:ss'}"></TextBlock>

2.wpf mvvm messaging

registered:

Messenger.Default.Register<string>(this, "WinClosed", (message) =>
{
this.Close();
});

Send a message:

Messenger.Default.Send<string>(string.Empty, "WinClosed");

3.wpf comes with pop-up messages

MessageBox.Show("信息!", "提示", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);

4.wpf mvvm RideoButton use

<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);
}
}

 

Guess you like

Origin www.cnblogs.com/ganzhihui/p/10966741.html