Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
About my WPF app to draw a Bolt Hole Pattern.
Message
From
31/07/2008 04:02:41
 
 
To
30/07/2008 14:50:34
General information
Forum:
ASP.NET
Category:
Windows Presentation Foundation (WPF)
Miscellaneous
Thread ID:
01334102
Message ID:
01335445
Views:
11
>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.
>      }
>
Dang. Just read this. I pulled in Matt's code last night and had made *exactly* the same changes that you pointed out. But then it would not run - I got a XMLParseException:
Cannot create instance of 'Window1' defined in assembly 'WpfApplication1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Exception has been thrown by the target of an invocation. Error in markup file 'Window1.xaml' Line 1 Position 9.

Didn't have time to look at it any more and don't now either but it's still giving that error unless the RedrawScreen() line is commented out in the event handler.
???
Regards,
Viv
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform