UWP group has weird behavior during RunTime - c#

I am new to XAML for UWP. So I am trying to make 4 group boxes using .XAML. When I attempt to run the code it stretches the group box that makes the GUI look terrible. What in the .XAML could cause something like this?
During design time it looks like:
When I run the code in the Simulator it looks like:
.XAML Code:
<Grid>
<ComboBox HorizontalAlignment="Center" Margin="0,48,0,0" VerticalAlignment="Top" Height="42" Width="232"/>
<ListView x:Name="DatabaseInfo" Header="Database Info." BorderThickness="2" BorderBrush="Black" SelectionMode="None" Margin="212,130,551,276" FontFamily="Tahoma" >
<ListView.HeaderTemplate>
<DataTemplate>
<ListViewHeaderItem Content="{Binding}" Height="40" />
</DataTemplate>
</ListView.HeaderTemplate>
<StackPanel Width="230" Height="30" Orientation="Horizontal" >
<TextBlock Name="ServerNameDisplay" HorizontalAlignment="Left" Text="Server" Width="115" Height="25" />
<TextBox Name="Server" HorizontalAlignment="Right" Text="" Height="25" Width="115" />
</StackPanel>
<StackPanel Width="230" Height="30" Orientation="Horizontal" >
<TextBlock Name="DatabaseNameDisplay" HorizontalAlignment="Left" Text="Database" Width="115" Height="25" />
<TextBox Name="Database" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
</StackPanel>
<StackPanel Width="230" Height="30" Orientation="Horizontal" >
<TextBlock Name="UserNameDisplay" HorizontalAlignment="Left" Text="UserName" Width="115" Height="25" />
<TextBox Name="UserName" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
</StackPanel>
<StackPanel Width="230" Height="30" Orientation="Horizontal" >
<TextBlock Name="PasswordDisplay" HorizontalAlignment="Left" Text="Password" Width="115" Height="25" />
<TextBox Name="Password" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
</StackPanel>
</ListView>
<ListView x:Name="RabbitMQInfo" Header="Rabbit MQ Info." BorderThickness="2" BorderBrush="Black" SelectionMode="None" Margin="564,130,199,350" FontFamily="Tahoma" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
<ListView.HeaderTemplate>
<DataTemplate>
<ListViewHeaderItem Content="{Binding}" Height="40" />
</DataTemplate>
</ListView.HeaderTemplate>
<StackPanel Width="230" Height="30" Orientation="Horizontal" >
<TextBlock Name="RabbitMQUserDisplay" HorizontalAlignment="Left" Text="UserName" Width="115" Height="25" />
<TextBox Name="RabbitMQUser" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
</StackPanel>
<StackPanel Width="230" Height="30" Orientation="Horizontal" >
<TextBlock Name="RabbitMQPassDisplay" HorizontalAlignment="Left" Text="Password" Width="115" Height="25" />
<TextBox Name="RabbitMQPass" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
</StackPanel>
</ListView>
<ListView x:Name="MachineInfo" Header="Name Info." BorderThickness="2" BorderBrush="Black" SelectionMode="None" Margin="212,398,551,125" FontFamily="Tahoma" >
<ListView.HeaderTemplate>
<DataTemplate>
<ListViewHeaderItem Content="{Binding}" Height="40" />
</DataTemplate>
</ListView.HeaderTemplate>
<StackPanel Width="230" Height="30" Orientation="Horizontal" >
<TextBlock Name="NameDisplay" HorizontalAlignment="Left" Text="Name" Width="115" Height="25" />
<TextBox Name="Name" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
</StackPanel>
</ListView>
<ListView x:Name="IPAddressInfo" Header="IP Address Info." BorderThickness="2" BorderBrush="Black" SelectionMode="None" Margin="564,332,199,156" FontFamily="Tahoma" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
<ListView.HeaderTemplate>
<DataTemplate>
<ListViewHeaderItem Content="{Binding}" Height="40" />
</DataTemplate>
</ListView.HeaderTemplate>
<StackPanel Width="230" Height="30" Orientation="Horizontal" >
<TextBlock Name="IPAddressDisplay" HorizontalAlignment="Left" Text="IPAddress" Width="115" Height="25" />
<TextBox Name="IPAddress" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
</StackPanel>
<StackPanel Width="230" Height="30" Orientation="Horizontal">
<TextBlock Name="PortDisplay" HorizontalAlignment="Left" Text="Port" Width="115" Height="25" />
<TextBox Name="Port" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
</StackPanel>
</ListView>
<Button x:Name="btnSave" Content="Save" Click="btnSave_Click" HorizontalAlignment="Center" Margin="0,539,0,0" VerticalAlignment="Top" Width="100" Height="50"/>
Another question I have about UWP applications is do you have to have something special to run the .exe that gets outputted in the Bin folder? When trying to run the .exe as Admin it just crashes and with an unhandled win32 exception.

