开发者

How can I Hide the first row for UniformGrid Control?

UnifomGrid has loaded Data, I want to Hide the first row?

How can I implement tha开发者_如何学JAVAt?


I've never worked with the UniformGrid so there might be a better solution for this but as far as I can tell the UniformGrid doesn't hold much information except how many rows and columns it currently have so therefore this is the only solution that I can think of.

private List<UIElement> GetElementsAtRow(int rowNumber)
{
    List<UIElement> elementsAtRow = new List<UIElement>();
    for (int i = 0; i < uniformGrid.Columns; i++)
    {
        if (i < uniformGrid.Children.Count)
        {
            elementsAtRow.Add(uniformGrid.Children[i] as UIElement);
        }
    }
    return elementsAtRow;
}
private void HideFirstRow()
{
    List<UIElement> elementsAtRow = GetElementsAtRow(0);
    foreach (UIElement element in elementsAtRow)
    {
        // Or Hidden if you want row to remain but with no Visible children.
        element.Visibility = Visibility.Collapsed;
    }
}
private void ShowFirstRow()
{
    List<UIElement> elementsAtRow = GetElementsAtRow(0);
    foreach (UIElement element in elementsAtRow)
    {
        element.Visibility = Visibility.Visible;
    }
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