<?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 Binding to an object class property in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/binding-to-an-object-class-property/m-p/1571074#M12446</link>
    <description>&lt;P&gt;Hello.&amp;nbsp; I am trying to bind to a class property in a dock pane, but am having trouble doing so.&amp;nbsp; I can bind to a property on the dock pane, but not as part of a class object.&amp;nbsp; I have read many posts on the internet and it should not be that hard.&amp;nbsp; Here are snippets of what I currently have.&lt;/P&gt;&lt;P&gt;xaml:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;d:DataContext="{Binding Path=ui.AddressEditorDockPaneViewModel}"&amp;gt;

&amp;lt;TextBox Grid.Row="1" Grid.Column="0" MaxLength="5" x:Name="HseNo" Text="{Binding Path = pointAddress.HseNo, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Margin="3,3,3,3" TextWrapping="Wrap" VerticalAlignment="Top" Width="50" BorderBrush="Black" BorderThickness=".75" Background="Transparent"  Tag=""/&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Back-end c# class in ViewModel (AddressEditorDockPaneViewModel) with HseNo property:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public class PointAddress : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler? PropertyChanged;

    private static string _HseNo;
    public string HseNo
    {
        get { return _HseNo; }
        //set { SetProperty(ref _HseNo, value); }
        set
        {
            if (value == _HseNo)
                return;
            _HseNo = value.ToString();
            
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(HseNo)));
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Create a new PointAddress object (I have added this part in a couple of different forms (form level variable, and form level variable with creating new in the ShowAsync event):&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public PointAddress pointAddress = new PointAddress();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for helping!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 23 Dec 2024 23:51:38 GMT</pubDate>
    <dc:creator>GaryBilotta</dc:creator>
    <dc:date>2024-12-23T23:51:38Z</dc:date>
    <item>
      <title>Binding to an object class property</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/binding-to-an-object-class-property/m-p/1571074#M12446</link>
      <description>&lt;P&gt;Hello.&amp;nbsp; I am trying to bind to a class property in a dock pane, but am having trouble doing so.&amp;nbsp; I can bind to a property on the dock pane, but not as part of a class object.&amp;nbsp; I have read many posts on the internet and it should not be that hard.&amp;nbsp; Here are snippets of what I currently have.&lt;/P&gt;&lt;P&gt;xaml:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;d:DataContext="{Binding Path=ui.AddressEditorDockPaneViewModel}"&amp;gt;

&amp;lt;TextBox Grid.Row="1" Grid.Column="0" MaxLength="5" x:Name="HseNo" Text="{Binding Path = pointAddress.HseNo, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Margin="3,3,3,3" TextWrapping="Wrap" VerticalAlignment="Top" Width="50" BorderBrush="Black" BorderThickness=".75" Background="Transparent"  Tag=""/&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Back-end c# class in ViewModel (AddressEditorDockPaneViewModel) with HseNo property:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public class PointAddress : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler? PropertyChanged;

    private static string _HseNo;
    public string HseNo
    {
        get { return _HseNo; }
        //set { SetProperty(ref _HseNo, value); }
        set
        {
            if (value == _HseNo)
                return;
            _HseNo = value.ToString();
            
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(HseNo)));
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Create a new PointAddress object (I have added this part in a couple of different forms (form level variable, and form level variable with creating new in the ShowAsync event):&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public PointAddress pointAddress = new PointAddress();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for helping!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2024 23:51:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/binding-to-an-object-class-property/m-p/1571074#M12446</guid>
      <dc:creator>GaryBilotta</dc:creator>
      <dc:date>2024-12-23T23:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: Binding to an object class property</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/binding-to-an-object-class-property/m-p/1571084#M12447</link>
      <description>&lt;P&gt;It looks like the issue lies in how the binding is set up and how the pointAddress object is exposed in your AddressEditorDockPaneViewModel. The key is to make sure that pointAddress is properly exposed as a property in the view model and is part of the data context hierarchy.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In your AddressEditorDockPaneViewModel, make sure pointAddress is a property and not just a field. For example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public event PropertyChangedEventHandler? PropertyChanged;

    private PointAddress _pointAddress = new PointAddress();
    public PointAddress PointAddress
    {
        get { return _pointAddress; }
        set
        {
            if (_pointAddress == value)
                return;

            _pointAddress = value;
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(PointAddress)));
        }
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;Update your TextBox binding to use the PointAddress property in the view model&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;TextBox Grid.Row="1" Grid.Column="0" MaxLength="5" x:Name="HseNo" 
         Text="{Binding Path=PointAddress.HseNo, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
         HorizontalAlignment="Left" Margin="3,3,3,3" TextWrapping="Wrap" 
         VerticalAlignment="Top" Width="50" BorderBrush="Black" BorderThickness=".75" 
         Background="Transparent" Tag=""/&amp;gt;
​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Please check this also in your xaml.cs , sometimes I also forget:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public partial class AddressEditorDockPane : UserControl
{
    public AddressEditorDockPane()
    {
        InitializeComponent();
        DataContext = new AddressEditorDockPaneViewModel();
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Dec 2024 04:50:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/binding-to-an-object-class-property/m-p/1571084#M12447</guid>
      <dc:creator>SumitMishra_016</dc:creator>
      <dc:date>2024-12-24T04:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: Binding to an object class property</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/binding-to-an-object-class-property/m-p/1572113#M12453</link>
      <description>&lt;P&gt;Thank you!!!!!!!&amp;nbsp; This helped immensely!!!&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2025 15:58:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/binding-to-an-object-class-property/m-p/1572113#M12453</guid>
      <dc:creator>GaryBilotta</dc:creator>
      <dc:date>2025-01-02T15:58:30Z</dc:date>
    </item>
  </channel>
</rss>

