Windows store app list view with item template and grid inside listview with stretched horizontal alignment based on the screen size
Property ItemContainerStyle is used to add a item container style in which horizontal alignment is changed to stretch which makes the grid inside listview item to occupy the entire width of the screen.
XAML code of list view with data template containing grid (width = screen width)
ItemContainerStyle used to style grid present in listview
<ListView ItemsSource="{Binding FutureEvents}" ItemTemplate="{StaticResource EventItemTemplate}"
SelectionMode="Single" IsSwipeEnabled="True" IsItemClickEnabled="False"
ItemContainerStyle="{StaticResource ListViewItemStyle}" SelectedItem="{Binding SelectedEventForOtherInspection,Mode=TwoWay}" >
</ListView >
<DataTemplate x:Key="EventItemTemplate">
<Grid HorizontalAlignment="Stretch" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*" />
<ColumnDefinition Width="0.5*" />
</Grid.ColumnDefinitions>
</Grid>
</DataTemplate>
<Style x:Key="ListViewItemStyle" TargetType="ListViewItem">
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="TabNavigation" Value="Local"/>
<Setter Property="IsHoldingEnabled" Value="True"/>
<Setter Property="Margin" Value="0,0,0,0"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Top"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListViewItem">
<ListViewItemPresenter CheckHintBrush="{ThemeResource ListViewItemCheckHintThemeBrush}" CheckBrush="{ThemeResource ListViewItemCheckThemeBrush}" ContentMargin="4" ContentTransitions="{TemplateBinding ContentTransitions}" CheckSelectingBrush="{ThemeResource ListViewItemCheckSelectingThemeBrush}" DragForeground="{ThemeResource ListViewItemDragForegroundThemeBrush}" DragOpacity="{ThemeResource ListViewItemDragThemeOpacity}" DragBackground="{ThemeResource ListViewItemDragBackgroundThemeBrush}" DisabledOpacity="{ThemeResource ListViewItemDisabledThemeOpacity}" FocusBorderBrush="{ThemeResource ListViewItemFocusBorderThemeBrush}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" PointerOverBackgroundMargin="1" PlaceholderBackground="{ThemeResource ListViewItemPlaceholderBackgroundThemeBrush}" PointerOverBackground="{ThemeResource ListViewItemPointerOverBackgroundThemeBrush}" ReorderHintOffset="{ThemeResource ListViewItemReorderHintThemeOffset}" SelectedPointerOverBorderBrush="{ThemeResource ListViewItemSelectedPointerOverBorderThemeBrush}" SelectionCheckMarkVisualEnabled="True" SelectedForeground="{ThemeResource ListViewItemSelectedForegroundThemeBrush}" SelectedPointerOverBackground="{ThemeResource ListViewItemSelectedPointerOverBackgroundThemeBrush}" SelectedBorderThickness="{ThemeResource ListViewItemCompactSelectedBorderThemeThickness}" SelectedBackground="{ThemeResource ListViewItemSelectedBackgroundThemeBrush}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
XAML code of list view with data template containing grid (width = screen width)
ItemContainerStyle used to style grid present in listview
<ListView ItemsSource="{Binding FutureEvents}" ItemTemplate="{StaticResource EventItemTemplate}"
SelectionMode="Single" IsSwipeEnabled="True" IsItemClickEnabled="False"
ItemContainerStyle="{StaticResource ListViewItemStyle}" SelectedItem="{Binding SelectedEventForOtherInspection,Mode=TwoWay}" >
</ListView >
<DataTemplate x:Key="EventItemTemplate">
<Grid HorizontalAlignment="Stretch" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*" />
<ColumnDefinition Width="0.5*" />
</Grid.ColumnDefinitions>
</Grid>
</DataTemplate>
<Style x:Key="ListViewItemStyle" TargetType="ListViewItem">
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="TabNavigation" Value="Local"/>
<Setter Property="IsHoldingEnabled" Value="True"/>
<Setter Property="Margin" Value="0,0,0,0"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Top"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListViewItem">
<ListViewItemPresenter CheckHintBrush="{ThemeResource ListViewItemCheckHintThemeBrush}" CheckBrush="{ThemeResource ListViewItemCheckThemeBrush}" ContentMargin="4" ContentTransitions="{TemplateBinding ContentTransitions}" CheckSelectingBrush="{ThemeResource ListViewItemCheckSelectingThemeBrush}" DragForeground="{ThemeResource ListViewItemDragForegroundThemeBrush}" DragOpacity="{ThemeResource ListViewItemDragThemeOpacity}" DragBackground="{ThemeResource ListViewItemDragBackgroundThemeBrush}" DisabledOpacity="{ThemeResource ListViewItemDisabledThemeOpacity}" FocusBorderBrush="{ThemeResource ListViewItemFocusBorderThemeBrush}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" PointerOverBackgroundMargin="1" PlaceholderBackground="{ThemeResource ListViewItemPlaceholderBackgroundThemeBrush}" PointerOverBackground="{ThemeResource ListViewItemPointerOverBackgroundThemeBrush}" ReorderHintOffset="{ThemeResource ListViewItemReorderHintThemeOffset}" SelectedPointerOverBorderBrush="{ThemeResource ListViewItemSelectedPointerOverBorderThemeBrush}" SelectionCheckMarkVisualEnabled="True" SelectedForeground="{ThemeResource ListViewItemSelectedForegroundThemeBrush}" SelectedPointerOverBackground="{ThemeResource ListViewItemSelectedPointerOverBackgroundThemeBrush}" SelectedBorderThickness="{ThemeResource ListViewItemCompactSelectedBorderThemeThickness}" SelectedBackground="{ThemeResource ListViewItemSelectedBackgroundThemeBrush}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
windows store app xaml C# code with styles for left colored panel with vertical text and header with left, center and right alignment textblocks
Xaml code for left panel with vertical text, header with multiple textblocks with different alignments
<Page
x:Class="App1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App1"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<Style x:Key="LeftPanelStyle" TargetType="Grid" >
<Setter Property="Background" Value="Green"/>
</Style>
<ImageBrush x:Key="BackgroundBrush"
ImageSource="ms-appx:///Assets/bg.png"
Stretch="UniformToFill" />
<Style x:Key="LayoutRootStyle" TargetType="Panel">
<Setter Property="Background" Value="{StaticResource BackgroundBrush}"/>
<Setter Property="ChildrenTransitions">
<Setter.Value>
<TransitionCollection>
<EntranceThemeTransition/>
</TransitionCollection>
</Setter.Value>
</Setter>
</Style>
</Page.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="56"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Style="{StaticResource LeftPanelStyle}">
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Button x:Name="backButton" Margin="39,59,39,0" Command="{Binding NavigationHelper.GoBackCommand, ElementName=pageRoot}"
Style="{StaticResource NavigationBackButtonNormalStyle}"
VerticalAlignment="Top"
AutomationProperties.Name="Back"
AutomationProperties.AutomationId="BackButton"
AutomationProperties.ItemType="Navigation Button"/>
<StackPanel Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom" Margin="0,0,0,0">
<StackPanel.RenderTransform>
<CompositeTransform Rotation="-90"></CompositeTransform>
</StackPanel.RenderTransform>
<TextBlock Text="Side Heading" FontSize="22" Margin="0,15,-226,0" />
</StackPanel>
</Grid>
<Grid Grid.Column="1" Style="{StaticResource LayoutRootStyle}">
<Grid.RowDefinitions>
<RowDefinition Height="120" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- Back button and page title -->
<Grid Grid.Column="1" VerticalAlignment="Top" Margin="0,15,0,0" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="170"/>
<ColumnDefinition Width="60"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="1" VerticalAlignment="Bottom" Grid.RowSpan="2" Grid.Row="0" Height="56" Width="114" Source="{Binding SelectedEventLogo}" Stretch="None" HorizontalAlignment="Left">
</Image>
<StackPanel Grid.Column="2" Grid.Row="0">
<TextBlock Text="Page Header" Style="{StaticResource HeaderTextBlockStyle}"/>
</StackPanel>
<StackPanel Grid.Column="3" Grid.Row="0" HorizontalAlignment="Center">
<TextBlock Text="2nd" Grid.Column="1" IsHitTestVisible="false" Style="{StaticResource HeaderTextBlockStyle}" />
</StackPanel>
<StackPanel Grid.Column="5" Grid.Row="0" HorizontalAlignment="Right">
<TextBlock Text="3rd" Grid.Column="1" IsHitTestVisible="false" Style="{StaticResource HeaderTextBlockStyle}" HorizontalAlignment="Right" />
</StackPanel>
</Grid>
</Grid>
</Grid>
</Page>
<Page
x:Class="App1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App1"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<Style x:Key="LeftPanelStyle" TargetType="Grid" >
<Setter Property="Background" Value="Green"/>
</Style>
<ImageBrush x:Key="BackgroundBrush"
ImageSource="ms-appx:///Assets/bg.png"
Stretch="UniformToFill" />
<Style x:Key="LayoutRootStyle" TargetType="Panel">
<Setter Property="Background" Value="{StaticResource BackgroundBrush}"/>
<Setter Property="ChildrenTransitions">
<Setter.Value>
<TransitionCollection>
<EntranceThemeTransition/>
</TransitionCollection>
</Setter.Value>
</Setter>
</Style>
</Page.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="56"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Style="{StaticResource LeftPanelStyle}">
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Button x:Name="backButton" Margin="39,59,39,0" Command="{Binding NavigationHelper.GoBackCommand, ElementName=pageRoot}"
Style="{StaticResource NavigationBackButtonNormalStyle}"
VerticalAlignment="Top"
AutomationProperties.Name="Back"
AutomationProperties.AutomationId="BackButton"
AutomationProperties.ItemType="Navigation Button"/>
<StackPanel Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom" Margin="0,0,0,0">
<StackPanel.RenderTransform>
<CompositeTransform Rotation="-90"></CompositeTransform>
</StackPanel.RenderTransform>
<TextBlock Text="Side Heading" FontSize="22" Margin="0,15,-226,0" />
</StackPanel>
</Grid>
<Grid Grid.Column="1" Style="{StaticResource LayoutRootStyle}">
<Grid.RowDefinitions>
<RowDefinition Height="120" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- Back button and page title -->
<Grid Grid.Column="1" VerticalAlignment="Top" Margin="0,15,0,0" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="170"/>
<ColumnDefinition Width="60"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="1" VerticalAlignment="Bottom" Grid.RowSpan="2" Grid.Row="0" Height="56" Width="114" Source="{Binding SelectedEventLogo}" Stretch="None" HorizontalAlignment="Left">
</Image>
<StackPanel Grid.Column="2" Grid.Row="0">
<TextBlock Text="Page Header" Style="{StaticResource HeaderTextBlockStyle}"/>
</StackPanel>
<StackPanel Grid.Column="3" Grid.Row="0" HorizontalAlignment="Center">
<TextBlock Text="2nd" Grid.Column="1" IsHitTestVisible="false" Style="{StaticResource HeaderTextBlockStyle}" />
</StackPanel>
<StackPanel Grid.Column="5" Grid.Row="0" HorizontalAlignment="Right">
<TextBlock Text="3rd" Grid.Column="1" IsHitTestVisible="false" Style="{StaticResource HeaderTextBlockStyle}" HorizontalAlignment="Right" />
</StackPanel>
</Grid>
</Grid>
</Grid>
</Page>
how to wrap windows store app xaml button content or text
There is no wrapping property available for button content so if you want to have wrapping content inside button use textblock control inside button control. Then apply wrapping for textblock text as shown in the below xaml code.
XAML Code to wrap content inside a xaml button control used for wpf and windows store apps
<Button Height="190" Width="296">
<TextBlock TextWrapping="Wrap" TextAlignment="Center">Content to be wrapped inside button goes here</TextBlock>
</Button>
XAML Code to wrap content inside a xaml button control used for wpf and windows store apps
<Button Height="190" Width="296">
<TextBlock TextWrapping="Wrap" TextAlignment="Center">Content to be wrapped inside button goes here</TextBlock>
</Button>
Windows store apps XAML C# Using common image as background image in all pages
Code in resource dictionary to mention an image as source to use in all pages as background image
<!--Background image for all pages-->
<ImageBrush x:Key="BgImage" ImageSource="Images/InnerBg.png"></ImageBrush>
<!--Background image for all pages-->
<ImageBrush x:Key="BgImage" ImageSource="Images/InnerBg.png"></ImageBrush>
Code in xaml page to add it as background image
<Grid x:Name="MainGrid" Background="{StaticResource BgImage}">
</Grid>
windows store apps xaml global app bar button styles in resource dictionary with custom image
This code is used to add an app bar in a xaml page.
That app contains 3 buttons.
Appbar button inside secondary commands tag are known as global commands and are displayed on the right side of the appbar.
For this three buttons styles are written in sepearate resource dictionary file.
label property is used to give the name below the appbar button and icon is used to mention the image icon to be displayed in the appbar button.
3 rd button style contains content template with image source to display custom image in appbar button.
To use global style written in seperate resourcedictionary page in every page of your application you have to include the below xaml tags in app.xaml page.
Code in App.xaml page
<Application
x:Class="BSNFRailway.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BSNFRailway">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="BSNFResources.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
XAML Code for app bar in MainPage.xaml
<Page.BottomAppBar>
<CommandBar>
<AppBarButton Style="{StaticResource AppBarRefreshButtonStyle}" />
<CommandBar.SecondaryCommands>
<AppBarButton Style="{StaticResource AppBarFilterButtonStyle}" />
<AppBarButton Label="Asset Tree" Style="{StaticResource AppBarAssetTreeButtonStyle}" >
</AppBarButton>
</CommandBar.SecondaryCommands>
</CommandBar>
</Page.BottomAppBar>
Code in ResourceDictionary.xaml page
<Style x:Key="AppBarFilterButtonStyle" TargetType="AppBarButton" >
<Setter Property="Label" Value="Filter" ></Setter>
<Setter Property="Icon" Value="Filter" ></Setter>
</Style>
<Style x:Key="AppBarRefreshButtonStyle" TargetType="AppBarButton" >
<Setter Property="Label" Value="Refresh" ></Setter>
<Setter Property="Icon" Value="Refresh" ></Setter>
</Style>
<Style x:Key="AppBarAssetTreeButtonStyle" TargetType="AppBarButton">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Image Source="/Images/TreeLogo.png" />
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="Label" Value="Tree" />
</Style>
That app contains 3 buttons.
Appbar button inside secondary commands tag are known as global commands and are displayed on the right side of the appbar.
For this three buttons styles are written in sepearate resource dictionary file.
label property is used to give the name below the appbar button and icon is used to mention the image icon to be displayed in the appbar button.
3 rd button style contains content template with image source to display custom image in appbar button.
To use global style written in seperate resourcedictionary page in every page of your application you have to include the below xaml tags in app.xaml page.
Code in App.xaml page
<Application
x:Class="BSNFRailway.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BSNFRailway">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="BSNFResources.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
XAML Code for app bar in MainPage.xaml
<Page.BottomAppBar>
<CommandBar>
<AppBarButton Style="{StaticResource AppBarRefreshButtonStyle}" />
<CommandBar.SecondaryCommands>
<AppBarButton Style="{StaticResource AppBarFilterButtonStyle}" />
<AppBarButton Label="Asset Tree" Style="{StaticResource AppBarAssetTreeButtonStyle}" >
</AppBarButton>
</CommandBar.SecondaryCommands>
</CommandBar>
</Page.BottomAppBar>
Code in ResourceDictionary.xaml page
<Style x:Key="AppBarFilterButtonStyle" TargetType="AppBarButton" >
<Setter Property="Label" Value="Filter" ></Setter>
<Setter Property="Icon" Value="Filter" ></Setter>
</Style>
<Style x:Key="AppBarRefreshButtonStyle" TargetType="AppBarButton" >
<Setter Property="Label" Value="Refresh" ></Setter>
<Setter Property="Icon" Value="Refresh" ></Setter>
</Style>
<Style x:Key="AppBarAssetTreeButtonStyle" TargetType="AppBarButton">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Image Source="/Images/TreeLogo.png" />
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="Label" Value="Tree" />
</Style>
Visual Studio TFS ( Team Foundation Server )
In TFS
we can see My Work in which you can find different categories like
In Progress Work
Suspended Work
Available Work Items
Code Reviews
--------
Open Query in Available Work Items is used to view work.
To assign task to team mates
In Available work items - New - Task - enter details of task and assign task to you - Save it and refresh My Work in TFS to see the newly added task under available work items.
we can see My Work in which you can find different categories like
In Progress Work
Suspended Work
Available Work Items
Code Reviews
--------
Open Query in Available Work Items is used to view work.
To assign task to team mates
In Available work items - New - Task - enter details of task and assign task to you - Save it and refresh My Work in TFS to see the newly added task under available work items.
what is XAMARIN
XAMARIN enable developers to create native ios, android and other mobile apps using C#.NET.
It gives native user interface, native performance, shared code across platforms to every moblie platform using C#.NET.
You can also use VB.NET bussiness and data logic code.
https://xamarin.com/ - Official website to download free trial of templates to use in Visual studio to create apps.
Approaches to create native apps without XAMARIN
XCode with Objective C for IOS App, Eclipse with Java for Android App, Visual Studio with C#.NET for Windows app.
Write once, run anywhere approach with browser fragmentation is like executing app on browser which is not equal to native app.
XAMARIN's Unique approach
It gives native user interface, native performance, shared code across platforms to every moblie platform using C#.NET.
C#.NET is Awesome we have excellent features like LINQ support, Work with XML easily XDocument, Event handling and delegates.
Link for XAMARIN documents
http://docs.xamarin.com/guides/cross-platform/getting_started/beginning_a_xamarin_trial/
Link for C#.NET tutorial
http://www.dbakings.com/CSharp/Default.aspx
XAMARIN APIs are always up to date with the latest APIs.