Skip to main content

UIObjectService Class

The UI Service that provides direct access to the service’s AssociatedObject from the View Model without referencing the AssociatedObject’s real type.

Namespace: DevExpress.WinUI.Core

Assembly: DevExpress.WinUI.Core.v23.2.dll

NuGet Package: DevExpress.WinUI

Declaration

public class UIObjectService :
    UIServiceBase,
    IUIObjectService

Remarks

The UIObjectService implements the IUIObjectService interface that has the following declaration:

public interface IUIObjectService {
    dynamic Object { get; }
}

The Object property returns a UIElement of the dynamic type.

The following code sample accesses a ListBox object without referencing its real type:

<UserControl ...
    xmlns:dx="using:DevExpress.WinUI.Core"
    xmlns:dxg="using:DevExpress.WinUI.Grid"
    xmlns:ViewModel="using:WinUIApp.ViewModel">
      <UserControl.DataContext>
        <ViewModel:ViewModel />
    </UserControl.DataContext>
    <!-- ... -->
        <dxg:GridControl>
            <dxc:Interaction.Behaviors>
                <dxc:UIObjectService ServiceClient="{x:Bind ViewModel}"/>
            </dxc:Interaction.Behaviors>
        </dxg:GridControl>
    <!-- ... -->
</UserControl>
public class ViewModel : ViewModelBase {
    public IUIObjectService GridService => GetUIService<IUIObjectService>();
    //...
    GridService.Object.BeginDataUpdate();
}

Implements

See Also