静态资源样式引用到自定义控件
This commit is contained in:
1 parent
167885814e
commit
3fe394c8da
18 files changed
+191
-51
No files matched your search
@@ -24,5 +24,55 @@ namespace _29WxOrderWpf.BaseWindows
|
||||
InitializeComponent();
|
||||
this.DataContext = this;
|
||||
}
|
||||
|
||||
private static BaseMsgWindow CreateMsgForm(string msg, string caption, MsgWindowLevel fl)
|
||||
{
|
||||
BaseMsgWindow msgBox = new BaseMsgWindow { lblTitle = { Content = caption }, lblMsg = { Content = msg } };
|
||||
if (fl.Equals(MsgWindowLevel.LARGE))
|
||||
{
|
||||
msgBox.Width = (int)MsgWindowLevel.LARGE;
|
||||
msgBox.Height = 500;
|
||||
}
|
||||
msgBox.btnOk.Margin = new Thickness(msgBox.btnCancel.Margin.Left, msgBox.btnCancel.Margin.Top, msgBox.btnCancel.Margin.Right, msgBox.btnCancel.Margin.Bottom); // 把确认按钮移到取消按钮上面
|
||||
msgBox.btnCancel.Visibility = Visibility.Collapsed;
|
||||
return msgBox;
|
||||
}
|
||||
|
||||
public static BaseMsgWindow ShowConfirm(Window window, string msg, string caption = "", MsgWindowLevel fl = MsgWindowLevel.MEDIUM)
|
||||
{
|
||||
string title = string.IsNullOrEmpty(caption) ? "确认系统提示" : caption;
|
||||
BaseMsgWindow msgBox = new BaseMsgWindow
|
||||
{
|
||||
lblTitle = { Content = title },
|
||||
lblMsg = { Content = msg },
|
||||
imgTip = { Source = Application.Current.Resources["imgBaseMsgQue"] as ImageSource },
|
||||
};
|
||||
if (fl.Equals(MsgWindowLevel.LARGE))
|
||||
{
|
||||
msgBox.Width = (int)MsgWindowLevel.LARGE;
|
||||
msgBox.Height = 500;
|
||||
}
|
||||
if (window != null)
|
||||
msgBox.Owner = window;
|
||||
msgBox.ShowDialog();
|
||||
return msgBox;
|
||||
}
|
||||
|
||||
private void btnOk_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = true;
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = false;
|
||||
}
|
||||
}
|
||||
|
||||
public enum MsgWindowLevel
|
||||
{
|
||||
SMALL,
|
||||
MEDIUM,
|
||||
LARGE = 500
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user