void initBindings() { //解体氚测量仪 Binding nowding1 = new Binding(); nowding1.Source = cabInArtwork.Devices[0]; nowding1.Path = new PropertyPath("NowValue"); Text1.SetBinding(TextBlock.TextProperty, nowding1); //1 3 号设备是pump ////房间氚测量仪 Binding nowding2 = new Binding(); nowding2.Source = cabInArtwork.Devices[2]; nowding2.Path = new PropertyPath("NowValue"); Text2.SetBinding(TextBlock.TextProperty, nowding2); }
public override void OnApplyTemplate() { base.OnApplyTemplate(); #region Initializing Controls, Bindings & events Text1 = (TextBlock)GetTemplateChild("Text1"); Binding DisplayText1Binding = new Binding("DisplayText1") { Source = this, Mode = BindingMode.TwoWay }; Text1.SetBinding(TextBlock.TextProperty, DisplayText1Binding); Text1.MouseDown += CampClicked; Text2 = (TextBlock)GetTemplateChild("Text2"); Binding DisplayText2Binding = new Binding("DisplayText2") { Source = this, Mode = BindingMode.TwoWay }; Text2.SetBinding(TextBlock.TextProperty, DisplayText2Binding); #endregion }