views:

13

answers:

0

Hi,

I have some hardware with some controls to it. There are some visual controls I want to use in My WPF application. I have a binding Source object and a WPF with A TextBox To make it work I use the TextBox.TextChaned to execute some code that is among othere things painting my lines (from the list of points).

XAML

<TextBox Text="{Binding Path=ProcessedImage.Key, Mode=OneWay }"
 TextChanged="TextBox_TextChanged" Visibility="Collapsed"/>

Code behind

private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
{
  if (null != DataContext)
  {
    clsBindingDataDetailCameras lBindingData = DataContext as clsBindingDataDetailCameras;
    if (null != lBindingData)
    {
      RawImage.SetFullImagePart(lBindingData.OriginalImage);
      ProcessedImage.SetFullImagePart(lBindingData.ProcessedImage);
      lBindingData.OriginalImage.DispObj(RawImage.HalconWindow);
      lBindingData.ProcessedImage.DispObj(ProcessedImage.HalconWindow);

      RawImage.HalconWindow.SetColor("red");
      RawImage.HalconWindow.SetDraw("margin");
      ProcessedImage.HalconWindow.SetColor("red");
      ProcessedImage.HalconWindow.SetDraw("margin");
      foreach (clsYolkResult lItem in lBindingData.YolkResultList)
      {
        lItem.AOI.DispObj(RawImage.HalconWindow);
        lItem.AOI.DispObj(ProcessedImage.HalconWindow);
      }

      ProcessedImage.HalconWindow.SetColor("green");
      ProcessedImage.HalconWindow.SetDraw("fill");
      foreach (clsYolkResult lItem in lBindingData.YolkResultList)
      {
        lItem.YolkArea.DispObj(ProcessedImage.HalconWindow);
      }
    }
   }
}

My Question is: Is there an other way to astablish this without having to use the TextBox. I don't need a text box there. I just used it as a Handle to get triggerd on a BindingSource change?

Regard

jvdn