Browse Source

Added TextBox to ControlCatalog.

Steven Kirk 9 years ago
parent
commit
8f0d63db73

+ 8 - 0
samples/ControlCatalog/ControlCatalog.csproj

@@ -60,6 +60,9 @@
     <Compile Include="MainWindow.xaml.cs">
       <DependentUpon>MainWindow.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Pages\TextBoxPage.xaml.cs">
+      <DependentUpon>TextBoxPage.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Pages\LayoutTransformControlPage.xaml.cs">
       <DependentUpon>LayoutTransformControlPage.xaml</DependentUpon>
     </Compile>
@@ -208,6 +211,11 @@
       <SubType>Designer</SubType>
     </EmbeddedResource>
   </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Pages\TextBoxPage.xaml">
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.

+ 1 - 0
samples/ControlCatalog/MainWindow.xaml

@@ -13,5 +13,6 @@
     <TabItem Header="DropDown"><pages:DropDownPage/></TabItem>
     <TabItem Header="LayoutTransformControl"><pages:LayoutTransformControlPage/></TabItem>
     <TabItem Header="Slider"><pages:SliderPage/></TabItem>
+    <TabItem Header="TextBox"><pages:TextBoxPage/></TabItem>
   </TabControl>
 </Window>

+ 31 - 0
samples/ControlCatalog/Pages/TextBoxPage.xaml

@@ -0,0 +1,31 @@
+<UserControl xmlns="https://github.com/perspex">
+  <StackPanel Orientation="Vertical" Gap="4">
+    <TextBlock Classes="h1">TextBox</TextBlock>
+    <TextBlock Classes="h2">A control into which the user can input text</TextBlock>
+
+    <StackPanel Orientation="Horizontal"
+              Margin="0,16,0,0"
+              HorizontalAlignment="Center"
+              Gap="16">
+      <StackPanel Orientation="Vertical" Gap="8">
+        <TextBox Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit." Width="200" />
+        <TextBox Width="200" Watermark="Watermark" />
+        <TextBox Width="200" 
+                 Watermark="Floating Watermark" 
+                 UseFloatingWatermark="True"
+                 Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit."/>
+        <TextBox AcceptsReturn="True" TextWrapping="Wrap" Width="200" Height="125"
+                 Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est." />
+        <TextBox Text="TextBox with horizontal scrollbar set to Auto."
+                 ScrollViewer.HorizontalScrollBarVisibility="Auto"
+                 Width="200" />
+      </StackPanel>
+
+      <StackPanel Orientation="Vertical" Gap="8">
+        <TextBox Width="200" Text="Left aligned text" TextAlignment="Left" />
+        <TextBox Width="200" Text="Center aligned text" TextAlignment="Center" />
+        <TextBox Width="200" Text="Right aligned text" TextAlignment="Right" />
+      </StackPanel>
+    </StackPanel>
+  </StackPanel>
+</UserControl>

+ 18 - 0
samples/ControlCatalog/Pages/TextBoxPage.xaml.cs

@@ -0,0 +1,18 @@
+using Perspex.Controls;
+using Perspex.Markup.Xaml;
+
+namespace ControlCatalog.Pages
+{
+    public class TextBoxPage : UserControl
+    {
+        public TextBoxPage()
+        {
+            this.InitializeComponent();
+        }
+
+        private void InitializeComponent()
+        {
+            PerspexXamlLoader.Load(this);
+        }
+    }
+}