private void Init()
        {
            this.tbkGroup.Text      = Common.gstrGroupDisplayNm;
            this.tbkGroupTotal.Text = "<" + Common.gstrGroupDisplayNm + "別集計>";

            if (DataAuthority.IsReportTotal())
            {
                this.utlCompanyGroup_F.IsEnabled        = true;
                this.utlCompanyGroup_T.IsEnabled        = true;
                this.utlCompanyGroup_F.txtID_IsReadOnly = false;
                this.utlCompanyGroup_T.txtID_IsReadOnly = false;
            }
            else
            {
                this.utlCompanyGroup_F.IsEnabled        = false;
                this.utlCompanyGroup_T.IsEnabled        = false;
                this.utlCompanyGroup_F.txtID_IsReadOnly = true;
                this.utlCompanyGroup_T.txtID_IsReadOnly = true;
                this.utlCompanyGroup_F.txtID.Text       = "";
                this.utlCompanyGroup_F.txtNm.Text       = "";
                this.utlCompanyGroup_T.txtID.Text       = "";
                this.utlCompanyGroup_T.txtNm.Text       = "";
            }

            if (this.IsReportRange == false)
            {
                this.stpReportRange.Visibility = System.Windows.Visibility.Collapsed;
            }
            else
            {
                this.stpReportRange.Visibility = System.Windows.Visibility.Visible;
            }

            if (this.IsGroupTotal == false)
            {
                this.stpGroupTotal.Visibility = System.Windows.Visibility.Collapsed;
            }
            else
            {
                this.stpGroupTotal.Visibility = System.Windows.Visibility.Visible;
            }

            if (this.IsTotalKbn == false)
            {
                this.stpTotalKbn.Visibility = System.Windows.Visibility.Collapsed;
            }
            else
            {
                this.stpTotalKbn.Visibility = System.Windows.Visibility.Visible;
            }
        }
        private void SetBinding()
        {
            if (_entity == null)
            {
                _entity = new EntityReportSetting();
            }

            _entity.PropertyChanged += this.utlCompanyGroup_F.MstID_Changed;
            _entity.PropertyChanged += this.utlCompanyGroup_T.MstID_Changed;

            // マスタコントロールPropertyChanged
            //_entity.PropertyChanged += this.utlInvoice.MstID_Changed;

            NumberConverter nmConvDecm0 = new NumberConverter();

            nmConvDecm0.IsMaxMinCheck = true;
            nmConvDecm0.MaxNumber     = 350;
            nmConvDecm0.MinNumber     = -350;

            NumberConverter nmConvDecm2 = new NumberConverter();

            nmConvDecm2.FormatString = "000";

            #region Bind

            switch (_entity._size)
            {
            case 0:          // デフォルト
                this.cmbReportSize.SelectedIndex = 0;
                break;

            case 1:          // A3
                this.cmbReportSize.SelectedIndex = 1;
                break;

            case 2:          // A4
                this.cmbReportSize.SelectedIndex = 2;
                break;

            case 3:          // A5
                this.cmbReportSize.SelectedIndex = 3;
                break;

            default:
                this.cmbReportSize.SelectedIndex = 0;
                break;
            }

            switch (_entity._orientation)
            {
            case 0:          // 指定無し
                this.rdoVertical.IsChecked   = false;
                this.rdoHorizontal.IsChecked = false;
                this.rdoOriDefault.IsChecked = true;
                break;

            case 1:          // 縦
                this.rdoVertical.IsChecked   = true;
                this.rdoHorizontal.IsChecked = false;
                this.rdoOriDefault.IsChecked = false;
                break;

            case 2:          // 横
                this.rdoVertical.IsChecked   = false;
                this.rdoHorizontal.IsChecked = true;
                this.rdoOriDefault.IsChecked = false;
                break;

            default:
                this.rdoVertical.IsChecked   = false;
                this.rdoHorizontal.IsChecked = false;
                this.rdoOriDefault.IsChecked = true;
                break;
            }

            switch (_entity._group_total)
            {
            case 0:          // 無し
                this.rdoGroupTotalKbnNasi.IsChecked = true;
                this.rdoGroupTotalKbnAri.IsChecked  = false;
                break;

            case 1:          // 有り
                this.rdoGroupTotalKbnNasi.IsChecked = false;
                this.rdoGroupTotalKbnAri.IsChecked  = true;
                break;

            default:
                this.rdoGroupTotalKbnNasi.IsChecked = true;
                this.rdoGroupTotalKbnAri.IsChecked  = false;
                break;
            }

            switch (_entity._total_kbn)
            {
            case 0:          // 無し
                this.cmbTotalKbn.SelectedIndex = 0;
                break;

            case 1:          // 得意先別
                this.cmbTotalKbn.SelectedIndex = 1;
                break;

            case 2:          // 商品別
                this.cmbTotalKbn.SelectedIndex = 2;
                break;

            case 3:          // 担当別
                this.cmbTotalKbn.SelectedIndex = 3;
                break;

            default:
                this.cmbTotalKbn.SelectedIndex = 0;
                break;
            }

            // バインド
            Binding BindingLeftMargin = new Binding("_left_margin");
            BindingLeftMargin.Mode      = BindingMode.TwoWay;
            BindingLeftMargin.Converter = nmConvDecm0;
            BindingLeftMargin.Source    = _entity;
            this.txtLeftMargin.SetBinding(TextBox.TextProperty, BindingLeftMargin);

            Binding BindingRightMargin = new Binding("_right_margin");
            BindingRightMargin.Mode      = BindingMode.TwoWay;
            BindingRightMargin.Converter = nmConvDecm0;
            BindingRightMargin.Source    = _entity;
            this.txtRightMargin.SetBinding(TextBox.TextProperty, BindingRightMargin);

            Binding BindingTopMargin = new Binding("_top_margin");
            BindingTopMargin.Mode      = BindingMode.TwoWay;
            BindingTopMargin.Converter = nmConvDecm0;
            BindingTopMargin.Source    = _entity;
            this.txtTopMargin.SetBinding(TextBox.TextProperty, BindingTopMargin);

            Binding BindingBottomMargin = new Binding("_bottom_margin");
            BindingBottomMargin.Mode      = BindingMode.TwoWay;
            BindingBottomMargin.Converter = nmConvDecm0;
            BindingBottomMargin.Source    = _entity;
            this.txtButtomMargin.SetBinding(TextBox.TextProperty, BindingBottomMargin);

            if (DataAuthority.IsReportTotal())
            {
                Binding BindingGroupIdFrom = new Binding("_group_id_from");
                BindingGroupIdFrom.Mode = BindingMode.TwoWay;
                //BindingGroupIdFrom.Converter = nmConvDecm2;
                BindingGroupIdFrom.Source = _entity;
                this.utlCompanyGroup_F.txtID.SetBinding(TextBox.TextProperty, BindingGroupIdFrom);

                Binding BindingGroupNmFrom = new Binding("_group_nm_from");
                BindingGroupNmFrom.Mode   = BindingMode.TwoWay;
                BindingGroupNmFrom.Source = _entity;
                this.utlCompanyGroup_F.txtNm.SetBinding(TextBox.TextProperty, BindingGroupNmFrom);

                Binding BindingGroupIdTo = new Binding("_group_id_to");
                BindingGroupIdTo.Mode = BindingMode.TwoWay;
                //BindingGroupIdTo.Converter = nmConvDecm2;
                BindingGroupIdTo.Source = _entity;
                this.utlCompanyGroup_T.txtID.SetBinding(TextBox.TextProperty, BindingGroupIdTo);

                Binding BindingGroupNmTo = new Binding("_group_nm_to");
                BindingGroupNmTo.Mode   = BindingMode.TwoWay;
                BindingGroupNmTo.Source = _entity;
                this.utlCompanyGroup_T.txtNm.SetBinding(TextBox.TextProperty, BindingGroupNmTo);

                if (ExCast.zCInt(_entity._group_id_from) == 0 && ExCast.zCInt(_entity._group_id_to) == 0)
                {
                    this.utlCompanyGroup_F.txtID.Text = string.Format("{0:000}", Common.gintGroupId);
                    //_entity._group_id_from = string.Format("{0:000}", Common.gintGroupId);

                    //_entity._group_nm_from = Common.gstrGroupNm;
                    //this.utlCompanyGroup_F.txtID.Text = Common.gintGroupId.ToString();

                    this.utlCompanyGroup_T.txtID.Text = string.Format("{0:000}", Common.gintGroupId);
                    //_entity._group_id_to = string.Format("{0:000}", Common.gintGroupId);
                    //_entity._group_nm_to = Common.gstrGroupNm;
                    //this.utlCompanyGroup_T.txtID.Text = Common.gintGroupId.ToString();

                    this.utlCompanyGroup_F.MstID_Changed(null, new PropertyChangedEventArgs("_group_id_from"));
                    this.utlCompanyGroup_T.MstID_Changed(null, new PropertyChangedEventArgs("_group_id_to"));
                }
            }

            #endregion

            this.txtLeftMargin.OnFormatString();
            this.txtRightMargin.OnFormatString();
            this.txtTopMargin.OnFormatString();
            this.txtButtomMargin.OnFormatString();

            //this.utlCompanyGroup_F.txtID.OnFormatString();
            //this.utlCompanyGroup_T.txtID.OnFormatString();
        }