<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Updating View with MVVM in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/updating-view-with-mvvm/m-p/12678163#M6203</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8870081"&gt;@retug_austin&lt;/a&gt;&amp;nbsp;:&lt;/P&gt;&lt;P&gt;i download u code and debug this , if u want changed type and trigged the window , need to change the code to this , also can add this code `d:DataContext="{d:DesignInstance Type = local:MainViewModel}"` to u mainwindow xaml&amp;nbsp; ,&amp;nbsp; this is easy ,so i not push this code to u github .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;public class MainViewModel : INotifyPropertyChanged{&lt;/P&gt;&lt;P&gt;private ObservableCollection&amp;lt;RevitFramingModel&amp;gt; _structuralFramingElements = new ObservableCollection&amp;lt;RevitFramingModel&amp;gt;();&lt;/P&gt;&lt;P&gt;public ObservableCollection&amp;lt;RevitFramingModel&amp;gt; StructuralFramingElements&lt;BR /&gt;{&lt;BR /&gt;get { return _structuralFramingElements; }&lt;BR /&gt;set&lt;BR /&gt;{&lt;BR /&gt;_structuralFramingElements = value;&lt;BR /&gt;PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(StructuralFramingElements)));&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;</description>
    <pubDate>Mon, 01 Apr 2024 06:43:33 GMT</pubDate>
    <dc:creator>scgq425</dc:creator>
    <dc:date>2024-04-01T06:43:33Z</dc:date>
    <item>
      <title>Updating View with MVVM</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/updating-view-with-mvvm/m-p/12677646#M6202</link>
      <description>&lt;P&gt;I made a recent post &lt;A href="https://forums.autodesk.com/t5/revit-api-forum/revit-and-mvvm/m-p/12657030#M77652" target="_blank" rel="noopener"&gt;here&lt;/A&gt;&amp;nbsp;about MVVM and keeping a list of selected elements updated with updates in the Revit model.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have made some progress after the guidance provided in that first post, but still running into an issue I can't seem to resolve. After some review, it seemed like &lt;A href="https://www.revitapidocs.com/2024/cbbbc4aa-671f-4ea7-c584-dc7181fa4440.htm" target="_blank" rel="noopener"&gt;IUpdater interface&lt;/A&gt; would be the best way to keep my view up to date with the revit model changes. Full code on &lt;A href="https://github.com/retug/LearningCSharp/tree/main/MVVM" target="_blank" rel="noopener"&gt;github&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Debugging in the Execute command, the model elements are correctly revised based on updates in performed in the revit model (see if gif below, one of the items changes from a W18x40 to a W21x44, the list of IEnumerable&amp;lt;RevitFramingModel&amp;gt; structuralFramingElements is correctly updated while debugging)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Recording 2024-03-31 at 14.43.09.gif" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1344102i259019F51C09C618/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Recording 2024-03-31 at 14.43.09.gif" alt="Recording 2024-03-31 at 14.43.09.gif" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem, the datagrid view is not updated with this data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know where my problem is? I can't figure out why the view won't update.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="retug_austin_0-1711918258692.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1344104iC349327F9035FDE6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="retug_austin_0-1711918258692.png" alt="retug_austin_0-1711918258692.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 31 Mar 2024 20:52:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/updating-view-with-mvvm/m-p/12677646#M6202</guid>
      <dc:creator>retug_austin</dc:creator>
      <dc:date>2024-03-31T20:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: Updating View with MVVM</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/updating-view-with-mvvm/m-p/12678163#M6203</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8870081"&gt;@retug_austin&lt;/a&gt;&amp;nbsp;:&lt;/P&gt;&lt;P&gt;i download u code and debug this , if u want changed type and trigged the window , need to change the code to this , also can add this code `d:DataContext="{d:DesignInstance Type = local:MainViewModel}"` to u mainwindow xaml&amp;nbsp; ,&amp;nbsp; this is easy ,so i not push this code to u github .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;public class MainViewModel : INotifyPropertyChanged{&lt;/P&gt;&lt;P&gt;private ObservableCollection&amp;lt;RevitFramingModel&amp;gt; _structuralFramingElements = new ObservableCollection&amp;lt;RevitFramingModel&amp;gt;();&lt;/P&gt;&lt;P&gt;public ObservableCollection&amp;lt;RevitFramingModel&amp;gt; StructuralFramingElements&lt;BR /&gt;{&lt;BR /&gt;get { return _structuralFramingElements; }&lt;BR /&gt;set&lt;BR /&gt;{&lt;BR /&gt;_structuralFramingElements = value;&lt;BR /&gt;PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(StructuralFramingElements)));&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 06:43:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/updating-view-with-mvvm/m-p/12678163#M6203</guid>
      <dc:creator>scgq425</dc:creator>
      <dc:date>2024-04-01T06:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: Updating View with MVVM</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/updating-view-with-mvvm/m-p/12678744#M6204</link>
      <description>&lt;P&gt;Thanks a ton &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7278275"&gt;@scgq425&lt;/a&gt;&amp;nbsp;, this worked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May I ask, why did you switch from IEnumerable to ObservableCollection on _stucturalFramingElements and StructuralFramingElements?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So cool seeing these sync'd up:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Recording 2024-04-01 at 07.40.34.gif" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1344286iE833A3B9D050900D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Recording 2024-04-01 at 07.40.34.gif" alt="Recording 2024-04-01 at 07.40.34.gif" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 13:42:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/updating-view-with-mvvm/m-p/12678744#M6204</guid>
      <dc:creator>retug_austin</dc:creator>
      <dc:date>2024-04-01T13:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: Updating View with MVVM</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/updating-view-with-mvvm/m-p/12678913#M6205</link>
      <description>&lt;P&gt;When working with '&lt;STRONG&gt;Binding&lt;/STRONG&gt;' and a list of objects, it is better to use the '&lt;STRONG&gt;ObservableCollection&lt;/STRONG&gt;'.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The '&lt;STRONG&gt;ObservableCollection&lt;/STRONG&gt;' has the '&lt;STRONG&gt;INotifyPropertyChanged&lt;/STRONG&gt;' and '&lt;STRONG&gt;INotifyCollectionChanged&lt;/STRONG&gt;', if you add or remove an element by default the UI gonna be updated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 14:56:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/updating-view-with-mvvm/m-p/12678913#M6205</guid>
      <dc:creator>ricaun</dc:creator>
      <dc:date>2024-04-01T14:56:15Z</dc:date>
    </item>
  </channel>
</rss>

