Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
<Window x:Class="WpfApplication1.Window5"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Тестовый пример" SizeToContent="WidthAndHeight">
<StackPanel>
<Button Click="Button_Click" Margin="5">Нажми меня</Button>
<Button x:Name="btnTest" Margin="5" Padding="5">Тестовая кнопка</Button>
<Button Margin="5" Padding="5">
<StackPanel Orientation="Horizontal">
<TextBlock VerticalAlignment="Center">Кнопка</TextBlock>
<Image Source="Bitmap1.bmp" Margin="5" />
<TextBlock VerticalAlignment="Bottom">с картинкой</TextBlock>
</StackPanel>
</Button>
</StackPanel>
</Window>
* This source code was highlighted with Source Code Highlighter. script {
function photoClicked() {
imageDetails.photoTitle = title;
imageDetails.photoTags = tags;
imageDetails.photoWidth = photoWidth;
imageDetails.photoHeight = photoHeight;
imageDetails.photoType = photoType;
imageDetails.photoAuthor = photoAuthor;
imageDetails.photoDate = photoDate;
imageDetails.photoUrl = url;
imageDetails.rating = 0;
scaleMe.state = "Details";
}
}
new Grid()
{
    Width = 100,
    Height = 200,
    Children =
    {
        new TextBox() { Text = "some text" },
        new Button() { Content = "Button1" }
    }
};
value: slider.x *100 / (container.width - 34)
MouseRegion {
anchors.fill: confirmIcon
onClicked: { confirm() }
}
TextInput {
id: textEdit
text: fieldText.text
focus: false
anchors.left: parent.left
anchors.leftMargin: 0
anchors.right: parent.right
anchors.rightMargin: 0
anchors.verticalCenter: parent.verticalCenter
color: "black"
font.bold: true
readOnly: true
onAccepted: confirm()
Keys.onEscapePressed: reset()
}
color: fieldText.state == "editing" ? "#505050" : "#AAAAAA", остальное же — обычный код обработки событий, причем, как я понимаю, соответствие там одностороннее, в обратную сторону такая штука работать не будет.
QML — новый подход к построению GUI