When I attempt to run the code it stretches the group box that makes the GUI look terrible. What in the .XAML could cause something like this?
You used Margin property to control your XAML control's position, it will lead to the messy layout you see.
Please see Layout document to learn how to make a good layouts with XAML in UWP.
For example, you could simply use a Grid control to put these controls on different row and column.
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="4*"></RowDefinition>
<RowDefinition Height="4*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<ComboBox HorizontalAlignment="Center" Grid.Row="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Height="42" Width="232"/>
<ListView x:Name="DatabaseInfo" Grid.Row="1" Grid.Column="0" Header="Database Info." BorderThickness="2" BorderBrush="Black" SelectionMode="None" FontFamily="Tahoma" >
<ListView.HeaderTemplate>
<DataTemplate>
<ListViewHeaderItem Content="{Binding}" Height="40" />
</DataTemplate>
</ListView.HeaderTemplate>
<StackPanel Width="230" Height="30" Orientation="Horizontal" >
<TextBlock Name="ServerNameDisplay" HorizontalAlignment="Left" Text="Server" Width="115" Height="25" />
<TextBox Name="Server" HorizontalAlignment="Right" Text="" Height="25" Width="115" />
</StackPanel>
<StackPanel Width="230" Height="30" Orientation="Horizontal" >
<TextBlock Name="DatabaseNameDisplay" HorizontalAlignment="Left" Text="Database" Width="115" Height="25" />
<TextBox Name="Database" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
</StackPanel>
<StackPanel Width="230" Height="30" Orientation="Horizontal" >
<TextBlock Name="UserNameDisplay" HorizontalAlignment="Left" Text="UserName" Width="115" Height="25" />
<TextBox Name="UserName" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
</StackPanel>
<StackPanel Width="230" Height="30" Orientation="Horizontal" >
<TextBlock Name="PasswordDisplay" HorizontalAlignment="Left" Text="Password" Width="115" Height="25" />
<TextBox Name="Password" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
</StackPanel>
</ListView>
<ListView x:Name="RabbitMQInfo" Grid.Row="1" Grid.Column="1" Header="Rabbit MQ Info." BorderThickness="2" BorderBrush="Black" SelectionMode="None" FontFamily="Tahoma" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
<ListView.HeaderTemplate>
<DataTemplate>
<ListViewHeaderItem Content="{Binding}" Height="40" />
</DataTemplate>
</ListView.HeaderTemplate>
<StackPanel Width="230" Height="30" Orientation="Horizontal" >
<TextBlock Name="RabbitMQUserDisplay" HorizontalAlignment="Left" Text="UserName" Width="115" Height="25" />
<TextBox Name="RabbitMQUser" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
</StackPanel>
<StackPanel Width="230" Height="30" Orientation="Horizontal" >
<TextBlock Name="RabbitMQPassDisplay" HorizontalAlignment="Left" Text="Password" Width="115" Height="25" />
<TextBox Name="RabbitMQPass" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
</StackPanel>
</ListView>
<ListView x:Name="MachineInfo" Grid.Row="2" Grid.Column="0" Header="Name Info." BorderThickness="2" BorderBrush="Black" SelectionMode="None" FontFamily="Tahoma" >
<ListView.HeaderTemplate>
<DataTemplate>
<ListViewHeaderItem Content="{Binding}" Height="40" />
</DataTemplate>
</ListView.HeaderTemplate>
<StackPanel Width="230" Height="30" Orientation="Horizontal" >
<TextBlock Name="NameDisplay" HorizontalAlignment="Left" Text="Name" Width="115" Height="25" />
<TextBox Name="Name" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
</StackPanel>
</ListView>
<ListView x:Name="IPAddressInfo" Grid.Row="2" Grid.Column="1" Header="IP Address Info." BorderThickness="2" BorderBrush="Black" SelectionMode="None" FontFamily="Tahoma" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
<ListView.HeaderTemplate>
<DataTemplate>
<ListViewHeaderItem Content="{Binding}" Height="40" />
</DataTemplate>
</ListView.HeaderTemplate>
<StackPanel Width="230" Height="30" Orientation="Horizontal" >
<TextBlock Name="IPAddressDisplay" HorizontalAlignment="Left" Text="IPAddress" Width="115" Height="25" />
<TextBox Name="IPAddress" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
</StackPanel>
<StackPanel Width="230" Height="30" Orientation="Horizontal">
<TextBlock Name="PortDisplay" HorizontalAlignment="Left" Text="Port" Width="115" Height="25" />
<TextBox Name="Port" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
</StackPanel>
</ListView>
<Button x:Name="btnSave" Content="Save" Grid.Row="3" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" Width="100" Height="50"/>
</Grid>
Another question I have about UWP applications is do you have to have something special to run the .exe that gets outputted in the Bin folder? When trying to run the .exe as Admin it just crashes and with an unhandled win32 exception.
UWP runs in sandbox, it's different from the classic desktop application. You cannot directly double click the '.exe' file to start it. When you're coding in visual studio, you could press F5 to start it and debug it. If it has been deployed, you could start it from windows 'Start' menu.
Tips: Please do not post multiple question in one post next time.

