From ca0e346f49217e52216dfa3f9edf8f352e7611ee Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Thu, 19 Oct 2017 12:26:48 +0200 Subject: [PATCH] Added failing test for #507. --- .../Xaml/ControlBindingTests.cs | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/ControlBindingTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/ControlBindingTests.cs index a508c21747..bd9d99ff23 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/ControlBindingTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/ControlBindingTests.cs @@ -1,7 +1,10 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Collections.Generic; using Avalonia.Controls; +using Avalonia.Controls.Primitives; +using Avalonia.Layout; using Avalonia.Logging; using Avalonia.UnitTests; using Xunit; @@ -67,5 +70,61 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml Assert.True(called); } } + + [Fact] + public void Can_Bind_Between_TabStrip_And_Carousel() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var xaml = @" + + + + + + + + + + + + + + + + + +"; + var loader = new AvaloniaXamlLoader(); + var window = (Window)loader.Load(xaml); + var strip = window.FindControl("strip"); + var carousel = window.FindControl("carousel"); + + window.DataContext = new ItemsViewModel + { + Items = new[] + { + new ItemViewModel { Header = "Item1", Detail = "Detail1" }, + new ItemViewModel { Header = "Item2", Detail = "Detail2" }, + } + }; + + window.Show(); + + Assert.Equal(0, strip.SelectedIndex); + Assert.Equal(0, carousel.SelectedIndex); + } + } + + private class ItemsViewModel + { + public IList Items { get; set; } + } + + private class ItemViewModel + { + public string Header { get; set; } + public string Detail { get; set; } + } } }