(Windows phone 8.1) Create rounded image button at windows phone 8.1 - windows-phone-8.1

I want to create a image button with corner radius 20.0 in windows phone 8.1, but I can not find any solution , anyone can suggest me a way to do this ?
The button look like that :

Try this
<Button HorizontalAlignment="Left" Margin="47,636,0,0" >
<Button.Template>
<ControlTemplate>
<Border BorderBrush="#6BA92A" Background="#6BA92A" CornerRadius="20,20,20,20" BorderThickness="2">
<Button Content="Add to cart"
Background="{TemplateBinding Background}"
Height="65"
Width="348"
FontSize="{TemplateBinding FontSize}"
BorderBrush="#6BA92A">
</Button>
</Border>
</ControlTemplate>
</Button.Template>
</Button>

You can use Border element
<Border BorderBrush="Red" BorderThickness="2" CornerRadius="20" HorizontalAlignment="Left" >
<Button BorderThickness="0" Click="Button_Click" >
<Button.Background>
<ImageBrush ImageSource="Assets/cart.png" Stretch="Uniform"/>
</Button.Background>
</Button>
</Border>

I have resolved that issue, here is my code :
<Rectangle Grid.Row="3" Margin="20,0,20,20" HorizontalAlignment="Stretch" Height="50" RadiusX="10" RadiusY="10" > <Rectangle.Fill>
<ImageBrush Stretch="Fill" ImageSource="/Assets/images/add_cart_btn_bg.png"/>
</Rectangle.Fill> </Rectangle>

Related

MediaElement with rounded corner in WP8

I like to create rounded corner for my video in Windows phone 8 app development.How to get this?
I have tried this below code
<Border x:Name="border" BorderThickness="1" BorderBrush="#FF000000" CornerRadius="20" Padding="1"
HorizontalAlignment="Center" VerticalAlignment="Center">
<Grid>
<Border Name="mask" Background="Transparent" CornerRadius="{Binding ElementName=border, Path=CornerRadius}"/>
<Grid>
<Grid.OpacityMask>
<VideoBrush SourceName="{Binding ElementName=mask}"/>
</Grid.OpacityMask>
<MediaElement x:Name="Media" HorizontalAlignment="Left" Height="128"
VerticalAlignment="Top" Width="236" Source="/Assets/Videos/empty.m4v"/>
</Grid>
</Grid>
</Border>

WebView in FlipViewItem - WebView does not accept any gestures

I've put a WebView inside of a FlipViewItem. The problem seems to be that in WP 8.1, the WebView does not get the gestures (presumably because they're absorbed by the FlipView). The desired result is to be able to scroll vertically and tap in the WebView but also to be able scroll horizontally for the FlipView (even if just in a limited area on the horizontal edges). Is there any solution or workaround for this?
<StackPanel>
<StackPanel Name="postTitle" Background="Transparent">
<TextBlock Name="ContentArea" Text="" FontSize="18" Margin="10, 5, 10, 0" TextWrapping="WrapWholeWords" FontWeight="Bold" Foreground="White"/>
<TextBlock Name="SubArea" Text="" FontSize="16" Margin="10, 0, 10, 10" TextWrapping="WrapWholeWords" Foreground="White"/>
</StackPanel>
<FlipView Name="swipeArea" Height="460" Margin="0" Padding="0" SelectedIndex="1" SelectionChanged="swipeArea_SelectionChanged">
<FlipViewItem Name="oneItem">
</FlipViewItem>
<FlipViewItem Name="mainFlipViewItem">
<Grid>
<ProgressRing Name="progRing" Foreground="White" Margin="0,25,0,0" Background="Transparent" Visibility="Collapsed" VerticalAlignment="Top"/>
<WebView Name="InterWindow" Height="460" Visibility="Collapsed" DefaultBackgroundColor="#5E5E5E"></WebView>
<ScrollViewer Name="Scrollster" ZoomMode="Enabled" MinZoomFactor="1" MaxZoomFactor="8" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<Image Name="WebWindow" Height="420" HorizontalAlignment="Center" VerticalAlignment="Top">
</Image>
</ScrollViewer>
</Grid>
</FlipViewItem>
<FlipViewItem Name="threeItem">
</FlipViewItem>
</FlipView>
</StackPanel>
I believe I just found one workaround. I've added this to the WebView control:
Canvas.ZIndex="1000"
I can then set the width of the WebView control to something just slimmer than the FlipView itself, and then I should be good.

Fixed pivot header item?

