That white line
I would like to separate it but being issue. How to put stack panel on the Hamburger menu top.F
stackpanel in the HamburgerButtonInfo , each click, the entire HamburgerButtonInfo are selected,How to remove the overall effect selected?
<Page
x:Class="心理FM.Views.Shell"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="using:Template10.Controls"
xmlns:Core="using:Microsoft.Xaml.Interactions.Core"
xmlns:Interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:behaviors="using:Template10.Behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:心理FM.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:views="using:心理FM.Views"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
mc:Ignorable="d">
<Controls:HamburgerMenu x:Name="MyHamburgerMenu"
>
<Controls:HamburgerMenu.PrimaryButtons>
<!--头像,签到-->
<Controls:HamburgerButtonInfo >
<StackPanel Orientation="Horizontal" Width="400" Height="150">
<StackPanel.Background>
<ImageBrush ImageSource="../Assets/04.jpg"></ImageBrush>
</StackPanel.Background>
<Ellipse Height="70" Width="70" Margin="10,60,0,10">
<Ellipse.Fill>
<ImageBrush ImageSource="../Assets/IMG_0003.JPG" />
</Ellipse.Fill>
</Ellipse>
<StackPanel VerticalAlignment="Center" Margin="10,45,0,0">
<TextBlock Name="UserName" Text="user" FontSize="20" VerticalAlignment="Center"/>
<TextBlock Name="Count" Text="null" FontSize="20" VerticalAlignment="Center"/>
</StackPanel>
<Button Name="SignBtn" Content="签到" HorizontalAlignment="" VerticalAlignment="Bottom"></Button>
</StackPanel>
</Controls:HamburgerButtonInfo>
<Controls:HamburgerButtonInfo ClearHistory="True">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<Image Source="../Assets/"></Image>
<TextBlock Text="我关注的" Margin="12, 0, 0, 0" VerticalAlignment="Center" />
</StackPanel>
</Controls:HamburgerButtonInfo>
<Controls:HamburgerButtonInfo ClearHistory="True">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<Image Source="../Assets/"></Image>
<TextBlock Text="我的下载" Margin="12, 0, 0, 0" VerticalAlignment="Center" />
</StackPanel>
</Controls:HamburgerButtonInfo>
<Controls:HamburgerButtonInfo ClearHistory="True">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<Image Source="../Assets/"></Image>
<TextBlock Text="我的话题" Margin="12, 0, 0, 0" VerticalAlignment="Center" />
</StackPanel>
</Controls:HamburgerButtonInfo>
<Controls:HamburgerButtonInfo ClearHistory="True">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<Image Source="../Assets/"></Image>
<TextBlock Text="定时关闭" Margin="12, 0, 0, 0" VerticalAlignment="Center" />
</StackPanel>
</Controls:HamburgerButtonInfo>
<Controls:HamburgerButtonInfo ClearHistory="True">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<Image Source="../Assets/"></Image>
<TextBlock Text="通知" Margin="12, 0, 0, 0" VerticalAlignment="Center" />
</StackPanel>
</Controls:HamburgerButtonInfo>
<Controls:HamburgerButtonInfo ClearHistory="True">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<Image Source="../Assets/"></Image>
<TextBlock Text="私信" Margin="12, 0, 0, 0" VerticalAlignment="Center" />
</StackPanel>
</Controls:HamburgerButtonInfo>
</Controls:HamburgerMenu.PrimaryButtons>
<Controls:HamburgerMenu.SecondaryButtons>
<!-- profile button -->
<Controls:HamburgerButtonInfo ButtonType="Command">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Tapped">
<behaviors:MessageDialogAction Title="Show profile" Content="This is an example of a Command-type hamburger button. It does not navigate, only raises the Tapped event for some custom implementation." />
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
<StackPanel Orientation="Horizontal">
<ToolTipService.ToolTip>
<TextBlock MaxWidth="225"
Text="This is the tooltip for the Show Profile command button. Remember to localize."
TextWrapping="Wrap" />
</ToolTipService.ToolTip>
<SymbolIcon Width="48"
Height="48"
Symbol="Contact" />
<TextBlock Margin="12,0,0,0"
VerticalAlignment="Center"
Text="User profile" />
</StackPanel>
</Controls:HamburgerButtonInfo>
<!-- settingspage button -->
<Controls:HamburgerButtonInfo x:Name="SettingsButton"
PageParameter="0"
PageType="views:SettingsPage">
<Controls:HamburgerButtonInfo.NavigationTransitionInfo>
<SuppressNavigationTransitionInfo />
</Controls:HamburgerButtonInfo.NavigationTransitionInfo>
<StackPanel Orientation="Horizontal">
<SymbolIcon Width="48"
Height="48"
Symbol="Setting" />
<TextBlock Margin="12,0,0,0"
VerticalAlignment="Center"
Text="Settings" />
</StackPanel>
</Controls:HamburgerButtonInfo>
</Controls:HamburgerMenu.SecondaryButtons>
</Controls:HamburgerMenu>
</Page>
You can simply set the ButtonType to Literal in your first Controls:HamburgerButtonInfo.
There are three types for HamburgerButton: Command, Toggle and Literal, by default it is "Toggle", you can change this property to see the difference.
In short, in this case, you can modify your code like this:
<Controls:HamburgerButtonInfo ButtonType="Literal">
<StackPanel Orientation="Horizontal" Width="400" Height="150">
<StackPanel.Background>
<ImageBrush ImageSource="../Assets/04.jpg"></ImageBrush>
</StackPanel.Background>
<Ellipse Height="70" Width="70" Margin="10,60,0,10">
<Ellipse.Fill>
<ImageBrush ImageSource="../Assets/IMG_0003.JPG" />
</Ellipse.Fill>
</Ellipse>
<StackPanel VerticalAlignment="Center" Margin="10,45,0,0">
<TextBlock Name="UserName" Text="user" FontSize="20" VerticalAlignment="Center"/>
<TextBlock Name="Count" Text="null" FontSize="20" VerticalAlignment="Center"/>
</StackPanel>
<Button Name="SignBtn" Content="签到" HorizontalAlignment="" VerticalAlignment="Bottom"></Button>
</StackPanel>
</Controls:HamburgerButtonInfo>
Related
So I struggle with the XAML alignment a bit and I hoped for someone who could help me get trough it.
This is the Code. I will break it down below:
<Grid x:Name="Output" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Row="0">
<StackPanel>
<Button Style="{StaticResource AppBarButtonStyle}" Click="ShowPopupOffsetClicked"/>
<Image Source="Assets/images/icon_thumbnail.png"></Image>
</StackPanel>
<Popup VerticalOffset="60" HorizontalOffset="0" x:Name="StandardPopup">
<Border BorderBrush="{StaticResource ApplicationForegroundThemeBrush}"
Background="{StaticResource ApplicationPageBackgroundThemeBrush}"
BorderThickness="2" Width="300" Height="350">
<StackPanel >
<TextBlock>
<Run x:Name="MyRun" Text=""/>
</TextBlock>
<StackPanel Orientation="Horizontal">
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top">
<TextBox x:Name="searchTextBox" Width="200" Height="30" />
</StackPanel>
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Top">
<Button x:Name="firstSearch" Style="{StaticResource AppBarButtonStyle}" Tapped="OnOptionItemTapped" >
<Image Source="Assets/images/view_search.png"/>
</Button>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button x:Name="previous" Style="{StaticResource AppBarButtonStyle}" Tapped="OnOptionItemTapped">
<Image Source="/Assets/images/left_arrow.png"/>
</Button>
<Button x:Name="next" Style="{StaticResource AppBarButtonStyle}" Tapped="OnOptionItemTapped">
<Image Source="/Assets/images/right_arrow.png"/>
</Button>
</StackPanel>
<Button Content="Close" Click="ClosePopupClicked" HorizontalAlignment="Center" VerticalAlignment="Bottom"/>
</StackPanel>
</Border>
</Popup>
</Grid>
This part will be MyRun Text later:
<TextBlock>
<Run x:Name="MyRun" Text=""/>
</TextBlock>
This part is the SearchBar and the search-button which should be perfectly in line. How do I do this?
<StackPanel Orientation="Horizontal">
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top">
<TextBox x:Name="searchTextBox" Width="200" Height="30" />
</StackPanel>
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Top">
<Button x:Name="firstSearch" Style="{StaticResource AppBarButtonStyle}" Tapped="OnOptionItemTapped" >
<Image Source="Assets/images/view_search.png"/>
</Button>
</StackPanel>
</StackPanel>
This is the next and previous button. It should be perfectly in line with MyRun. How would I do that?
<StackPanel Orientation="Horizontal">
<Button x:Name="previous" Style="{StaticResource AppBarButtonStyle}" Tapped="OnOptionItemTapped">
<Image Source="/Assets/images/left_arrow.png"/>
</Button>
<Button x:Name="next" Style="{StaticResource AppBarButtonStyle}" Tapped="OnOptionItemTapped">
<Image Source="/Assets/images/right_arrow.png"/>
</Button>
</StackPanel>
And at last will be the "Close" Button. I guess it is kinda already perfect?:
<Button Content="Close" Click="ClosePopupClicked" HorizontalAlignment="Center" VerticalAlignment="Bottom"/>
Now a screenshot of how it Looks like and how I want it to look:
This is how it is:
This is how I want it to be:
I know that I can Change the height of the popup. But when I Change the height some Things disappear (for example the close Botton won't be visible because it is too far down while the popup height is too low).
Sorry for the long post. I hope someone can help me out here.
You should be able to use a Grid with three RowDefinitions. Something like this:
<Popup VerticalOffset="60" HorizontalOffset="0" x:Name="StandardPopup">
<Border BorderBrush="{StaticResource ApplicationForegroundThemeBrush}"
Background="{StaticResource ApplicationPageBackgroundThemeBrush}"
BorderThickness="2" Width="300" Height="350">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<!-- row 1 -->
<StackPanel Orientation="Horizontal">
<TextBox x:Name="searchTextBox" Width="200" Height="30" Margin="0,0,3,0" />
<Button x:Name="firstSearch" Style="{StaticResource AppBarButtonStyle}" Tapped="OnOptionItemTapped" >
<Image Source="Assets/images/view_search.png"/>
</Button>
</StackPanel>
<!-- row 2 -->
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal">
<Button x:Name="previous" Style="{StaticResource AppBarButtonStyle}" Tapped="OnOptionItemTapped">
<Image Source="/Assets/images/left_arrow.png"/>
</Button>
<Button x:Name="next" Style="{StaticResource AppBarButtonStyle}" Tapped="OnOptionItemTapped">
<Image Source="/Assets/images/right_arrow.png"/>
</Button>
</StackPanel>
<TextBlock Grid.Column="1" HorizontalAlignment="Center">
<Run x:Name="MyRun" Text=""/>
</TextBlock>
</Grid>
<!-- row 3 -->
<Button Grid.Row="2"
Content="Close" Click="ClosePopupClicked"
HorizontalAlignment="Center" VerticalAlignment="Bottom"/>
</Grid>
</Border>
</Popup>
You can adjust the space between the controls using the Margin property.
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>
I am trying to get my view to only tab between a pick username textbox and a massage textbox xaml. My first problem is the tab gets stuck on the enter username, my guess is it has a custom control for search suggestions that is next in line. Also it tabs through every button in the view and i don't want it to do that. I have tried to add a Tabindex to both textboxes and it has no effect. I left the Tabidex in both textboxs so you know which ones I am trying to tab between.
<UserControl x:Class="Clinical.Patient.Views.SendMessageDialogView"
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"
d:DataContext="{d:DesignInstance
Type=viewModels:SendMessageDialogViewModel}"
mc:Ignorable="d"
d:DesignWidth="320"
xmlns:properties="clr-namespace:Clinical.Patient.Properties"
xmlns:viewModels="clr-namespace:Clinical.Patient.ViewModels"
xmlns:patient="clr-namespace:Clinical.Patient"
xmlns:self="clr-namespace:System;assembly=mscorlib"
xmlns:views="clr-namespace:Clinical.Patient.Views"
d:DesignHeight="350"
xmlns:termAutoComplete="clr-
namespace:Clinical.Patient.Controls.TermAutoComplete"
xmlns:controls="clr-namespace:Clinical.Patient.Controls"
KeyboardNavigation.TabNavigation="Local">
<UserControl.Resources>
<viewModels:IsAtLeastGradeConverter x:Key="IsAtLeastGradeConverter"/>
<viewModels:IsAtLeastAutoCloseGradeConverter x:Key="IsAtLeastAutoCloseGradeConverter"/>
</UserControl.Resources>
<Border Padding="8"
MinWidth="320"
ClipToBounds="False">
<Border BorderThickness="1"
BorderBrush="{DynamicResource FocusBorderBrush}"
CornerRadius="2"
Background="{DynamicResource FocusBackgroundBrush}">
<Border.Effect>
<DropShadowEffect Color="{DynamicResource SubtleDivideBorderColor}"
Opacity="1"
ShadowDepth="0"
BlurRadius="10" />
</Border.Effect>
<StackPanel Orientation="Vertical"
Margin="10">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Text="{x:Static properties:Strings.SharingReportIs}"
Foreground="{DynamicResource CommonTextBrush}"
FontSize="13"
FontWeight="Bold"/>
<Border Grid.Column="1"
Width="180"
Margin="5 5 20 5"
HorizontalAlignment="Left"
Background="{DynamicResource FocusBackgroundBrush}"
BorderBrush="{DynamicResource FocusBorderBrush}"
BorderThickness=".5"
CornerRadius="8,8,8,8">
<DockPanel HorizontalAlignment="Center">
<views:ExamTypeIconView DockPanel.Dock="Left"
Type="{Binding ExamType}"
Foreground="{DynamicResource CommonTextBrush}"
IconHeight="30"/>
<StackPanel DockPanel.Dock="Left"
Margin="3">
<TextBlock Text="{Binding Status}"
Foreground="{DynamicResource CommonTextBrush}"
FontSize="13"/>
<TextBlock Text="{Binding Accession}"
Foreground="{DynamicResource CommonTextBrush}"
FontSize="13"/>
</StackPanel>
</DockPanel>
</Border>
</Grid>
<DockPanel HorizontalAlignment="Left"
MinWidth="280"
Margin="0 5 0 0">
<Button
x:Name="To"
HorizontalAlignment="Right"
MinWidth="65"
Margin="0,4,4,4"
IsDefault="True"
Command="{Binding ToCommand}"
Content="to.." Width="65" />
<TextBox x:Name="SendTo"
Text="{Binding Recipient, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
Style="{DynamicResource NavigationSearchTextBox}"
FontSize="{DynamicResource OneAndAQuarterFontSize}"
Padding="0 3 0 3"
VerticalAlignment="Center"
Width="225"
TabIndex="0"/>
<termAutoComplete:TermAutoComplete AutoCompleteSource="{Binding AutoCompleteSource}"
Padding="0 0 0 0"
TextBox="{Binding ElementName=SendTo}"/>
</DockPanel>
<Grid Margin="0 5 0 0">
<TextBlock Text="{x:Static properties:Strings.SharingMessage}"
Foreground="{DynamicResource CommonTextBrush}"
FontSize="13"
FontWeight="Bold" />
</Grid>
<TextBox x:Name="PeerReviewComments"
Margin="0 5 0 0"
MinLines="5"
AcceptsReturn="True"
TextWrapping="Wrap"
Text="{Binding Message, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Width="295"
TabIndex="1"/>
<DockPanel
MinWidth="280"
Margin="0,5,-5,0"
>
<Button
x:Name="Save"
HorizontalAlignment="Right"enter code here
MinWidth="65"
Margin="0,4,4,4"
IsDefault="True"
Command="{Binding SendCommand}"
Content="Send" Width="65"
DockPanel.Dock="Right"
/>
<Button
x:Name="Cancle"
HorizontalAlignment="Right"
MinWidth="65"
Margin="0,4,4,4"
IsDefault="True"
Command="{Binding CancelCommand}"
Content="Cancel" Width="65"
DockPanel.Dock="Right"
/>
</DockPanel>
</StackPanel>
</Border>
</Border>
</UserControl>
I believe you need to replace "TabIndex" with "KeyboardNavigation.TabIndex".
If that doesn't work, you can also skip elements in the tab sequence by setting KeyboardNavigation.IsTabStop on the element in XAML.
KeyboardNavigation.IsTabStop="False"
Source
For controls where tab "gets stuck" add:
KeyboardNavigation.TabNavigation="Continue"
To avoid tab hitting a control add:
KeyboardNavigation.IsTabStop="False"
I have a Binding page for some bugs and another one for comments in my app. The first one work properly, but the second one don't show anything but the data(21 comments) load successfully.
I've been taking a look to the live Live Property Explorer and the first Grid have those options:
However, the second one have the ItemsSource set as null:
This should not be possible, because those items have the same code just with few changes to make them load different.
Here you have the code:
<Page.Resources>
<DataTemplate x:DataType="data:Book" x:Key="BookDataTemplate">
<StackPanel HorizontalAlignment="Center">
<Image Width="150" Height="150" Source="{x:Bind CoverImage}" />
<StackPanel HorizontalAlignment="center" Orientation="Horizontal">
<TextBlock FontSize="10" Text="{x:Bind DScore}" HorizontalAlignment="Center" Foreground="#FF21C721" />
<TextBlock FontSize="10" Text="{x:Bind DFav}" HorizontalAlignment="Center" Foreground="#FF9C9C9C" />
</StackPanel>
<TextBlock FontSize="16" Text="{x:Bind Title}" HorizontalAlignment="Center" Foreground="White" />
<TextBlock FontSize="10" Text="{x:Bind Author}" HorizontalAlignment="Center" Foreground="#FF9C9C9C" />
<ToolTipService.ToolTip>
<TextBlock Text="{x:Bind DData}"/>
</ToolTipService.ToolTip>
</StackPanel>
</DataTemplate>
</Page.Resources>
<GridView ItemsSource="{x:Bind Books}" AllowDrop="True" IsSwipeEnabled="True" IsItemClickEnabled="True" ItemClick="Content_ItemClick" Name="Content" Margin="0,100,0,40" CanReorderItems="True"
CanDragItems="True"
ItemTemplate="{StaticResource BookDataTemplate}" ReorderMode="Enabled"/>
And the Comments gridview:
<Page.Resources>
<DataTemplate x:DataType="data:Comment" x:Key="CommentDataTemplate">
<StackPanel HorizontalAlignment="Center">
<Grid>
<Rectangle Margin="50, 0, 0, 30" Fill="#FF144772" Height="100" Stroke="Black" Width="500" HorizontalAlignment="Center"/>
<Rectangle Margin="60, 0, 0, 45" Fill="#FF031131" Height="60" Stroke="Black" Width="60" HorizontalAlignment="Left"/>
<Rectangle Margin="140, 0, 0, 25" Fill="#FF103F91" Height="60" Stroke="Black" Width="360" HorizontalAlignment="Left"/>
<Image x:Name="image" HorizontalAlignment="Left" Height="50" Margin="65,18,0,0" VerticalAlignment="Top" Width="50" Source="Assets/profile.png"/>
<StackPanel HorizontalAlignment="center" Orientation="Horizontal">
<TextBlock Margin="0, 70, 400, 0" FontSize="10" Text="{x:Bind Date}" HorizontalAlignment="Center" Foreground="#FF9C9C9C" />
</StackPanel>
<TextBlock Margin="130, 0, 0, 0" FontSize="16" Text="{x:Bind Author}" HorizontalAlignment="Left" Foreground="White" />
<TextBlock Margin="150, 30, 0, 0" FontSize="11" Text="{x:Bind Body}" Width="360" HorizontalAlignment="Left" Foreground="#FF9C9C9C" />
<ToolTipService.ToolTip>
<TextBlock Text="{x:Bind Score}"/>
</ToolTipService.ToolTip>
</Grid>
</StackPanel>
</DataTemplate>
</Page.Resources>
<GridView ItemsSource="{x:Bind Comments}" AllowDrop="True" IsSwipeEnabled="True" IsItemClickEnabled="True" Name="Content" Margin="0,100,0,40" CanReorderItems="True"
CanDragItems="True"
ItemTemplate="{StaticResource CommentDataTemplate}" ReorderMode="Enabled"/>
Can somebody help me identify the problem here please?
In the XAML file of your 2nd page go to "Comments" in ItemsSource and press F12. If you could navigate to definition of Comments means your binding is successful but Comments is not getting populated. If you could not navigate to definition means binding is not working. In that case check if datacontext has been set for that page. Also check how "Comments" is spelled in XAML and in the property.
In my WPF application, i created a dockpanel with a stackpanel with orientation=horizontal.
I add some buttons on my stackpanel ( like a toolbar)
I would like to be able to set my last item on my stackpanel to be attached to the right of my window.
Some picture in order to explain.
What i have :
What i would to have :
Here is my XAML :
<DockPanel Height="40" VerticalAlignment="Top" >
<Border>
<StackPanel Orientation="Horizontal" Background="{StaticResource DegradeCouleurTheme}">
<Image Source="ElipseGauche.png" Height="28" Margin="10,0,0,0" />
<StackPanel Orientation="Horizontal" Height="28">
<StackPanel.Background>
<ImageBrush ImageSource="ElipseMilieu.png"></ImageBrush>
</StackPanel.Background>
<Button Template="{StaticResource BoutonRessourcesTpl}" Click="Button_Click_Goto_Premier">
<Image Source= "xRtDiva_XWPF_TBR_PREMIER.PNG_IMAGES.png" Height="16"/>
</Button>
<Button Template="{StaticResource BoutonRessourcesTpl}" Click="Button_Click_Goto_Precedent">
<Image Source= "xRtDiva_XWPF_TBR_PRECED.PNG_IMAGES.png" Height="16"/>
</Button>
<Button Template="{StaticResource BoutonRessourcesTpl}" Click="Button_Click_Goto_Suivant">
<Image Source= "xRtDiva_XWPF_TBR_SUIVANT.PNG_IMAGES.png" Height="16"/>
</Button>
<Button Template="{StaticResource BoutonRessourcesTpl}" Click="Button_Click_Goto_Dernier">
<Image Source= "xRtDiva_XWPF_TBR_DERNIER.PNG_IMAGES.png" Height="16"/>
</Button>
</StackPanel>
<Image Source="ElipseDroite.png" Height="28" Margin="0,0,0,0" />
<Image Source="ElipseGauche.png" Height="28" Margin="15,0,0,0" />
<StackPanel Orientation="Horizontal" Height="28">
<StackPanel.Background>
<ImageBrush ImageSource="ElipseMilieu.png"></ImageBrush>
</StackPanel.Background>
<Button Template="{StaticResource BoutonRessourcesTpl}" Click="Button_Click_Creer" >
<Image Source= "Toolbar_Creer.png" Height="16" />
</Button>
</StackPanel>
<Image Source="ElipseDroite.png" Height="28" Margin="0,0,0,0" />
<Image Source="ElipseGauche.png" Height="28" Margin="15,0,0,0" />
<StackPanel Orientation="Horizontal" Height="28">
<StackPanel.Background>
<ImageBrush ImageSource="ElipseMilieu.png"></ImageBrush>
</StackPanel.Background>
<Button Template="{StaticResource BoutonRessourcesTpl}" Click="Button_Click_Evenement_Supprimer">
<Image Source= "Toolbar_Supprimer.png" Height="16"/>
</Button>
</StackPanel>
<Image Source="ElipseDroite.png" Height="28" Margin="0,0,0,0" />
<Image Source="ElipseGauche.png" Height="28" Margin="15,0,0,0" />
<StackPanel Orientation="Horizontal" Height="28">
<StackPanel.Background>
<ImageBrush ImageSource="ElipseMilieu.png"></ImageBrush>
</StackPanel.Background>
<Button Template="{StaticResource BoutonRessourcesTpl}" Click="Button_Click_Evenement_Joints">
<Image Source= "Toolbar_FicJoints.png" Height="18"/>
</Button>
</StackPanel>
<Image Source="ElipseDroite.png" Height="28" Margin="0,0,0,0" />
<Image Source="ElipseGauche.png" Height="28" Margin="15,0,0,0" />
<StackPanel Orientation="Horizontal" Height="28">
<StackPanel.Background>
<ImageBrush ImageSource="ElipseMilieu.png"></ImageBrush>
</StackPanel.Background>
<Button Template="{StaticResource BoutonRessourcesTpl}" Click="Button_Click_Evenement_Annuler" >
<Image Source= "Toolbar_Annuler.png" Height="16"/>
</Button>
<Button Template="{StaticResource BoutonRessourcesTpl}" Click="Button_Click_Evenement_Valider">
<Image Source= "Toolbar_Valider.png" Height="16"/>
</Button>
</StackPanel>
<Image Source="ElipseDroite.png" Height="28" Margin="0,0,0,0" />
<Image Source="ElipseGauche.png" Height="28" Margin="15,0,0,0" />
<StackPanel Orientation="Horizontal" Height="28">
<StackPanel.Background>
<ImageBrush ImageSource="ElipseMilieu.png"></ImageBrush>
</StackPanel.Background>
<Button Template="{StaticResource BoutonRessourcesTpl}" Click="Button_Click_App_Parametrer" >
<Image Source= "Toolbar_Parametrer.png" Height="16"/>
</Button>
</StackPanel>
<Image Source="ElipseDroite.png" Height="28" Margin="0,0,0,0" />
<Grid HorizontalAlignment="Right">
<StackPanel Orientation="Horizontal" Height="28" >
<Image Source="ElipseGauche.png" Height="28" Margin="15,0,0,0" />
<StackPanel Orientation="Horizontal" Height="28">
<StackPanel.Background>
<ImageBrush ImageSource="ElipseMilieu.png"></ImageBrush>
</StackPanel.Background>
<Button Template="{StaticResource BoutonRessourcesTpl}" Click="Button_Click_About" >
<Label Margin="0,0,0,1" Foreground="White" Content="About" Height="16" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="0,0,0,0"/>
</Button>
</StackPanel>
<Image Source="ElipseDroite.png" Height="28" Margin="0,0,0,0" />
</StackPanel>
</Grid>
</StackPanel>
</Border>
</DockPanel>
I tried to use a grid with horizontalaligneemnt = right on the last item of my stackpanel but it has no effect ( and it's logic !)
Anyone could help me please ?
Thanks a lot :)
You can not do this with a StackPanel. You will need to use a DockPanel or Grid instead.
You can use Grid and Grid children to attack Objecs on the direction: Left, Right, Tip, Bottom and Center.
I did a example with two images on Bottom left and Bottom right:
<Window x:Class="NameClass">
<Grid Name="Grid 1">
<Grid Name="Grid 1.1" VerticalAlignment="Bottom">
<Grid Name="Grid 1.1.1" HorizontalAlignment="Left">
<StackPanel>
<StackPanel Orientation="Horizontal">
<Image HorizontalAlignment="Left" Source="/left.jpg"/>
</StackPanel>
</StackPanel>
</Grid>
<Grid Name="Grid 1.1.2" HorizontalAlignment="Right">
<StackPanel>
<StackPanel Orientation="Horizontal">
<Image HorizontalAlignment="Right" Source="/right.jpg"/>
</StackPanel>
</StackPanel>
</Grid>
</Grid>
</Grid>
</Window>
Structure explained:
Grid 1 is Main Grid.
Grid 1.1 to the desired the main address, in this case is Bottom.
Grid 1.1.1 and Grid 1.1.2 contain the specific addresses to each <Image>. For this case the StackPanel are used.
<StackPanel/> is the main container to fill the Grid 1.1.x.
<StackPanel Orientation="Horizontal"/> to use only one row
<Image HorizontalAlignment={one direction}/> to locate on the bottom grid, can be on right, left or center.
Result:
PD: I used this video for understand the concept on XAML WPF. Stack Panels & Dock Panels. I found a solution, with trial and error.
You can do this by using in StackPanel
Orientation="Horizontal"