开发者

Binding ColumnDefinitions in Silverlight

I have two separate 开发者_开发技巧Silverlight usercontrols containing grids and i want these to share a set of columndefinitions. The columndefinitions must be created dynamically. How can i do this?


You can just add them in code if that is sufficient:

private void CreateColumnDefinitions(Grid grid)
        {
            grid.ColumnDefinitions.Add(
                new ColumnDefinition() { Width = new GridLength(10, GridUnitType.Star) });

            grid.ColumnDefinitions.Add(
                new ColumnDefinition() { Width = new GridLength(5, GridUnitType.Star) });

            grid.ColumnDefinitions.Add(
                new ColumnDefinition() { Width = new GridLength(5, GridUnitType.Star) });
        }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