コード例 #1
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            Male = (RadioButton)GetTemplateChild("PART_Male");
            Male.SetBinding(RadioButton.IsCheckedProperty, new Binding {
                Source = this, Path = new PropertyPath(CurrentValueProperty), Mode = BindingMode.TwoWay
            });
            Male.Checked += Checked;
            Female        = (RadioButton)GetTemplateChild("PART_Female");
            Female.SetBinding(RadioButton.IsCheckedProperty, new Binding {
                Source = this, Path = new PropertyPath(CurrentValueProperty), Mode = BindingMode.TwoWay, Converter = new BooleanReverseValueConverter()
            });
            Female.Checked += Checked;
        }