I use pivot create menu (with 4 item). I want FIXED header 4 item (not move) and change image item header when I move item (same menu facebook on wp8)
This is my code
{<phone:Pivot Height="758" VerticalAlignment="Bottom" Loaded="Pivot_Loaded_2" UnloadedPivotItem="Pivot_UnloadedPivotItem">
<phone:Pivot.Background>
<ImageBrush Stretch="Fill" ImageSource="bg_login_popup_head.png"/>
</phone:Pivot.Background>
<phone:Pivot.HeaderTemplate>
<DataTemplate>
<Image Source="{Binding}" Height="83" Width="94" />
</DataTemplate>
</phone:Pivot.HeaderTemplate>
<!--Pivot item one-->
<phone:PivotItem x:Name="item1" Header = "/Resources/Icon/ic_home_actionbar_red.png" Margin="0,10,0,0" Foreground="#FF19DE84">
<phone:PivotItem.Background>
<ImageBrush Stretch="Fill" ImageSource="background.png"/>
</phone:PivotItem.Background>
<TextBlock HorizontalAlignment="Left" Height="157" TextWrapping="Wrap" VerticalAlignment="Top" Width="337" Margin="61,422,0,0" FontSize="50" Text="Đoi mih mot chut nhe" Foreground="#FFD68F8B"/>
</phone:PivotItem>
<!--Pivot item two-->
<phone:PivotItem Header="/Resources/Icon/ic_love_actionbar_red.png" Margin="0,10,0,-37" >
<phone:PivotItem.Background>
<ImageBrush Stretch="Fill" ImageSource="background.png"/>
</phone:PivotItem.Background>
</phone:PivotItem>
<phone:PivotItem Header="/Resources/Icon/ic_profile_actionbar_red.png" Margin="0,28,0,0">
<phone:PivotItem.Background>
<ImageBrush Stretch="Fill" ImageSource="background.png"/>
</phone:PivotItem.Background>
}
Thanks!
Hope this is what you're looking for?
Tabbed interface with Pivot animation for Windows Phone

Windows Store ListView ItemStackPanel horizontal scrollbar not visible

Im having Listview which shows 185 columns and 15 rows. For showing 185 columns with 15 rows, windows store app takes some time or UI gets freezes. below is the code Im using for showing data
<ListView x:Name="outerlstView"
Height="650"
Margin="2,24,10,10" Grid.Row="1"
Grid.Column="1" BorderThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
ItemsSource="{Binding Data,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ScrollViewer.HorizontalScrollBarVisibility="Visible"
ScrollViewer.HorizontalScrollMode="Enabled" ScrollViewer.VerticalScrollBarVisibility="Auto"
SelectionMode="None" ShowsScrollingPlaceholders="True" IsZoomedInView="False"
IsSwipeEnabled="False" IsItemClickEnabled="False"
ItemContainerStyle="{StaticResource LvItemStyle}"
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel
Orientation="Vertical" VirtualizingStackPanel.VirtualizationMode="Standard"/>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<ListView SelectionMode="None" IsZoomedInView="False" IsHoldingEnabled="False"
IsSwipeEnabled="False" x:Name="ListRow" ItemsSource="{Binding data, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Stretch" Width="Auto" Height="Auto"
VerticalAlignment="Center" ItemContainerStyle="{StaticResource LvItemStyle}" AllowDrop="True"
ShowsScrollingPlaceholders="True">
<interactivity:Interaction.Behaviors>
<awbehaviors:DragBehaviour/>
</interactivity:Interaction.Behaviors>
<ListView.ItemTemplate>
<DataTemplate>
<Grid Height="35" Width="120" HorizontalAlignment="Center" >
<Rectangle StrokeDashArray="1 1 0.3 1" Height="30" VerticalAlignment="Top" IsHitTestVisible="False" Opacity="0.5" Stroke="White" StrokeThickness="1" Margin="0" StrokeEndLineCap="Square" StrokeDashOffset="1.5"
Fill="{Binding ElementName=ListRow,Path=Tag,Converter={StaticResource RowNotoBackgroundConverter}}"/>
<TextBlock Text="{Binding FeedCellData,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left"
tyle="{StaticResource GridItemTextStyle}" Width="120" AllowDrop="True" Padding="1" TextWrapping="NoWrap"
VerticalAlignment="Top" Tag="{Binding ElementName=ListRow,Path=Tag}" ToolTipService.ToolTip="{Binding FeedCellData}"
Height="{Binding Path=Tag, RelativeSource={RelativeSource Mode=Self},Converter={StaticResource RowtoHeightConverter }}" >
</TextBlock>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsStackPanel Margin="0,0,0,0" Width="Auto" Orientation="Horizontal" Height="35" VirtualizingStackPanel.VirtualizationMode="Standard"/>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
the above code has listview inside it another listview. when i try to load list<list> to listview it takes too much of time. Some time app crashes when i load 100 rows with 185 columns.
I tried to replace Itemtemplate stye control to Itemstackpanel performance is good. data is loaded and shown on screen faster but i dont see Horizontal scroll
Previous Code
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel
Orientation="Vertical" VirtualizingStackPanel.VirtualizationMode="Standard"/>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
when i modify to `<ListView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsStackPanel Margin="0,0,0,0" Width="Auto" Orientation="Horizontal" Height="35" VirtualizingStackPanel.VirtualizationMode="Standard"/>
</ItemsPanelTemplate>
</ListView.ItemsPanel>`
i dont see horizontal scrollbar enabled. Can any1 suggest me how to enable Horizontal scroll bar enabled by default to Itemstackpanel in windows store apps.Looks like it is bug with this control or there work arounds to ItemsStackpanel with Horizontal Scrollbar.
If your ItensSource is a list of objects with a attribute Name and a attribute Price for example:
<ListView ItemsSource="{Binding Here_your_DataSource}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Visible" >
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<WrapGrid Orientation="Horizontal" MaximumRowsOrColumns="15"/>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<!--Here u design your item template-->
<StackPanel Background="Blue" Width="100" Height="100">
<TextBlock Text="{Binding Name}"></TextBlock>
<TextBlock Text="{Binding Price}"></TextBlock>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>

how to Switch ListBox DataTemplate orientation between Vertical and Horizontal on buttonClick from Appbar in windows phone 8

I have a Images page images are loading from my random urls into my ListBox, I have ApplicationBar in this page and i have created two buttons one for library page show in grid format and Second for library page in list format, by default my Library View in Grid format now i want to show its view in the list format by clicking a button from the application bar.
I have tried the converters to convert the orientation of my ListBox's stackPanel but not worked.
I have tried the change the orientation by fetching the x:Name property of the ListBox but not worked.
i searched on google by putting following query but not found proper solution.
"How to Switch ListBox DataTemplate orientation between Vertical and Horizontal on buttonClick from Appbar in windows phone 8"
I am showing my ListBoxPage.xaml.
<ListBox Name="listCloudBooks" Visibility="Visible" Grid.Row="1" ScrollViewer.VerticalScrollBarVisibility="Auto" FontFamily="Segoe UI" FontStyle="Normal" FontWeight="Thin" Margin="0,0,0,50">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<tools:WrapPanel Orientation="Horizontal">
</tools:WrapPanel>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<Border BorderThickness="1" Background="#151414" CornerRadius="3" Margin="3" Width="150" TextOptions.DisplayColorEmoji="True" BorderBrush="#1c1b1b">
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<Image x:Name="imgBookImage" Source="{Binding CLover}" Visibility="Visible" VerticalAlignment="Top" HorizontalAlignment="Center"
Width="80" Height="100"/>
<StackPanel Orientation="Horizontal">
<TextBlock Visibility="{Binding IsVisible}" Text="{Binding prgo}" FontFamily="Segoe UI" FontSize="18" FontWeight="ExtraBold" Foreground="White" Margin="5,0"></TextBlock>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding FName}" FontFamily="Segoe UI" FontSize="13.5"
Foreground="White" TextTrimming="WordEllipsis"
VerticalAlignment="Top" HorizontalAlignment="Left"
TextWrapping="Wrap"
Width="300" Padding="2"/>
<TextBlock Text="{Binding LName}" FontSize="13.5" FontFamily="Segoe UI"
Foreground="White"
VerticalAlignment="Top" HorizontalAlignment="Left"
TextWrapping="Wrap"
Width="300" Padding="2"/>
<ProgressBar x:Name="downloadProgressBar" Foreground="Green" IsIndeterminate="True" VerticalAlignment="Center" Width="120" TextOptions.TextHintingMode="Animated" Visibility="{Binding IsVisible}" CharacterSpacing="2"/>
<Button Content="Hello" x:Name="btnDownload" IsEnabled="{Binding IsEnableButton,
Click="btnDownload_Click" Tag="{Binding}" Width="120" BorderThickness="1" FontSize="13.5" Margin="0,5"
FontFamily="Segoe UI" tools:SlideInEffect.LineIndex="2" HorizontalAlignment="Left" VerticalAlignment="Top"
Foreground="White">
</Button>
<Image x:Name="imgCancelImage" Source="/Assets/Tiles/CancelImage.png" HorizontalAlignment="Right" Width="25" Height="25" Tag="{Binding}"/>
<Button x:Name="btnDeleteBook" Click="btnDeleteBook_Click"
Tag="{Binding}" BorderThickness="1" Margin="97,-66,0,0"
Height="55" Width="55"
<Button.Background>
<ImageBrush ImageSource="/Images/delete.png" Stretch="Fill"></ImageBrush>
</Button.Background>
</Button>
</StackPanel>
</StackPanel>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
If you have any idea how can we do that than please let me know.
I have found the alternate solution of it, what i am doing i have created two ListBox with different Name Property and made the visibility="Collapsed" and Orientation="Horizontal". And in second ListBox i created with different Name and Visibility Property="Visible" and assigned the orientation="Vertical".
So on btnList i am playing with Visibility only.