This is a migrated thread and some comments may be shown as answers.

Window has no .show

1 Answer 71 Views
Window
This is a migrated thread and some comments may be shown as answers.
Stephan
Top achievements
Rank 1
Stephan asked on 14 Dec 2012, 01:29 AM
I used the RadControlsScenario to create a Window just to see how it works and things went well until I tried to Compile and open it.   The first think I found was no RadControlsScenario.Show(), How do you show the window.  The second is The name 'InitializeComponent' does not exist in the current context.  My namespace is the same as the main window that would be calling it.

An object reference is required for the non-static field, method, or property 'System.Windows.Window.ShowDialog()'

Built with RadControl Scenario
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Threading.Tasks;
using Telerik.Windows.Controls;
 
namespace My.Controls
{
    /// <summary>
    /// Interaction logic for RadSalesPersonRCS1.xaml
    /// </summary>
    public partial class RadSalesPersonRCS1 : Window
    {
        public RadSalesPersonRCS1()
        {
            InitializeComponent();
        }
    }
}

Where I try to open it from my main Window
private void MenuItem_ViewSalesPerson(object sender, RoutedEventArgs e)
      {
          RadSalesPersonRCS1 salesperson = new RadSalesPersonRCS1();
          RadSalesPersonRCS1.ShowDialog();
           
      }



1 Answer, 1 is accepted

Sort by
0
Boyan
Telerik team
answered on 18 Dec 2012, 02:00 PM
Hello Stephan,

RadControlScenario should add new RadWindow as UserControl, and you should create new instance of it in your code and use its Show() method as shown in this help article. As far as I can see there is a Microsoft Window instead of RadWindow in the code you send us. So you could try to replace Window with RadWindow and also check if the correct Telerik binaries are added to the references of the project(although they should be added by default when use Telerik scenario).

If you are still having this problem, could you please send us a sample project in order to investigate it further.

Kind regards,
Boyan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Window
Asked by
Stephan
Top achievements
Rank 1
Answers by
Boyan
Telerik team
Share this question
or