Browse Source

Make initial DropDown selection work

Fixes #110
pull/227/head
Steven Kirk 11 years ago
parent
commit
d143b7fcee
  1. 10
      samples/XamlTestApplication/Views/MainWindow.paml
  2. 2
      src/Markup/Perspex.Markup.Xaml/OmniXAML
  3. 1
      src/Markup/Perspex.Markup.Xaml/Perspex.Markup.Xaml.csproj
  4. 2
      src/Perspex.Controls/DropDown.cs
  5. 6
      src/Perspex.Controls/TextBlock.cs
  6. 4
      src/Perspex.SceneGraph/Media/FormattedText.cs

10
samples/XamlTestApplication/Views/MainWindow.paml

@ -2,13 +2,7 @@
xmlns="https://github.com/perspex"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Perspex Test Application" Height="350" Width="525" SizeToContent="WidthAndHeight" >
<ListBox SelectedIndex="0">
<ListBoxItem>Hello</ListBoxItem>
<ListBoxItem>World</ListBoxItem>
</ListBox>
<!--<Grid RowDefinitions="Auto,*">
<Grid RowDefinitions="Auto,*">
<TabControl Grid.Row="1">
<TabItem Header="Buttons">
<StackPanel HorizontalAlignment="Center" Width="200" VerticalAlignment="Center">
@ -125,5 +119,5 @@
</Grid>
</TabItem>
</TabControl>
</Grid>-->
</Grid>
</Window>

2
src/Markup/Perspex.Markup.Xaml/OmniXAML

@ -1 +1 @@
Subproject commit 1461be589a5d39d378fd177648c61a780271c742
Subproject commit 49e6ec001f5873cf2290e0bc1f6f06ca9b9cf808

1
src/Markup/Perspex.Markup.Xaml/Perspex.Markup.Xaml.csproj

@ -57,6 +57,7 @@
<Compile Include="DataBinding\ChangeTracking\PropertyPath.cs" />
<Compile Include="DataBinding\ChangeTracking\TargettedProperty.cs" />
<Compile Include="Context\PerspexParserFactory.cs" />
<Compile Include="OmniXAML\Source\Glass\AutoKeyDictionary.cs" />
<Compile Include="OmniXAML\Source\Glass\ChangeTracking\ObservableProperty.cs" />
<Compile Include="OmniXAML\Source\Glass\ChangeTracking\ObservablePropertyChain.cs" />
<Compile Include="OmniXAML\Source\Glass\ChangeTracking\Property.cs" />

2
src/Perspex.Controls/DropDown.cs

@ -140,6 +140,8 @@ namespace Perspex.Controls
if (control != null)
{
control.Measure(Size.Infinity);
SelectionBoxItem = new Rectangle
{
Width = control.DesiredSize.Width,

6
src/Perspex.Controls/TextBlock.cs

@ -235,9 +235,9 @@ namespace Perspex.Controls
protected virtual FormattedText CreateFormattedText(Size constraint)
{
var result = new FormattedText(
Text,
FontFamily,
FontSize,
Text ?? string.Empty,
FontFamily ?? "Ariel",
FontSize > 0 ? FontSize : 12,
FontStyle,
TextAlignment,
FontWeight);

4
src/Perspex.SceneGraph/Media/FormattedText.cs

@ -30,6 +30,10 @@ namespace Perspex.Media
TextAlignment textAlignment,
FontWeight fontWeight)
{
Contract.Requires<ArgumentNullException>(text != null);
Contract.Requires<ArgumentNullException>(fontFamilyName != null);
Contract.Requires<ArgumentException>(fontSize > 0);
Text = text;
FontFamilyName = fontFamilyName;
FontSize = fontSize;

Loading…
Cancel
Save