Update popup code (#1111)

* Update popup code

* update xref
This commit is contained in:
Andy (Steve) De George
2021-07-19 18:35:48 -04:00
committed by GitHub
parent 5d38c60929
commit b0376d820a
9 changed files with 89 additions and 139 deletions
@@ -1,58 +0,0 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D3D69C55-A09F-473C-99B8-876826A68796}</ProjectGuid>
<RootNamespace>Popup_Properties_Sample</RootNamespace>
<AssemblyName>Popup Properties Sample</AssemblyName>
<WarningLevel>4</WarningLevel>
<OutputType>winexe</OutputType>
<ApplicationVersion>1.0.0.*</ApplicationVersion>
<!-- Most people will use Publish dialog in Visual Studio to increment this -->
<ProductVersion>10.0.20821</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>.\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
<Optimize>true</Optimize>
<OutputPath>.\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="UIAutomationProvider" />
<Reference Include="UIAutomationTypes" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Runtime.Serialization" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="app.xaml" />
<Page Include="Window1.xaml" />
<Compile Include="app.xaml.cs">
<DependentUpon>app.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Window1.xaml.cs">
<DependentUpon>Window1.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@@ -1,64 +0,0 @@
<Window x:Class="Popup_Properties_Sample.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Popup_Properties_Sample"
>
<StackPanel>
<Border HorizontalAlignment="Left" BorderThickness="2" Margin="10,10,0,0"
BorderBrush="Green" Background="Beige" Width="300">
<TextBlock Foreground="Blue" FontSize="12" Margin="10,10,10,10"
TextWrapping="Wrap" >
This sample shows examples of a Popup controls
that are the logical children of a Buttons. Each Popup
window is positioned with respect to a Button. However,
because the Popup content is contained in its own window,
the Popup is not a visual child of the Button.
</TextBlock>
</Border>
<TextBlock/>
<TextBlock Foreground="Blue" FontSize="12" Margin="20,10,10,10"
TextWrapping="Wrap" Width="300" HorizontalAlignment="Left">
Type the content you want to appear in the Popup in the text
box below and then click the button to display the Popup
</TextBlock>
<TextBox Name="myTextBox" Margin="20,0,0,0" Foreground="HotPink"
Width="150" HorizontalAlignment="Left" TextChanged="setColors">
Type your Popup text here
</TextBox>
<!--<Snippet1>-->
<Button HorizontalAlignment="Left" Click="DisplayPopup"
Width="150" Margin="20,10,0,0">
<StackPanel>
<TextBlock>Display Your Popup Text</TextBlock>
<!--<Snippet2>-->
<Popup Name="myPopup">
<TextBlock Name="myPopupText"
Background="LightBlue"
Foreground="Blue">
Popup Text
</TextBlock>
</Popup>
<!--</Snippet2>-->
</StackPanel>
</Button>
<!--</Snippet1>-->
<TextBlock Foreground="Blue" FontSize="12" Margin="10,40,10,0"
TextWrapping="Wrap">
Click the button to create a Popup by using code
</TextBlock>
<!--<SnippetCreatePopupCodeXAML>-->
<Button Name="ButtonForPopup" HorizontalAlignment="Left"
Click="CreatePopup"
Width="150" Margin="20,10,0,0">
<StackPanel Name="aStackPanel">
<TextBlock>Create Popup</TextBlock>
</StackPanel>
</Button>
<!--</SnippetCreatePopupCodeXAML>-->
</StackPanel>
</Window>
@@ -1,55 +0,0 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Shapes;
namespace Popup_Properties_Sample
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
// Sample event handler:
private void DisplayPopup(object sender, RoutedEventArgs e)
{
myPopupText.Text = myTextBox.Text;
myPopup.IsOpen = true;
myPopup.StaysOpen = false;
}
// Used in UIElement.IsFocused.
//<SnippetIsFocused>
private void setColors(object sender, RoutedEventArgs e)
{
if (myTextBox.IsFocused) myTextBox.Foreground = Brushes.Brown;
}
//</SnippetIsFocused>
//<SnippetCreatePopupCode>
private void CreatePopup(object sender, RoutedEventArgs e)
{
//<SnippetCreatePopup>
Popup codePopup = new Popup();
TextBlock popupText = new TextBlock();
popupText.Text = "Popup Text";
popupText.Background = Brushes.LightBlue;
popupText.Foreground = Brushes.Blue;
codePopup.Child = popupText;
//</SnippetCreatePopup>
aStackPanel.Children.Add(codePopup);
codePopup.IsOpen = true;
}
//</SnippetCreatePopupCode>
}
}
@@ -1,9 +0,0 @@
<Application x:Class="Popup_Properties_Sample.app"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Startup="AppStartup"
>
<Application.Resources>
</Application.Resources>
</Application>
@@ -1,22 +0,0 @@
using System;
using System.Windows;
using System.Data;
using System.Xml;
using System.Configuration;
namespace Popup_Properties_Sample
{
/// <summary>
/// Interaction logic for app.xaml
/// </summary>
public partial class app : Application
{
void AppStartup(object sender, StartupEventArgs args)
{
Window1 mainWindow = new Window1();
mainWindow.Show();
}
}
}
@@ -1 +0,0 @@
wcsamp_components_popupsimple