Related

UWP C# WindowsIoT Keypad & Textblock Binding

I am testing out the keypad & textblock binding based on the UWP sample PhoneCall.
However when I run my code when pressing on the keypad, the key-pressed doesn't print on the textblock.
I did some changes from sample code. I have added ViewModels & Helpers from the samples.
Can advise where did I do wrong?
Thanks.
My XAML code as follow;
<TextBlock x:Name="KeypadDisplay" FontSize="50" TextAlignment="Right"
Text="{Binding DialerPhoneNumber.NumberToDial, Mode=OneWay}"
VerticalAlignment="Top" HorizontalAlignment="Left" Height="80" Width="300" Margin="70,20,0,0">
</TextBlock>
<Button Grid.Column="1" Grid.Row="1"
Command="{Binding ProcessDialPad}" Style="{StaticResource TextBlockButtonStyle}"
CommandParameter="1" Tag="1" HorizontalAlignment="Center" Height="30" Width="100">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
<TextBlock Text="1" FontSize="18" FontWeight="Bold" Style="{StaticResource BodyTextBlockStyle}"/>
</StackPanel>
</Button>
<Button Grid.Column="2" Grid.Row="1"
Command="{Binding ProcessDialPad}" Style="{StaticResource TextBlockButtonStyle}"
CommandParameter="2" Tag="2" HorizontalAlignment="Center" Height="30" Width="100">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
<TextBlock Text="2" FontSize="18" FontWeight="Bold" Style="{StaticResource BodyTextBlockStyle}"/>
</StackPanel>
</Button>
<Button Grid.Column="3" Grid.Row="1"
Command="{Binding ProcessDialPad}" Style="{StaticResource TextBlockButtonStyle}"
CommandParameter="3" Tag="3" HorizontalAlignment="Center" Height="30" Width="100">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
<TextBlock Text="3" FontSize="18" FontWeight="Bold" Style="{StaticResource BodyTextBlockStyle}"/>
</StackPanel>
</Button>
Update - 03-07-2019
The processdialpad routine is as follow
public ICommand ProcessDialPad
{
get
{
if (dialPadCommand == null)
{
dialPadCommand = new RelayCommand(
this.DialPadInvoked);
}
return dialPadCommand;
}
}
I guess you miss setting the DataContext for the page to bind the model. Please check if you add the following code in your page.
DataContext = ViewModelDispatcher.DialerViewModel;
Following code works fine for me. Here i used the same code in ViewModels and Helpers from sample PhoneCall.
MainPage.xaml
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" HorizontalAlignment="Stretch">
<Border Background="BlueViolet">
<TextBlock x:Name="KeypadDisplay" FontSize="50" TextAlignment="Right" Foreground="White"
Text="{Binding DialerPhoneNumber.NumberToDial, Mode=OneWay}"
VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="100">
</TextBlock>
</Border>
</StackPanel>
<StackPanel Grid.Row="1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="600">
<Grid.RowDefinitions>
<RowDefinition Height="12" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="12" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="12" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="12" />
</Grid.ColumnDefinitions>
<Button Grid.Column="1" Grid.Row="1"
Command="{Binding ProcessDialPad}" Style="{StaticResource DialpadButtonStyle}"
CommandParameter="1" Tag="1" Holding="OnDialPadHolding">
<StackPanel Orientation="Vertical">
<TextBlock Text="1" Style="{StaticResource DialpadNumberStyle}"/>
<FontIcon FontFamily="Segoe MDL2 Assets"
FontWeight="ExtraLight"
Glyph=""
RenderTransformOrigin="0.5,0.5"
Height="14.8">
<FontIcon.RenderTransform>
<CompositeTransform ScaleX="1" ScaleY="1"/>
</FontIcon.RenderTransform>
</FontIcon>
</StackPanel>
</Button>
<Button Grid.Column="2" Grid.Row="1"
Command="{Binding ProcessDialPad}" Style="{StaticResource DialpadButtonStyle}"
CommandParameter="2">
<StackPanel Orientation="Vertical">
<TextBlock Text="2" Style="{StaticResource DialpadNumberStyle}"/>
<TextBlock Text="ABC" Style="{StaticResource DialpadLetterStyle}"/>
</StackPanel>
</Button>
<Button Grid.Column="3" Grid.Row="1"
Command="{Binding ProcessDialPad}" Style="{StaticResource DialpadButtonStyle}"
CommandParameter="3">
<StackPanel Orientation="Vertical">
<TextBlock Text="3" Style="{StaticResource DialpadNumberStyle}"/>
<TextBlock Text="DEF" Style="{StaticResource DialpadLetterStyle}"/>
</StackPanel>
</Button>
<Button Grid.Column="1" Grid.Row="2"
Command="{Binding ProcessDialPad}" Style="{StaticResource DialpadButtonStyle}"
CommandParameter="4">
<StackPanel Orientation="Vertical">
<TextBlock Text="4" Style="{StaticResource DialpadNumberStyle}"/>
<TextBlock Text="GHI" Style="{StaticResource DialpadLetterStyle}"/>
</StackPanel>
</Button>
<Button Grid.Column="2" Grid.Row="2"
Command="{Binding ProcessDialPad}" Style="{StaticResource DialpadButtonStyle}"
CommandParameter="5">
<StackPanel Orientation="Vertical">
<TextBlock Text="5" Style="{StaticResource DialpadNumberStyle}"/>
<TextBlock Text="JKL" Style="{StaticResource DialpadLetterStyle}"/>
</StackPanel>
</Button>
<Button Grid.Column="3" Grid.Row="2"
Command="{Binding ProcessDialPad}" Style="{StaticResource DialpadButtonStyle}"
CommandParameter="6">
<StackPanel Orientation="Vertical">
<TextBlock Text="6" Style="{StaticResource DialpadNumberStyle}"/>
<TextBlock Text="MNO" Style="{StaticResource DialpadLetterStyle}"/>
</StackPanel>
</Button>
<Button Grid.Column="1" Grid.Row="3"
Command="{Binding ProcessDialPad}" Style="{StaticResource DialpadButtonStyle}"
CommandParameter="7">
<StackPanel Orientation="Vertical">
<TextBlock Text="7" Style="{StaticResource DialpadNumberStyle}"/>
<TextBlock Text="PQRS" Style="{StaticResource DialpadLetterStyle}"/>
</StackPanel>
</Button>
<Button Grid.Column="2" Grid.Row="3"
Command="{Binding ProcessDialPad}" Style="{StaticResource DialpadButtonStyle}"
CommandParameter="8">
<StackPanel Orientation="Vertical">
<TextBlock Text="8" Style="{StaticResource DialpadNumberStyle}"/>
<TextBlock Text="TUV" Style="{StaticResource DialpadLetterStyle}"/>
</StackPanel>
</Button>
<Button Grid.Column="3" Grid.Row="3"
Command="{Binding ProcessDialPad}" Style="{StaticResource DialpadButtonStyle}"
CommandParameter="9">
<StackPanel Orientation="Vertical">
<TextBlock Text="9" Style="{StaticResource DialpadNumberStyle}"/>
<TextBlock Text="WXYZ" Style="{StaticResource DialpadLetterStyle}"/>
</StackPanel>
</Button>
<Button Grid.Column="1" Grid.Row="4"
Command="{Binding ProcessDialPad}" Style="{StaticResource DialpadButtonStyle}"
CommandParameter="*" Tag="," Holding="OnDialPadHolding">
<StackPanel Orientation="Vertical">
<TextBlock Text="*" Style="{StaticResource DialpadNumberStyle}"/>
<TextBlock Text="," Style="{StaticResource DialpadLetterStyle}"/>
</StackPanel>
</Button>
<Button Grid.Column="2" Grid.Row="4"
Command="{Binding ProcessDialPad}" Style="{StaticResource DialpadButtonStyle}"
CommandParameter="0" Tag="+" Holding="OnDialPadHolding">
<StackPanel Orientation="Vertical">
<TextBlock Text="0" Style="{StaticResource DialpadNumberStyle}"/>
<TextBlock Text="+" Style="{StaticResource DialpadLetterStyle}"/>
</StackPanel>
</Button>
<Button Grid.Column="3" Grid.Row="4"
Command="{Binding ProcessDialPad}" Style="{StaticResource DialpadButtonStyle}"
CommandParameter="#" Tag=";" Holding="OnDialPadHolding">
<StackPanel Orientation="Vertical">
<TextBlock Text="#" Style="{StaticResource DialpadNumberStyle}"/>
<TextBlock Text=";" Style="{StaticResource DialpadLetterStyle}"/>
</StackPanel>
</Button>
</Grid>
</StackPanel>
</Grid>
MainPage.cs
public MainPage()
{
this.InitializeComponent();
DataContext = ViewModelDispatcher.DialerViewModel;
}
/// <summary>
/// Processes press and hold for the buttons that supports press and hold. E.g
/// 1 -> Voicemail
/// 0 -> +
/// * -> , (pause)
/// # -> ; (wait)
/// </summary>
private void OnDialPadHolding(object sender, Windows.UI.Xaml.Input.HoldingRoutedEventArgs e)
{
Button button = (Button)sender;
DialerViewModel vm = (DialerViewModel)DataContext;
if ((vm != null) && (e.HoldingState == Windows.UI.Input.HoldingState.Started))
{
vm.ProcessDialPadHolding.Execute(button.Tag);
}
}

WPF Scrollview UserControl

I'm trying to add an ScrollBar for my UserControl, I have a left Menu a Top bar and under the top bar is the Content where I put my UserControl so only the content need to have a ScrollBar.
I did this by Wrapping my the Code in my UserControl in <ScrollView></ScrollView>
Everything is working fine only not the Full hight not, When I set hight to Auto the content is not scrollable anymore... If I set it to 500px it works but this makes no sense why should I make my content 500px I want that the ScrollBar goes with my Windows size and be always so big like my Window.
It could be so easy microsoft (<StackPanel Scrollbar="Auto" />)...
...but why easy...
(Yes I found some Posts here with same problem but no one is resolving my problem)
<UserControl x:Class="mausys.telegram"
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:local="clr-namespace:mausys"
mc:Ignorable="d" Width="Auto" Height="500">
<Grid Background="Aqua">
<ScrollViewer VerticalScrollBarVisibility="auto" >
<StackPanel Grid.Column="0" >
<TextBox x:Name="telegramtextBox" HorizontalAlignment="Left" Height="23" Margin="48,78,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
<TextBox x:Name="telegramtextBox1" HorizontalAlignment="Left" Height="23" Margin="48,153,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
<Label x:Name="telegramlabel" Content="Phone Number:" HorizontalAlignment="Left" Margin="48,52,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.219,-0.282" Width="106" Height="26"/>
<Label x:Name="telegramlabel1" Content="Verifycation Code:" HorizontalAlignment="Left" Margin="48,122,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.506,-4.269"/>
<Button x:Name="telegrambutton" Content="Verify" HorizontalAlignment="Left" Margin="173,156,0,0" VerticalAlignment="Top" Width="75" RenderTransformOrigin="-0.234,0.571"/>
<Button x:Name="Telegrambutton1" Content="Login" HorizontalAlignment="Left" Margin="173,78,0,0" VerticalAlignment="Top" Width="75" Click="Phone_Click" />
<Button x:Name="tglogin" Click="tglogin_Click" Content="TG LogIn" HorizontalAlignment="Left" Background="BlanchedAlmond" Width="120" Margin="277,52,323,928" />
<Button x:Name="feedy" Click="feedy_Click" Content="feedy" HorizontalAlignment="Left" Background="BlanchedAlmond" Width="120" Margin="277,13,323,967" />
<Button x:Name="tbrowser" Content="Open Browser" HorizontalAlignment="Left" Background="BlanchedAlmond" Width="120" Margin="277,86,323,894" />
<Label x:Name="telegramlabel2" Content="Telegram Account Login" HorizontalAlignment="Left" FontWeight="Bold" Margin="48,10,0,0" VerticalAlignment="Top"/>
<TabControl x:Name="tabControl" HorizontalAlignment="Left" Height="343" Margin="48,181,0,0" VerticalAlignment="Top" Width="215">
<TabItem Header="TabItem">
<Grid Background="#FFE5E5E5"/>
</TabItem>
<TabItem Header="TabItem">
<Grid Background="#FFE5E5E5"/>
</TabItem>
<ListBox x:Name="listBox" Height="100" Width="100"/>
</TabControl>
<ListView x:Name="listView" HorizontalAlignment="Left" Height="151" Margin="277,122,0,0" VerticalAlignment="Top" Width="134">
<ListView.View>
<GridView>
<GridViewColumn/>
</GridView>
</ListView.View>
</ListView>
<Button x:Name="button" Content="Button" HorizontalAlignment="Left" Margin="10,529,0,0" VerticalAlignment="Top" Width="300" Height="126"/>
<Button x:Name="button2" Content="Button" HorizontalAlignment="Left" Margin="10,660,0,0" VerticalAlignment="Top" Width="75" Height="330"/>
</StackPanel>
</ScrollViewer>
</Grid>
<Window x:Class="xyz.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:fa="http://schemas.fontawesome.io/icons/"
xmlns:local="clr-namespace:mausys"
xmlns:local1="clr-namespace:mausys.UserControls"
mc:Ignorable="d"
Title="mausys" Height="Auto" Width="1596" WindowStyle="SingleBorderWindow" >
<!--Status and Revisions-->
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="85" />
</WindowChrome.WindowChrome>
<Border>
<DockPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="160" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!--Menu Left-->
<!--Hover effect-->
<StackPanel Grid.Column="0" Background="#23282D" >
<Label Foreground="#9EA3A8" FontWeight="Bold" FontSize="18" HorizontalAlignment="Left" Margin="15 0 0 5" >
<StackPanel Orientation="Horizontal">
<Image Source="img/logomausys.png" Width="35" Height="32" />
<TextBlock Text="MAUSYS" />
</StackPanel>
</Label>
<Button Background="#23282D" WindowChrome.IsHitTestVisibleInChrome="True" Foreground="#F1F1F1" FontSize="14" HorizontalContentAlignment="Left" Padding="10" BorderThickness="0" Height="44" >
<StackPanel Orientation="Horizontal">
<fa:ImageAwesome Icon="Dashboard" Foreground="#9EA3A8" Height="15" Width="15" Margin="10 0 6 0" />
<TextBlock Text="Dashboard" />
</StackPanel>
</Button>
<Button Background="#23282D" Foreground="#F1F1F1" FontSize="14" HorizontalContentAlignment="Left" Padding="10" BorderThickness="0" Height="44" >
<StackPanel Orientation="Horizontal">
<fa:ImageAwesome Icon="MLink" Foreground="#9EA3A8" Height="15" Width="15" Margin="10 0 6 0" />
<TextBlock Text="MLink" />
</StackPanel>
</Button>
<Button Background="#23282D" Foreground="#F1F1F1" FontSize="14" HorizontalContentAlignment="Left" Padding="10" BorderThickness="0" Height="44" >
<StackPanel Orientation="Horizontal">
<fa:ImageAwesome Icon="MLink" Foreground="#9EA3A8" Height="15" Width="15" Margin="10 0 6 0" />
<TextBlock Text="MLink" />
</StackPanel>
</Button>
<Button Background="#23282D" Foreground="#F1F1F1" FontSize="14" HorizontalContentAlignment="Left" Padding="10" BorderThickness="0" Height="44" >
<StackPanel Orientation="Horizontal">
<fa:ImageAwesome Icon="Angellist" Foreground="#9EA3A8" Height="15" Width="15" Margin="10 0 6 0" />
<TextBlock Text="MLink" />
</StackPanel>
</Button>
<Button Background="#23282D" Foreground="#F1F1F1" FontSize="14" HorizontalContentAlignment="Left" Padding="10" BorderThickness="0" Height="44" >
<StackPanel Orientation="Horizontal">
<fa:ImageAwesome Icon="Anchor" Foreground="#9EA3A8" Height="15" Width="15" Margin="10 0 6 0" />
<TextBlock Text="MLink" />
</StackPanel>
</Button>
<!--SEPARATOR-->
<Separator Background="#9EA3A8" Margin="0 10 0 10 " />
<Button Background="#23282D" Foreground="#F1F1F1" FontSize="14" HorizontalContentAlignment="Left" Padding="10" BorderThickness="0" Height="44" >
<StackPanel Orientation="Horizontal">
<fa:ImageAwesome Icon="AddressBook" Foreground="#9EA3A8" Height="15" Width="15" Margin="10 0 6 0" />
<TextBlock Text="MLinks" />
</StackPanel>
</Button>
<Button Background="#23282D" Foreground="#F1F1F1" FontSize="14" HorizontalContentAlignment="Left" Padding="10" BorderThickness="0" Height="44" >
<StackPanel Orientation="Horizontal">
<fa:ImageAwesome Icon="CalendarPlusOutline" Foreground="#9EA3A8" Height="15" Width="15" Margin="10 0 6 0" />
<TextBlock Text="MLink" />
</StackPanel>
</Button>
<Label Foreground="#9EA3A8" FontSize="12" HorizontalAlignment="Left" Margin="5 30 0 5" >
<StackPanel Orientation="Horizontal">
<fa:ImageAwesome Icon="ArrowCircleLeft" Foreground="#9EA3A8" Height="15" Margin="10 0 6 0" />
<TextBlock Text="MLink" />
</StackPanel>
</Label>
</StackPanel>
<!--APP Content-->
<StackPanel Grid.Column="1" Background="#F1F1F1" >
<!--Top Bar-->
<Grid VerticalAlignment="Top" Background="#23282D" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" VerticalAlignment="Center" >
<TextBlock Text="hhh" FontWeight="Bold" Foreground="#9EA3A8" Margin="6 0 0 0" />
</StackPanel>
<StackPanel Grid.Column="1" >
</StackPanel>
<StackPanel Height="31" Grid.Column="2" VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Right" >
</StackPanel>
</Grid>
<!--Window Controls & Console -->
<Grid VerticalAlignment="Top" Background="#0073AA" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel WindowChrome.IsHitTestVisibleInChrome="True" Grid.Column="0" VerticalAlignment="Center" >
<Button Content="ADD NEW" Width="70" Height="50" HorizontalAlignment="Left" Margin="10 0 0 0" />
</StackPanel>
<StackPanel Grid.Column="1" >
</StackPanel>
<StackPanel Grid.Column="2" WindowChrome.IsHitTestVisibleInChrome="True" Height="60" VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Right" >
<Button fa:Awesome.Content="WindowMinimize" Foreground="#0073AA" Background="White" Content="_" Height="31" Width="31" Margin="3" Name="MinimizeButton" Click="MinimizeButton_Click" />
<Button fa:Awesome.Content="WindowMaximize" Foreground="#0073AA" Background="White" Content="[]" Height="31" Width="31" Margin="3" Name="MaximizeButton" Click="MaximizeButton_Click" />
<Button fa:Awesome.Content="Close" Foreground="#0073AA" Background="White" Content="X" Height="31" Width="31" Margin="3 3 20 3" Name="CloseButton" Click="CloseButton_Click" />
</StackPanel>
</Grid>
<!--Window Controls & Console -->
<Grid VerticalAlignment="Top" Background="Beige">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" VerticalAlignment="Center" >
<!--local:telegram />-->
</StackPanel>
</Grid>
<!--User Controls HERE ARE THE USER CONTROLS-->
<local:telegram />
</StackPanel>
</Grid>
</DockPanel>
</Border>

What panels and containers allow Overlapping of UI elements

What are the panels and containers that allow overlapping with varying z-index ? (escluding Canvas)
--Since I was asked for details this is part of the code:
<DockPanel HorizontalAlignment="Left" Height="32" LastChildFill="False" Margin="10,0,0,10"
VerticalAlignment="Top">
<Rectangle Fill="{Binding (extensions:PaletteColor.FillBrush)}" Height="32" RadiusY="4"
RadiusX="4"
Stroke="#FF000000" Width="32" HorizontalAlignment="Left" VerticalAlignment="Top"
MouseLeftButtonUp="TargetColorClick"
ToolTip="{Binding (extensions:PaletteColor.Name)}" />
Ok I was able to do this with Clemens support:
<TextBlock TextWrapping="Wrap" Text="16"
Margin="-32,0,0,0" Height="16"
HorizontalAlignment="Center" />
--Answering to another question my XAML for whole control looks like this:
<ItemsControl ItemsSource="{Binding (local:MainWindow.CurrentPaletteSet)}" Width="400" Margin="665,67,14,-67">
<ItemsControl.ItemTemplate>
<DataTemplate>
<DockPanel HorizontalAlignment="Left" Height="32" LastChildFill="False" Margin="10,0,0,10"
VerticalAlignment="Top">
<Rectangle Fill="{Binding (extensions:PaletteColor.FillBrush)}" Height="32" RadiusY="4"
RadiusX="4"
Stroke="#FF000000" Width="32" HorizontalAlignment="Left" VerticalAlignment="Top"
MouseLeftButtonUp="TargetColorClick"
ToolTip="{Binding (extensions:PaletteColor.Name)}" />
<TextBlock TextWrapping="Wrap" Text="16"
Margin="-32,0,0,0" Height="16"
HorizontalAlignment="Center" />
<TextBlock TextWrapping="Wrap" Text="{Binding (extensions:PaletteColor.FullRgbString)}"
Margin="5,0,0,0" Height="16"
HorizontalAlignment="Left" DockPanel.Dock="Top" />
<TextBlock TextWrapping="Wrap" Text="{Binding (extensions:PaletteColor.FullHslString)}"
Margin="5,0,0,0"
Height="16" HorizontalAlignment="Left" DockPanel.Dock="Top" MinWidth="121" />
</DockPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel></ItemsControl>

