Device Nodemap Property Changed Event

Hello,

I am currently trying to get known to the WPF GenApiGrid. I saw there are multiple NodeMaps on a device since I have a real camera now. I think I only need the “Device” Nodemap to configure camera settings. As of now I bound the NodeMap of the GenApiGrid a property in my ViewModel, but since the Device.NodeMaps Dictionary is readonly I can´t update the changed NodeMap to the device.
I remember on the old WinForms GenApiGrid there was an event PropertyChanged or something like that. I can´t find this one on the WPF GenApiGrid.
Could someone point me into the right direction if it’s possible to update the Device NodeMap using Bindings?

Hi @johmarjac,

you can bind the grid’s node map to a view model’s property or to a property of the code behind. For an example for the second case see our tutorial

%CVB%\Tutorial\Image Manager\Cvb.Net\WpfGenICam

Here is the code extract:

<ComboBox Name="nodeMapComboBox" Grid.Row="0"
          ItemsSource="{Binding NodeMaps, ElementName=mainWindow}"
          DisplayMemberPath="Key" SelectedValuePath="Value">
  <ComboBox.Style>
    <!--#region Disable if no NodeMaps -->
    <Style TargetType="ComboBox">
      <Setter Property="IsEnabled" Value="True" />
      <Style.Triggers>
        <DataTrigger Binding="{Binding NodeMaps,ElementName=mainWindow}" Value="{x:Null}">
          <Setter Property="IsEnabled" Value="False" />
        </DataTrigger>
      </Style.Triggers>
    </Style>
    <!--#endregion-->
  </ComboBox.Style>
</ComboBox>
        
<cvb:GenApiGrid x:Name="genApiGrid" Grid.Row="2"
                NodeMap="{Binding SelectedValue, ElementName=nodeMapComboBox}"/>

If you want to use MVVM just remove the , ElementName=mainWindow entries from the ComboBox to bind against the ViewModel. Important here are also the DisplayMemberPath="Key" SelectedValuePath="Value" which use the dictionary’s key for the entries in the ComboBox and the NodeMap as the stored value. Against this value the GenApiGrid can bind (SelectedValue).

The property changed event is for changes in displayed (visible) GenApi Nodes by the way, not for the different NodeMaps.

Hi @parsd,

That makes totally sense. Unfortunately I didn’t found that sample earlier. Thanks for helping me out. I got that working now :slight_smile: