No path is too difficult. No destination is too far !
Posts tagged WPF
How to detect resolution of client in WPF?
Feb 18th
I was wondering about how to detect scrren resolution for client’s machine in wpf. I searched internet, tried googling but in vein.
Here is the snippet that can help the folks looking for similar solution.
// Detect screen height available. Remember it is the inner area of screen.
SystemParameters.FullPrimaryScreenWidth
// Detect screen width available. Remember it is the inner area of screen.
SystemParameters.FullPrimaryScreenHeight;
How to open popup in wpf?
Feb 16th
This is the code to open a popup window in wpf.
We need to create an empty window for popup and we’ll assign the object of the WPF Window to it. In this example we wre trying to open PopupForm.xaml as popup.
private void OpenPopup()
{
var oPopupForm = new ucPopupFormPopup();// create POPUP window
var oWindow = new Window();//setting up its starting position
oWindow.WindowStartupLocation =WindowStartupLocation.CenterScreen;// we can make it available or not in taskbar
oWindow.ShowInTaskbar =false;oWindow.Width = 630;
oWindow.Height = 500;
oWindow.ResizeMode =ResizeMode.NoResize;
oWindow.Title =”Ashish Sehajpal – Trying WPF”;// Access Popup’s Controls
oPopupForm.TextBox1.Text = “Ashish Sehajpal is here.”;// Assign Form to Popup window
oWindow.Content = oPopupForm;// If you need to do some action on popup’s closing
// Assignt the event handler to it
oWindow.Closing += oWindow_Closing;
// it’s time to show POPUP
oWindow.ShowDialog();}
// eventhandler for the popup closeing event
private void oWindow_Closing(object sender, CancelEventArgs e)
{
// do something nice here
}