コード例 #1
0
ファイル: StripWindow.cs プロジェクト: yzwbrian/MvvmFx
        private void bindStatus_Click(object sender, EventArgs e)
        {
            var collection  = StatusCollection.GetStatusCollection();
            var mainControl = (StatusStrip)GetMainControlByName("statusBar1");

            foreach (var item in collection)
            {
                var isMatch = false;
                foreach (object component in mainControl.Items)
                {
                    if (isMatch)
                    {
                        break;
                    }

                    if (((INamedBindable)component).Name == item.Name)
                    {
                        ((IBindableComponent)component).DataBindings.Add("Text", item, "Text");
                        ((IBindableComponent)component).DataBindings.Add("ToolTipText", item, "ToolTipText");
                        ((IBindableComponent)component).DataBindings.Add("Enabled", item, "Enabled");
                        ((IBindableComponent)component).DataBindings.Add("Visible", item, "Visible");
                        isMatch = true;
                    }
                }
            }
        }