forked from unoplatform/uno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug preventing ComboBox from displaying when inside ContentDialog. (Multiple popups beyond the first weren't being measured.)
- Loading branch information
1 parent
3a14ecd
commit 65e3e8e
Showing
8 changed files
with
199 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...App/UITests.Shared/Windows_UI_Xaml_Controls/ContentDialogTests/ComboBoxContentDialog.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<UserControl x:Class="UITests.Shared.Windows_UI_Xaml_Controls.ContentDialogTests.ComboBoxContentDialog" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:UITests.Shared.Windows_UI_Xaml_Controls.ContentDialogTests" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
d:DesignHeight="300" | ||
d:DesignWidth="400"> | ||
|
||
<Grid> | ||
<ComboBox x:Name="InnerComboBox" | ||
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"> | ||
<TextBlock x:Name="ComboElement1" | ||
Text="Item 1" /> | ||
<TextBlock x:Name="ComboElement2" | ||
Text="Item 2" /> | ||
<TextBlock x:Name="ComboElement3" | ||
Text="Item 3" /> | ||
<TextBlock x:Name="ComboElement4" | ||
Text="Item 4" /> | ||
<TextBlock x:Name="ComboElement5" | ||
Text="Item 5" /> | ||
</ComboBox> | ||
</Grid> | ||
</UserControl> |
27 changes: 27 additions & 0 deletions
27
.../UITests.Shared/Windows_UI_Xaml_Controls/ContentDialogTests/ComboBoxContentDialog.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Runtime.InteropServices.WindowsRuntime; | ||
using Windows.Foundation; | ||
using Windows.Foundation.Collections; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Controls; | ||
using Windows.UI.Xaml.Controls.Primitives; | ||
using Windows.UI.Xaml.Data; | ||
using Windows.UI.Xaml.Input; | ||
using Windows.UI.Xaml.Media; | ||
using Windows.UI.Xaml.Navigation; | ||
|
||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 | ||
|
||
namespace UITests.Shared.Windows_UI_Xaml_Controls.ContentDialogTests | ||
{ | ||
public sealed partial class ComboBoxContentDialog : UserControl | ||
{ | ||
public ComboBoxContentDialog() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...pp/UITests.Shared/Windows_UI_Xaml_Controls/ContentDialogTests/ContentDialog_ComboBox.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<UserControl x:Class="UITests.Shared.Windows_UI_Xaml_Controls.ContentDialogTests.ContentDialog_ComboBox" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:UITests.Shared.Windows_UI_Xaml_Controls.ContentDialogTests" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
d:DesignHeight="300" | ||
d:DesignWidth="400"> | ||
|
||
<StackPanel> | ||
<Button x:Name="ShowComboBoxDialog" | ||
Content="Show dialog" | ||
Click="ShowComboBoxDialog_Click" /> | ||
<TextBlock x:Name="ResultsTextBlock" | ||
Text="{Binding Path=SelectedItemText, FallbackValue=NoResult}" /> | ||
<TextBlock Text="UnoTestbed4" | ||
Margin="50" /> | ||
</StackPanel> | ||
</UserControl> |
73 changes: 73 additions & 0 deletions
73
...UITests.Shared/Windows_UI_Xaml_Controls/ContentDialogTests/ContentDialog_ComboBox.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Runtime.InteropServices.WindowsRuntime; | ||
using Uno.UI.Samples.Controls; | ||
using Uno.UI.Samples.UITests.Helpers; | ||
using Windows.Foundation; | ||
using Windows.Foundation.Collections; | ||
using Windows.UI.Core; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Controls; | ||
using Windows.UI.Xaml.Controls.Primitives; | ||
using Windows.UI.Xaml.Data; | ||
using Windows.UI.Xaml.Input; | ||
using Windows.UI.Xaml.Media; | ||
using Windows.UI.Xaml.Navigation; | ||
|
||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 | ||
|
||
namespace UITests.Shared.Windows_UI_Xaml_Controls.ContentDialogTests | ||
{ | ||
[SampleControlInfo("ContentDialog", "ContentDialog_Closing", description: "ContentDialog with a ComboBox inside")] | ||
public sealed partial class ContentDialog_ComboBox : UserControl | ||
{ | ||
public ContentDialog_ComboBox() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
|
||
private void ShowComboBoxDialog_Click(object sender, RoutedEventArgs e) | ||
{ | ||
var viewModel = new ComboBoxDialogViewModel(Dispatcher); | ||
var dialog = new ContentDialog | ||
{ | ||
Content = new ComboBoxContentDialog(), | ||
DataContext = viewModel, | ||
CloseButtonText = "Done" | ||
}; | ||
|
||
ResultsTextBlock.DataContext = viewModel; | ||
var dummy = dialog.ShowAsync(); | ||
} | ||
|
||
public class ComboBoxDialogViewModel : ViewModelBase | ||
{ | ||
public ComboBoxDialogViewModel(CoreDispatcher dispatcher) : base(dispatcher) | ||
{ | ||
|
||
} | ||
|
||
private object _selectedItem; | ||
public object SelectedItem | ||
{ | ||
get => _selectedItem; | ||
set | ||
{ | ||
if (!Equals(_selectedItem, value)) | ||
{ | ||
_selectedItem = value; | ||
RaisePropertyChanged(); | ||
if (value is TextBlock) | ||
{ | ||
RaisePropertyChanged(nameof(SelectedItemText)); | ||
} | ||
} | ||
} | ||
} | ||
|
||
public object SelectedItemText => (SelectedItem as TextBlock)?.Text; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters