this is my code block
<grid>
<button name="button" click="button_click"/>
<border background="black" opacity="0.2"/>
</grid>
I want to use the button that is under border layer but it's not possible because border has its own tap event
Is there a way to use this button click event when the border is on top of it?
Just set the IsHitTestVisible property of your Border to false:
<grid>
<button Name="button" Click="button_click"/>
<border Background="black" Opacity="0.2" IsHitTestVisible="false" />
</grid>
Related
Whenever I load Data from mysql database (remotely), it loads fine but the 20 columns can't fit on potrait view. It tends to push the extra columns to new row, making the gridview disorganized.
How can I make the whole 20 columns appear on one horizontal row with a scrolling feature (horizontal)
All the related properties in xaml seam irresponsive. Thanks.
You can do this if you add the Grid inside ScrollView and set the Orientation property to Horizontal
Like this
<ContentPage.Content>
<ScrollView Orientation="Horizontal" VerticalOptions="Center">
<Grid VerticalOptions="FillAndExpand">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Button Grid.Column="0" Text="Button1" BackgroundColor="MediumSeaGreen" />
<Button Grid.Column="1" Text="Button2" />
<Button Grid.Column="2" Text="Button3" BackgroundColor="DodgerBlue" />
<Button Grid.Column="3" Text="Button4" />
<Button Grid.Column="4" Text="Button5" BackgroundColor="CadetBlue" />
</Grid>
</ScrollView>
</ContentPage.Content>
Result
I have a TopAppbar and BottomAppBar in my universal app,I want to create the same AppBars in my windows phone 8,this is my code:
<Page.TopAppBar>
<CommandBar HorizontalContentAlignment="Stretch" Background="#FF00AEEF">
<CommandBar.Content >
<Grid>
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Left">
<StackPanel Orientation="Horizontal" >
<Image Margin="2" Height="35" Source="images/4.png" Width="35"/>
</StackPanel>
<Button VerticalAlignment="Stretch" Background="#FF00AEEF" x:Name="HomeBtn" Click="HomeBtn_Click">
<StackPanel Orientation="Horizontal">
<Image Source="images/berry.png" Height="35" Width="35" />
<TextBlock Text="BarBerry" Foreground="White"></TextBlock>
</StackPanel>
</Button>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button VerticalAlignment="Stretch" Background="#FF00AEEF" Style="{StaticResource CustomButtonStyle}" Margin="5,0">
<StackPanel Orientation="Horizontal">
<TextBlock Text="Contact" Foreground="White"></TextBlock>
</StackPanel>
</Button>
</StackPanel>
</Grid>
</CommandBar.Content>
</CommandBar>
</Page.TopAppBar>
<Page.BottomAppBar>
<CommandBar Background="#eff0f2" HorizontalContentAlignment="Stretch">
<CommandBar.Content>
<Grid HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Left" Grid.Row="0" Grid.Column="0" VerticalAlignment="Stretch">
<Image Source="images/world.png" Height="35" Width="35" Margin="5,0"/>
<ComboBox Margin="2" BorderThickness="0" SelectedItem="test" x:Name="combo">
<ComboBoxItem Content="test" />
<ComboBoxItem Content="test1" />
</ComboBox>
</StackPanel>
</Grid>
</CommandBar.Content>
</CommandBar>
</Page.BottomAppBar>
but the problem is that,I get only the BottomAppBar displayed,is it possible to define in windows Phone 8 a Top and a Bottom AppBars,should I use a StackPanel in place of the Top appBar?
thanks for help
You can't create the Top App Bar in windows phone. Because their is only Bottom App Bar is defined in the Windows phone project. So you can only define the bottom app bar in windows phone.Yes you can use the Stack panel instead of Top App bar but i think this is not a good idea to implement that kind of functionality in windows phone :).
my problem is exactly similar to this article
But I need to implement in wp8.1 runtime. I want textblock (name=txt_latest_update) in view while scrolling
here is my XAML code
<Grid Name="Root_content" Background="#FFF7FDF7">
<Grid.RowDefinitions>
<RowDefinition Height="70"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" Background="Red">
<Image Source="/Assets/nepaltoday.png" HorizontalAlignment="Left" Margin="10,0,0,0"/>
</Border>
<ScrollViewer Grid.Row="1" Name="frontpage_scrollview" VerticalScrollBarVisibility="Visible"
>
<StackPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="300"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Image Name="startscren" Stretch="Fill"/>
<Grid>
<Grid.Background>
<LinearGradientBrush StartPoint="0.3,0" EndPoint="1,0.">
<GradientStop Color="Transparent" Offset="0"/>
<GradientStop Color="Black" Offset="1.2" />
</LinearGradientBrush>
</Grid.Background>
</Grid>
<Grid HorizontalAlignment="Right" Margin="0,10,10,0">
<StackPanel>
<TextBlock Name="txt_nepali_date" Foreground="White" FontSize="26"/>
<TextBlock Name="txt_eng_date" Foreground="White" FontSize="26" />
<TextBlock Name="txt_temp" Foreground="Yellow" FontSize="44" Margin="0,20,0,0"/>
<TextBlock Name="txt_location" FontSize="22"/>
</StackPanel>
</Grid>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.Resources>
<Style TargetType="Button">
<Setter Property="BorderBrush" Value="LightGray"/>
<Setter Property="BorderThickness" Value="0,1,1,1"/>
<Setter Property="Height" Value="Auto"/>
<Setter Property="Margin" Value="0,0,0,-20"/>
</Style>
</Grid.Resources>
<StackPanel Grid.Column="0">
<Button Name="btnNews" Click="btnNews_Click">
<Image Source="/Assets/FrontPage/horoscope.png" VerticalAlignment="Stretch"/>
</Button>
<Button Name="btnHoroscope" Click="btnHoroscope_Click">
<Image Source="/Assets/FrontPage/horoscope.png"/>
</Button>
<Button Name="btnCurrencyExchanges" Click="btnCurrencyExchanges_Click">
<Image Source="/Assets/FrontPage/currency exchange.png"/>
</Button>
<Button Name="btnStockExchanges" Click="btnStockExchange">
<Image Source="/Assets/FrontPage/on this day.png"/>
</Button>
<Button Name="btnOnthisday" Click="btnOnthisday_Click">
<Image Source="/Assets/FrontPage/horoscope.png"/>
</Button>
<Button Name="btnMovie" Click="btnMovie_Click">
<Image Source="/Assets/FrontPage/horoscope.png"/>
</Button>
</StackPanel>
<StackPanel Grid.Column="1" >
<Button Name="btnWeather" Click="btnWeather_Click">
<Image Source="/Assets/FrontPage/whether.png"/>
</Button>
<Button Name="btnLoadshedding" Click="btnLoadshedding_Click">
<Image Source="/Assets/FrontPage/loadshedding.png"/>
</Button>
<Button Name="btnGoldSilver" Click="btnGoldSilver_Click">
<Image Source="/Assets/FrontPage/gold_silver rates.png"/>
</Button>
<Button Name="btnTheatre" Click="btnTheatre_Click">
<Image Source="/Assets/FrontPage/theater.png"/>
</Button>
<Button Name="btnCalendar" Click="btnCalendars">
<Image Source="/Assets/FrontPage/horoscope.png"/>
</Button>
</StackPanel>
</Grid>
</Grid>
</StackPanel >
</ScrollViewer>
<Border Name="TitleBorder" Grid.Row="1"
Background="#FF264778" Opacity="0.7"
Margin="0,260,0,0"
Height="{Binding ElementName=TitleText, Path=Height}"
VerticalAlignment="Top">
<TextBlock Name="txt_lastest_update" HorizontalAlignment="Center"
Text="keep in view"
Foreground="White"
FontSize="22"
Margin="12" />
</Border>
</Grid>
Any suggestion?
hey i think your problem is, you want keep your textblock fixed while list is scroll. so you have to keep your list in different grid and textblock in different grid which need to fix. and make grid which contain list scrolable = true.
In my windowsphone8.1 app i am using flipview.
after adding oxyplot:plotview under flipviewitem i am unable to change page on swipe over the chart area.
what should i do to handle the swipe over chart and flipview act differently.
<FlipView x:Name="flip" Grid.Row="1" Grid.ColumnSpan="4" Grid.Column="0" Margin="0,0,0,0.333" Grid.RowSpan="2">
<FlipViewItem>
<oxy:PlotView x:Name="chart" />
</FlipViewItem>
<FlipViewItem>
<Button x:Name="btny2" Content="mov" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center" Tapped="btny2_Tapped" ></Button>
</FlipViewItem>
<FlipViewItem>
<Button x:Name="btnUpdate" Content="Upd" Grid.Row="1" Grid.Column="2" HorizontalAlignment="Right" Tapped="btnupdate_Tapped" ></Button>
</FlipViewItem>
<FlipViewItem>
<Button x:Name="btnRemove" Content="Rem" Grid.Row="1" Grid.Column="3" HorizontalAlignment="Center" Tapped="btnRemove_Tapped" ></Button>
</FlipViewItem>
</FlipView>
how to set two buttons in a line without using grid in windows phone
two controls within single line
<StackPanel Grid.Row="1">
<Button Content="-" Width="80" />
<Button Content="+" Width="80" />
</StackPanel>
use orientation property of stackPanel
<StackPanel Grid.Row="1" Orientation="Horizontal">
<Button Content="-" Width="80" />
<Button Content="+" Width="80" />
</StackPanel>
use orientation property of stackPanel
Orientation="Horizontal"
<StackPanel Grid.Row="1" Orientation="Horizontal">
<Button Content="-" Width="80" />
<Button Content="+" Width="80" />
</StackPanel>