属性未在silverlight中更新

时间:2013-08-27 07:24:16

标签: silverlight-4.0

属性未在silverlight中更新..

Public Property CurrentUser As BCOMSUser
        Get
            ' Return _currentUser
            Return BCOMSCurrentUser.BCOMSUser
        End Get
        Set(value As BCOMSUser)
            _currentUser = value
            OnPropertyChanged(Function(x) x.CurrentUser)
        End Set
    End Property

我正在覆盖这样的属性,但是它将其先前的值保留下来。

 Dim usr As BCOMSUser = e.Result.Response 
CurrentUser = usr 


  <sdk:Label Grid.Row="21" Grid.Column="0" Margin="0,0,5,0" HorizontalAlignment="Right" Name="lblRoles" VerticalAlignment="Top" Width="120" Content="Roles:" />
            <sdk:DataGrid Grid.Row="21" Grid.Column="1" AutoGenerateColumns="False" Height="150" HorizontalAlignment="Left" Name="UserRolesDataGrid" VerticalAlignment="Top" Width="182" ItemsSource="{Binding Path=PagedUserRoles}">
                <sdk:DataGrid.Columns>
                    <sdk:DataGridTextColumn Header="Role" Binding="{Binding Path=RoleName}" Width="105" />
                    <sdk:DataGridCheckBoxColumn Header="Subscribe" Binding="{Binding Path=IsSubscribed}" Width="75" />
                </sdk:DataGrid.Columns>
            </sdk:DataGrid>
            <sdk:DataPager Name="UserRolesDataPager" Grid.Row="22" Grid.Column="1" PageSize="10" HorizontalAlignment="Left" VerticalAlignment="Center" HorizontalContentAlignment="Center" Width="182" Source="{Binding Path=PagedUserRoles}"></sdk:DataPager>

            <StackPanel Grid.Row="24" Grid.Column="1" Orientation="Horizontal" >
                <Button Content="Save Changes" Height="23" HorizontalAlignment="Left" Margin="0,0,0,0" Name="btnSaveDetailChanges" VerticalAlignment="Top" Width="Auto" Command="{Binding Path=SaveDetailChangesCommand}" />
            </StackPanel>

代码背后:

   Case UserMaintenanceViewModel.CommandNameOf(Function(x) x.UpdateUserCommand),
                    UserMaintenanceViewModel.CommandNameOf(Function(x) x.SaveDetailChangesCommand)

更新角色后,我获取当前更新的角色,我在回调中绑定到属性,但它没有更新..

Private Sub GetBCOMSUserCallback(ByVal sender As Object, ByVal e As GetBCOMSUserCompletedEventArgs)
        Try
            If Not e.Result.IsFault Then
                Dim usr As BCOMSUser = e.Result.Response 
                CurrentUser = usr
                'SetupMenu()
                OnCommandCompleted(Function(x) x.GetBCOMSUserCommand)
            Else
                OnError(New BCOMSException With {
                            .GeneralErrorMessage = "Fail to retrieve User.",
                            .DetailErrorMessage = e.Result.FaultMessage
                        })
            End If
        Catch ex As Exception
            OnError(ex)
        Finally
            TaskSvc.RemoveCallback_GetBCOMSUser(AddressOf GetBCOMSUserCallback)
        End Try
    End Sub

0 个答案:

没有答案