Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
About my WPF app to draw a Bolt Hole Pattern.
Message
De
30/07/2008 14:50:34
 
 
À
30/07/2008 10:58:38
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Divers
Thread ID:
01334102
Message ID:
01335334
Vues:
12
Well... I found two errors to start with.
     private void NotifyPropertyChanged(String info)
        {
        if (PropertyChanged != null)
          {
          PropertyChanged(this, new PropertyChangedEventArgs(info));
          //CollectionChanged was null commented it off
          //CollectionChanged(this, new CollectionChangeEventArgs(CollectionChangeAction.Refresh, this.HoleList));
          }
        }
Second was that repaint screen was not getting called. You are binding to CurrentHolePattern so:
CurrentHolePattern.PropertyChanged += new PropertyChangedEventHandler(CurrentHolePattern_PropertyChanged);
This looks like it works:
    public Window1()
      {

      HolePatterns = new ObservableCollection<HolePattern>();
      HolePatterns.CollectionChanged += new NotifyCollectionChangedEventHandler(HolePatterns_CollectionChanged);

      CurrentHolePattern = new HolePattern();
      CurrentHolePattern.PatternName = "Test Pattern Name";

      //-- Set some default values for the UI
      CurrentHolePattern.BoltCirDia = 12.0;
      CurrentHolePattern.HoleCount = 6;
      CurrentHolePattern.StartAngle = 0;

      HolePatterns.Add(CurrentHolePattern);

      InitializeComponent();
      CurrentHolePattern.PropertyChanged += new PropertyChangedEventHandler(CurrentHolePattern_PropertyChanged);

      SketchX0 = canvas1.Width / 2;
      SketchY0 = canvas1.Height / 2;
      SketchBoltCirRad = canvas1.Width / 2 * .7;

      CoordinateGrid.ItemsSource = CurrentHolePattern.HoleList;

      RedrawScreen();
      }
 
    void CurrentHolePattern_PropertyChanged(object sender, PropertyChangedEventArgs e)
      {
      RedrawScreen();
      //RepaintScreen();  Repaint doesn't add new holes.
      }
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform