9 Replies Latest reply on Jun 10, 2016 2:32 PM by Oleg Bezyaev

    Use the full technology of WPF

    Oleg Bezyaev

      Someone tried to create a normal full applications with panels with WPF content and MVVM technology?

        • Re: Use the full technology of WPF
          John Kangas

          Unless something's changed recently, Solidworks only supports windows forms for task pane add-ins. That doesn't mean you're stuck, though. I've used WPF element host objects in a windows form in a Solidworks task pane add-in before, and Solidworks doesn't complain at all. It's my preferred method, in fact. Winforms can't touch wpf for dynamic layout in an unpredictably shaped space like the task pane.

            • Re: Use the full technology of WPF
              Oleg Bezyaev

              Hi John.

              With the technology itself WPF I am very familiar, but a triple jump SW (Object) -Panel (winform with ElementHost) -WPF Usercontrol - ViewModel, causing confusion.

              The primitive question: how to bind text in WPF textbox located in ElementHost panel with simple properties, for example as follows:

               

              <TextBox Text="{Binding TitleText, Mode=TwoWay}"/>
              

               

              private string _titleText;
                  public string TitleText
                  {
                      get { return _titleText; }
                      set
                      {
                          if (value == _titleText)
                              return;
                          _titleText = value;
                          this.OnPropertyChanged("TitleText");
                      }
                  } 
              
              
                public event PropertyChangedEventHandler PropertyChanged;
                  protected void OnPropertyChanged(string propertyName)
                  {
                      PropertyChangedEventHandler handler = this.PropertyChanged;
                      if (handler != null)
                          handler(this, new PropertyChangedEventArgs(propertyName));
                  }   
              

               

              When I enter text into the textbox, the property does not change.

               

              Or you directly injects itself WPF usercontrol in panel SW without ElementHost? But then, how the data is entered from the keyboard? If there is no handle - there is no keyboard input in a textbox.