xmal UI :
<local:PreviewComboBox VerticalAlignment="Center" Width="100" >
<ComboBoxItem Content="1"></ComboBoxItem>
<ComboBoxItem Content="2"></ComboBoxItem>
<ComboBoxItem Content="3"></ComboBoxItem>
</local:PreviewComboBox>
Cutom control:
public class PreviewComboBox:ComboBox
{
bool CanHandle = true;
protected override void OnSelectionChanged(SelectionChangedEventArgs e)
{
if (e.RemovedItems.Count == 0)
{
base.OnSelectionChanged(e);
return;
}
else
{
if (CanHandle)
{
string type = (e.RemovedItems[0] as ComboBoxItem).Content.ToString();
string tips = string.Format("Are you sure make this change,it will