Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
160
XamTextEditor Data Binding
posted

I am trying to bind a XamTextEditor to a Column in a DataRow. The binding works fine until I click on the textbox. Once it receives focus it marks the underlying DataRow as changed. You can see this in action by running the sample I have provided below. Changing to a MS textbox changes the behavior to what I would expect. Are there any workarounds to this?

Xaml:
<Window x:Class="Penta.Test.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:igEditors="http://infragistics.com/Editors"
        Title="Window1"
        Height="300"
        Width="300">
  <StackPanel>
    <igEditors:XamTextEditor Text="{Binding Path=TestColumn}"/>
    <!--<TextBox Text="{Binding Path=TestColumn}" />-->
    <Button Click="Button_Click">Click Me</Button>
  </StackPanel>
</Window>

C#:
public partial class Window1 : Window
  {
    private DataSet _dataSet;
    public Window1()
    {
      InitializeComponent();
   
      _dataSet = new DataSet();
      DataTable dataTable = _dataSet.Tables.Add("Test");
      DataColumn testColumn = dataTable.Columns.Add("TestColumn", typeof(String));
     
      DataRow dataRow = dataTable.NewRow();
      dataRow[testColumn] = "Value";
      dataTable.Rows.Add(dataRow);
      _dataSet.AcceptChanges();

      this.DataContext = dataTable.DefaultView[0];

      dataTable.ColumnChanged += new DataColumnChangeEventHandler(dataTable_ColumnChanged);
    }

    void dataTable_ColumnChanged(object sender, DataColumnChangeEventArgs e)
    {
      MessageBox.Show("I am changing now");
    }

    private void Button_Click(object sender, RoutedEventArgs e)
    {
      MessageBox.Show(_dataSet.HasChanges().ToString());
    } 
  }

  • 138253
    Offline posted

    Hello,

     

    After some research our development team conclude that this behavior is expected, because there's another control inside the editor (in the case of XamTextEditor there's a TextBox inside it), which is given focus immediately when the editor gets the focus. This causes the editor to lose focus (and its LostFocus to be raised), however the focus is still within the editor. A better event to use might be the IsKeyboardFocusWithinChanged event (which is exposed by Control base class), which gets raised when the keyboard focus moves completely out of a control.

  • 138253
    Offline posted

    Hello,

     

    I have logged this with development under ID: 84623 and I have also created a support ticket on your behalf: CAS-70609-2YQDJG and have linked the development issue to it, so that you can get automatically updated, when a Service Release containing the fix is available for download. You can get the new version from our website’s “My IG”, “My Keys & Downloads” tags: https://es.infragistics.com/Membership/Default.aspx?panel=Downloads#Downloads

     

    You can also monitor the support ticket’s progress through the “My Support Activity” tag: https://es.infragistics.com/Membership/MySupport.aspx