내 목표는 xaml을 사용하여 페이지에서 사용자 지정 컨트롤의 속성을 설정하는 것입니다. 메뉴 항목의 사용자 지정 집합을 만들려고합니다. 모두 똑같이 보이지만 각기 다른 제목이 포함되어 있습니다. Xaml에서 각 메뉴 항목의 제목을 어떻게 설정할 수 있습니까? 예를 들어 필자의 실제 코드를 프로젝트에서 간단하게 단순화했습니다. 내가 원하는 무엇xaml에서 사용자 지정 컨트롤 xamarin 폼의 속성을 설정하는 방법
이 같은 것입니다 :
<local:CustomControl someCustomAccessor="some text">
동안이 같은 사용자 정의 컨트롤의 속성을 설정 :이 같은 뭔가를 모든 곳에서 고개가 한
class CustomControl: ContentView{
private string someText { get; set; }
public static BindableProperty TitleProperty = BindableProperty.CreateAttached("someCustomAccessor", typeof(string), typeof(CustomControl), null, BindingMode.TwoWay);
public CustomControl()
{
Content = new Label
{
Text = someText
};
}
private string someCustomAccessor
{
get { return someText; }
set { someText = value; }
}
}
짧아. 도와주세요. 나는이 비슷한 일을하지만, 내 실버 경험을 그리기 했으므로
재산을 공개해야합니다. – Jason
정확히 일치합니다. 고맙습니다 – Bjt1776