private void LayoutRoot_Loaded(object sender, RoutedEventArgs e) { Binding redoBind = new Binding(); redoBind.Path = new PropertyPath("ISLEVEL"); redoBind.Mode = BindingMode.TwoWay; BoolConvert bc = new BoolConvert(); bc.IsYes = true; redoBind.Converter = bc; this.rbtYes.SetBinding(RadioButton.IsCheckedProperty, redoBind); Binding redoBindto = new Binding(); redoBindto.Path = new PropertyPath("ISLEVEL"); redoBindto.Mode = BindingMode.TwoWay; BoolConvert bcTo = new BoolConvert(); bcTo.IsYes = false; redoBindto.Converter = bcTo; this.RbtNo.SetBinding(RadioButton.IsCheckedProperty, redoBindto); Binding postBind = new Binding(); CompanyInfoConverter converterPost = new CompanyInfoConverter(); postBind.Converter = converterPost; postBind.ConverterParameter = "Post"; postBind.Path = new PropertyPath("POSTID"); this.PostsObject.TxtLookUp.SetBinding(TextBox.TextProperty, postBind); PostsObject.IsEnabled = false;//隐藏岗位选择 }
private void LayoutRoot_Loaded(object sender, RoutedEventArgs e) { Binding redoBind = new Binding(); redoBind.Path = new PropertyPath("ISLEVEL"); redoBind.Mode = BindingMode.TwoWay; BoolConvert bc = new BoolConvert(); bc.IsYes = true; redoBind.Converter = bc; this.rbtYes.SetBinding(RadioButton.IsCheckedProperty, redoBind); Binding redoBindto = new Binding(); redoBindto.Path = new PropertyPath("ISLEVEL"); redoBindto.Mode = BindingMode.TwoWay; BoolConvert bcTo = new BoolConvert(); bcTo.IsYes = false; redoBindto.Converter = bcTo; this.RbtNo.SetBinding(RadioButton.IsCheckedProperty, redoBindto); Binding postBind = new Binding(); CompanyInfoConverter converterPost = new CompanyInfoConverter(); postBind.Converter = converterPost; postBind.ConverterParameter = "Post"; postBind.Path = new PropertyPath("POSTID"); this.PostsObject.TxtLookUp.SetBinding(TextBox.TextProperty, postBind); PostsObject.IsEnabled = false;//隐藏岗位选择 }