小编CKI*_*KII的帖子

强制枢轴项目在显示之前预加载

我有一个带有几个PivotItems的Pivot,其中一个包含一个画布,它将项目放在动态位置(取决于数据).我得到了数据,我可以在用户可以选择此项之前将项目放在它们的位置(这不是第一个支点).但是,只有当我选择PivotItem时,画布才会呈现自己,因此您可以在它显示之前看到它闪烁.

有没有办法强制画布在显示之前渲染,所以一切都是在用户看到之前准备的?

我的代码看起来像这样:

在page.xaml.cs中:

private async void GameCenterView_OnDataContextChanged(object sender, EventArgs e)
{
    // Load data...

    // Handle other pivots

    // This is the problem pivot
    if (ViewModel.CurrentGame.SportTypeId == 1)
    {
        _hasLineups = ViewModel.CurrentGame.HasLineups.GetValueOrDefault();
        HasFieldPositions = ViewModel.CurrentGame.HasFieldPositions.GetValueOrDefault();

        // I only add the pivot when I need it, otherwise, it won't be shown
        if (_hasLineups)
        {
            if (MainPivot.Items != null) MainPivot.Items.Add(LineupPivotItem);
        }

        if (HasFieldPositions)
        {
            // Here I place all the items in their proper place on the canvas
            ArrangeLineup(ViewModel.TeamOneLineup, TeamOneCanvas);
            ArrangeLineup(ViewModel.TeamTwoLineup, …
Run Code Online (Sandbox Code Playgroud)

c# windows-runtime winrt-xaml windows-phone-8.1

5
推荐指数
1
解决办法
636
查看次数

绑定控件的x:名称

当我添加

    <TextBlock  Text="{Binding SettingName}" TextWrapping="Wrap" Margin="10,-2,10,0" Style="{StaticResource PhoneTextSubtleStyle}" />    
Run Code Online (Sandbox Code Playgroud)

Everuthing还可以.但当

 <TextBlock x:Name="{Binding SettingTextBlockName}"  Text="{Binding SettingName}" TextWrapping="Wrap" Margin="10,-2,10,0" Style="{StaticResource PhoneTextSubtleStyle}" />
Run Code Online (Sandbox Code Playgroud)

构造函数正在破碎.

但我需要在所有元素中使用不同的名称.

c# wpf xaml binding

2
推荐指数
2
解决办法
5980
查看次数