Add grid in listview

I am looking for something like:
lv.Children.Add(e1);
But lv.children.add does not exist
<ListView x:Name="lv" Height="300" Margin="727,97,208,231" Grid.Row="1" >
<Grid Name="e1" Height="48" Width="417" >
<Image Width="32" HorizontalAlignment="Left" Margin="5" Source="ms-appx:///img/coffee.png" />
<TextBlock Text="caffee" FontSize="18" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="40,0,26,5" ></TextBlock>
<TextBlock Text="$2" FontSize="18" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="5,5,30,5"></TextBlock>
<TextBlock Text="caffee" FontSize="18" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="5,5,90,5"></TextBlock>
</Grid>
</ListView>
you have to use
lv.Items.Add(e1);

Autocompletebox doesn't show the list of contents as suggestion while binding from a sqlite db

I have to get the suggestion list in the autocomplete textbox.I give the input as binding names..You can see in the xaml code in the listbox i can bind the names from Img source..but in the autocomplete i cant.. guide me that should i have to insert any code for this in Mainpage.cs
<ColumnDefinition Width="400"/>
</Grid.ColumnDefinitions>
</Grid>
<Button Content="Button" Height="72" HorizontalAlignment="Left" Margin="12,6,0,0" Name="button1" VerticalAlignment="Top" Width="160" Click="button1_Click" />
<ListBox HorizontalAlignment="Stretch" Name="listBox1" VerticalAlignment="Stretch" ItemsSource="{Binding Img}" Grid.Row="1" DataContext="{Binding}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical">
<Image Height="160" HorizontalAlignment="Left" Margin="0,0,-400,0" VerticalAlignment="Top" Width="175" Source="{Binding thumb}"/>
<!--ContentControl Width="150" Height="110" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,0,-400,0" Content="{Binding Image}"/>-->
<TextBlock TextWrapping="NoWrap" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="190,-167,-200,0" Text="{Binding title}"/>
<TextBlock TextWrapping="Wrap" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="190,-135,-200,0" Text="{Binding page}"/>
<TextBlock FontSize="16" TextWrapping="Wrap" Margin="190,-95,0,0" Text="{Binding Name}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<TextBox Height="72" HorizontalAlignment="Left" Margin="157,6,0,0" Name="textBox1" Text="" VerticalAlignment="Top" Width="112" />
<toolkit:AutoCompleteBox HorizontalAlignment="Left" Margin="261,6,0,0" Name="autoCompleteBox1" VerticalAlignment="Top" Width="182" ItemsSource="{Binding Img}" ValueMemberBinding="{Binding Name}">
<toolkit:AutoCompleteBox.ItemTemplate>
<DataTemplate>
<StackPanel >
<TextBlock
Text="{Binding Name}"/>
</StackPanel>
</DataTemplate>
</toolkit:AutoCompleteBox.ItemTemplate>
</toolkit:AutoCompleteBox>
</Grid>
I solved this issue, I changed the xaml as
</TextBox>
<toolkit:AutoCompleteBox HorizontalAlignment="Left" FilterMode="Contains" Margin="-11,-14,0,0" Name="autoCompleteBox1" ValueMemberBinding="{Binding Name}" VerticalAlignment="Top" Width="800" Background="White" Height="91" Text="" TextChanged="autocompletebox1_Textchanged" BorderBrush="White" Visibility="Visible" Padding="50,14,6,4" BorderThickness="0" IsHitTestVisible="True">
<toolkit:AutoCompleteBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Width="250" TextWrapping="Wrap" Margin="25,25,0,0" FontSize="20" Text="{Binding Name}" />
<Image Height="110" Width="150" Source="{Binding Image1}" />
</StackPanel>
</DataTemplate>
</toolkit:AutoCompleteBox.ItemTemplate>
</toolkit:AutoCompleteBox>

Categories