private bool IsValid()
        {
            bool valid = true;

            var requiredFields = new KeyValuePair<MetroLabel, IMetroControl>[] {
                new KeyValuePair<MetroLabel, IMetroControl>(firstNameLabel, firstName),
                new KeyValuePair<MetroLabel, IMetroControl>(lastNameLabel, lastName),
                new KeyValuePair<MetroLabel, IMetroControl>(phoneLabel, phone),
                new KeyValuePair<MetroLabel, IMetroControl>(cardLabel, card)
                };

            if (CurrentClient != null)
                requiredFields = new KeyValuePair<MetroLabel, IMetroControl>[] { requiredFields.Last() };

            foreach (var field in requiredFields)
            {
                var label = field.Key;
                var textField = field.Value as MetroTextBox;

                label.UseCustomForeColor = false;

                if (textField.Text.ToString().IsNullOrWhiteSpace())
                {
                    valid = false;

                    label.UseCustomForeColor = true;
                    label.ForeColor = Color.Red;
                }
                label.Refresh();
            }

            return valid;
        }
        protected override Size MeasureOverride(Size availableSize)
        {
            //横向瀑布流

            groupcount = (int)availableSize.Width / 256 >= 3 ? (int)availableSize.Width / 256 : 3;
            //三组流长度记录
            KeyValuePair<double, int>[] flowLength = new KeyValuePair<double, int>[groupcount];
            foreach (int index in Enumerable.Range(0, groupcount))
            {
                flowLength[index] = new KeyValuePair<double, int>(0.0, index);
            }

            //每组长度为总长度1/3
            double flowWidth = availableSize.Width / groupcount;

            //子控件宽为组宽,长无限制
            Size childMeasureSize = new Size(flowWidth, double.PositiveInfinity);

            //子控件遍历计算长度
            foreach (UIElement childElement in Children)
            {
                childElement.Measure(childMeasureSize);
                Size childSize = childElement.DesiredSize;
                //得到子控件长
                double childLength = childSize.Height;
                //暂存最短流长度
                var tempPair = flowLength[0];
                //最短流长度重新计算
                flowLength[0] = new KeyValuePair<double, int>(tempPair.Key + childLength, tempPair.Value);
                //重新按流长度排列键值对        这里以Key 的值作为排列依据,flowWidth[0]为Key最小的键值对,P可替换为任意字母
                flowLength = flowLength.OrderBy(P => P.Key).ToArray();
            }
            //返回 长:最长流的长;宽:传入的宽
            return new Size(availableSize.Width, flowLength.Last().Key);
        }