The keyboard cannot enter English and numbers
window style
I have previously set a prohibition on the use of input methods " xmlns:input="clr-namespace:System.Windows.Input;assembly=PresentationCore"
input:InputMethod.IsInputMethodEnabled="False"
But now it’s deleted and you can’t enter numbers and English
<Window
x:Class="WS_StationManagerPlugin.Forms.FrmMPTable"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cr_utilitywpf="clr-namespace:CR_UtilityWPF;assembly=CR_UtilityWPF"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WS_StationManagerPlugin.Forms"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="FrmTbale"
Width="800"
Height="600"
Loaded="Window_Loaded"
mc:Ignorable="d">
<TextBox
x:Name="tbxCurrentPage"
Width="30"
Margin="5,0,5,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#002C41"
Foreground="#fff"
KeyDown="tbxCurrentPage_KeyDown"
PreviewTextInput="tbxCurrentPage_PreviewTextInput"
TextAlignment="Center">
<TextBox.ToolTip>
<ToolTip Content="当前页" />
</TextBox.ToolTip>
</TextBox>
</Window>
Related
This question already has an answer here:
Why is my Grid's width NaN?
(1 answer)
Closed last year.
I want to get size of Grid, but I get NaN..
Here is the xaml file:
<Window x:Class="TestWPFHCI.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:TestWPFHCI"
mc:Ignorable="d"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
Title="MainWindow" Height="700" Width="1024" MinHeight="700" MinWidth="1024">
<Grid Background="#FFEEEEEE">
<ScrollViewer x:Name="scrollOnGrid" Margin="280 55 10 10" HorizontalAlignment="Stretch" VerticalAlignment="Top" HorizontalScrollBarVisibility="Auto">
<!--<Grid Name="MCGrid" Margin="100 100 50 50">
</Grid>-->
<Grid Width="Auto" Margin="10 10 10 10" HorizontalAlignment="Stretch" VerticalAlignment="Top" x:Name="MCGrid">
<!-- <Grid x:Name="MCGrid"/> HorizontalAlignment="Center" VerticalAlignment="Center"/> -->
</Grid>
</ScrollViewer>
</Grid>
</Window>
And here is the code for get grid size, but I always get NaN.. Any idea for solution?
int width = MCGrid.Width;
Use MCGrid.ActualWidth to get the width of Grid.
double width = MCGrid.ActualWidth;
I have a pushpin on my map, but when I click and drag the map the pushpin stays on the same spot on the screen and doesn't move with the map. How do I put the pushpin on a specific location (coordinates) and have it stay there?
Here is my XAML code:
<Window x:Class="WPFKiosk.MapWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:m="clr-namespace:Microsoft.Maps.MapControl.WPF;assembly=Microsoft.Maps.MapControl.WPF"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WPFKiosk"
mc:Ignorable="d"
Title="MapWindow" Height="910" Width="1080" WindowStyle="None" ResizeMode="NoResize">
<!-- -->
<Grid Width="1080" Height="915">
<!-- <Image HorizontalAlignment="Left" Height="644" Margin="20,64,-35,0" VerticalAlignment="Top" Width="1095" Source="Images/map.png"/> -->
<m:Map x:Name="myMap" CredentialsProvider="My_Key" Mode="Road"/>
<m:Pushpin Location="28,-81"
/>
<Image HorizontalAlignment="Left" Height="100" Margin="510,740,0,0" VerticalAlignment="Top" Width="100" Source="Images/iTO Back Arrow.png" MouseLeftButtonDown="Image_MouseLeftButtonDown"/>
</Grid>
</Window>
The Pushpin is not "on the map".
It should look like this:
<m:Map x:Name="myMap" CredentialsProvider="My_Key" Mode="Road">
<m:Pushpin Location="28,-81"/>
</m:Map>
How do I make sure my sub menu-items stay within the main window like below in restore mode?
Here is a small portion of my code
<Window x:Name="Main Window" x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication1"
mc:Ignorable="d"
Icon="Notepad.ico"
Title="Home" Height="350" Width="860.142">
<Grid>
<Menu x:Name="menu" HorizontalAlignment="Left" Height="22" VerticalAlignment="Top" Width="852" Background="#FFA9D1F4">
<MenuItem Header="_File">
<MenuItem Header="New" Command="New"/>
</MenuItem>
</Menu>
</Grid>
</Window>
Another app.
Note: it may run fine on some computers as pointed out by #G K.
I'm trying to create a hamburger menu with subitems. I'm using this sample from
https://github.com/alicanerdogan/HamburgerMenu and modified it a bit. But my subitems do not appear on the menu. Can you please advise what I'm doing wrong?
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:hamburgerMenu="clr-namespace:HamburgerMenu;assembly=HamburgerMenu" x:Class="HamburgerMenuDemo.MainWindow"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525" WindowStyle="None" AllowsTransparency="True" x:Name="This">
<Grid>
<hamburgerMenu:HamburgerMenu Background="Blue" MenuIconColor="White" SelectionIndicatorColor="White" MenuItemForeground="White" HorizontalAlignment="Left" Margin="0,10,0,-10">
<hamburgerMenu:HamburgerMenu.Content>
<hamburgerMenu:HamburgerMenuItem Icon="Assets/home.png" Text="Home" SelectionCommand="{Binding ElementName=This}"/>
<hamburgerMenu:HamburgerMenuItem Icon="Assets/search.png" Text="Search"/>
<hamburgerMenu:HamburgerMenuItem Icon="Assets/favorite.png" Text="Likes"/>
<hamburgerMenu:HamburgerMenuItem Icon="Assets/list.png" Text="Lists"/>
<hamburgerMenu:HamburgerMenuItem Icon="Assets/person.png" Text="Profile" >
<hamburgerMenu:HamburgerMenuItem.Content>
<hamburgerMenu:HamburgerMenuItem SelectionIndicatorColor="Red" Text="1"/>
<hamburgerMenu:HamburgerMenuItem SelectionIndicatorColor="Red" Text="2"/>
<hamburgerMenu:HamburgerMenuItem SelectionIndicatorColor="Red" Text="3"/>
</hamburgerMenu:HamburgerMenuItem.Content>
</hamburgerMenu:HamburgerMenuItem>
</hamburgerMenu:HamburgerMenu.Content>
</hamburgerMenu:HamburgerMenu>
</Grid>
</Window>
Hi I try solve how stretch user control width / height which is active in tab control to tab control width / height.
I use caliburn micro.
I create some user control. Here is it:
<UserControl x:Class="Spirit.Views.TabChatView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:Micro="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"
xmlns:Controls="clr-namespace:Spirit.Controls" mc:Ignorable="d"
Name="ChatWindow"
Background="{StaticResource LightGrayBackground}"
Height="545" Width="680">[...]</UserControl>
This user control is active in shell, shell declaration is here.
<Window x:Class="Spirit.Views.ChatShellView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"
Title="ChatShellView" Height="300" Width="300">
<DockPanel>
<Button x:Name="OpenTab"
Content="Open Tab"
DockPanel.Dock="Top" />
<TabControl x:Name="Items">
<TabControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding DisplayName}" />
<Button Content="X"
cal:Message.Attach="CloseItem($dataContext)" />
</StackPanel>
</DataTemplate>
</TabControl.ItemTemplate>
</TabControl>
</DockPanel>
</Window>
Result if some user constrol is active in this shell you can see on this image:
I would like stretch user control on maximum tab control witdh / height.
Remove Height="545" Width="680" in UserControl definition