Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
lawrence_shaun_introducing_net_maui_build_and_deploy_crosspl.pdf
Скачиваний:
46
Добавлен:
26.06.2023
Размер:
5.15 Mб
Скачать

Chapter 6 Creating Our Own Layout

•\

Set the content of your control to be a Label showing

 

fixed text in an italic font and the text is centered both

 

horizontally and vertically

•\

Added a Position property to know where in the layout

 

it will be positioned

Now you can start building the layout that will display the placeholders and ultimately your widgets.

ILayoutManager

You have a slight chicken-and-egg scenario here. You need to create a board and a layout manager, both of which need to know about the other; therefore, let’s add in the LayoutManager parts first.

The purpose of the ILayoutManager interface is to define how the BoardLayout will interact with a layout manager implementation.

Create a folder called Layouts in your main project. It will house the ILayoutManager interface and more as you build your application.

Next, add a new class to the folder and call it ILayoutManager.

namespace WidgetBoard.Layouts;

public interface ILayoutManager

{

object BindingContext { get; set; }

BoardLayout Board { get; set; }

void SetPosition(BindableObject bindableObject, int position);

}

168