I have the following grid:
<!--MainGrid-->
<Grid Grid.Row="2" x:Name="maingrid_piccat">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ImageButton
Aspect="AspectFit"
Grid.Column="1"
Source="btn_emptydummy.png" BackgroundColor="#00000000"/>
<Picker x:Name="picker_maincat_pickcate"
Grid.Column="1"
Title="Hauptkategorie"
FontFamily="arial"
BackgroundColor="#00000000"
TextColor="#272727"
HorizontalOptions="Center"
VerticalOptions="Center">
<Picker.Items>
<x:String>Cat 1</x:String>
<x:String>Cat 2</x:String>
<x:String>Cat 3</x:String>
<x:String>Cat 4</x:String>
</Picker.Items>
</Picker>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ImageButton
Aspect="AspectFit"
Grid.Column="1"
Source="btn_emptydummy.png" BackgroundColor="#00000000"/>
<Picker x:Name="picker_subcat1_pickcate"
Grid.Column="1"
Title="Unterkategorie 01"
FontFamily="arial"
BackgroundColor="#00000000"
TextColor="#272727"
HorizontalOptions="Center"
VerticalOptions="Center">
<Picker.Items>
<x:String>Subcat yx</x:String>
<x:String>Subcat yx</x:String>
<x:String>Subcat yx</x:String>
<x:String>Subcat yx</x:String>
</Picker.Items>
</Picker>
</Grid>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ImageButton
Aspect="AspectFit"
Grid.Column="1"
Source="btn_emptydummy.png" BackgroundColor="#00000000"/>
<Picker x:Name="picker_subcat2_pickcate"
Grid.Column="1"
FontFamily="arial"
Title="Unterkategorie 02"
BackgroundColor="#00000000"
TextColor="#272727"
HorizontalOptions="Center"
VerticalOptions="Center">
<Picker.Items>
<x:String>Subcat yx</x:String>
<x:String>Subcat yx</x:String>
<x:String>Subcat yx</x:String>
<x:String>Subcat yx</x:String>
</Picker.Items>
</Picker>
</Grid>
<Grid Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ImageButton
Aspect="AspectFit"
Grid.Column="1"
Source="btn_emptydummy.png" BackgroundColor="#00000000"/>
<Picker x:Name="picker_subcat3_pickcate"
Grid.Column="1"
FontFamily="arial"
BackgroundColor="#00000000"
TextColor="#272727"
Title="Unterkategorie 03"
HorizontalOptions="Center"
VerticalOptions="Center">
<Picker.Items>
<x:String>Subcat yx</x:String>
<x:String>Subcat yx</x:String>
<x:String>Subcat yx</x:String>
<x:String>Subcat yx</x:String>
</Picker.Items>
</Picker>
</Grid>
<Grid Grid.Row="4" x:Name="row4_piccat">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ImageButton
x:Name="btn_dummy_piccat"
Aspect="AspectFit"
Grid.Column="1"
Source="btn_emptydummy.png" BackgroundColor="#00000000"/>
<Entry x:Name="entry_name_pickcat"
Grid.Column="1"
FontFamily="arial"
MaxLength="15"
Placeholder="Titel der Anzeige"
BackgroundColor="#00000000"
TextColor="#272727"
HorizontalOptions="Center"
VerticalOptions="Center">
</Entry>
</Grid>
<Grid Grid.Row="5" x:Name="row5_piccat">
<Grid.ColumnDefinitions >
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ImageButton
Aspect="AspectFit"
x:Name="btn_dummy_piccat2"
Grid.Column="1"
Source="btn_emptydummy.png" BackgroundColor="#00000000"/>
<Entry x:Name="entry_descri_pickcate"
Grid.Column="1"
FontFamily="arial"
MaxLength="50"
Placeholder="Kurzbeschreibung"
BackgroundColor="#00000000"
TextColor="#272727"
HorizontalOptions="Center"
VerticalOptions="Center">
</Entry>
</Grid>
<Grid Grid.Row="6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ImageButton
Margin="10,10,10,10"
Grid.Column="1"
Aspect="AspectFit"
HorizontalOptions="Center"
VerticalOptions="Center"
x:Name="name_btnfoto_pickcat"
BackgroundColor="#00000000"
Source="fotobutton.png" />
</Grid>
</Grid>
It is working fine, but now I want to alter the last two rows. The second to last row is now supposed to have a text in there that takes the size of the last two rows. But I dont seem to be able to make the second to last row span into the last row. This is the result atm:
You can see, the content here is just inside the one row, but i want it to overlap into the second row aw well. This is the code currently:
private void SetLayoutForTakers()
{
btn_dummy_piccat2.IsVisible = false;
entry_descri_pickcate.IsVisible = false;
Grid grid = new Grid(); //Neues Grid
BoxView bx = new BoxView();
Label lb = new Label();
//Label Properties
lb.Text = "Tipp: Sie können auch nur nach Titeln suchen, oder nach bestimmten Titeln in einer oder mehrerer Kategorien!";
lb.TextColor = Xamarin.Forms.Color.White;
lb.FontSize = 12;
lb.FontFamily = "arial";
bx.Color = Xamarin.Forms.Color.Red;
grid.Children.Add(bx);
grid.Children.Add(lb);
row5_piccat.Children.Add(grid,1,1);
}
So how can I achieve my goal? In the end, the red boxview is supposed to take the place of two rows (the last two rows) rn, it is only in one.
All needs to be done programatically :-).
THank you!
Grid.Children.Add has an overload that lets you specify the span values
public void Add (Xamarin.Forms.View view, int left, int right, int top, int bottom);
left
Int32
The left edge of the column span. Must be greater than or equal to 0.
right
Int32
The right edge of the column span. Must be greater than left. The view
won't occupy this column, but will stop just before it.
top
Int32
The top edge of the row span. Must be greater than or equal to 0.
bottom
Int32
The bottom edge of the row span. Must be greater than top.
Related
recently, we have discovered an error in my Xamarin.Forms application that seems to be in correlation to the Syncfusion element 'SfChart'.
We have a 4-axis chart that fetches data via data binding. The error occurs when one object that carries the data, used by the chart to draw the lines, is getting removed, added or altered.
This data is stored in an ObservableCollection and signals a PropertyChanged when altered.
Whenever a different data object is assigned to an index of the data list, bound to the ItemSources of the individual FastLineSeries, I sometimes get the following error:
[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentOutOfRangeException: Index must be within the bounds of the List.
[mono-rt] Parameter name: index
[mono-rt] at System.Collections.Generic.List`1[T].Insert (System.Int32 index, T item) [0x00009] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/List.cs:688
[mono-rt] at Com.Syncfusion.Charts.ChartSeries.SetIndividualPoint (System.Int32 index, System.Object value, System.Boolean replace) [0x007d4] in <5223039dbed24acb9c9c1764d59d17de>:0
[mono-rt] at Com.Syncfusion.Charts.ChartSeries.OnDataSource_CollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00041] in <5223039dbed24acb9c9c1764d59d17de>:0
[mono-rt] at (wrapper delegate-invoke) .invoke_void_object_NotifyCollectionChangedEventArgs(object,System.Collections.Specialized.NotifyCollectionChangedEventArgs)
[mono-rt] at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00018] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs:263
[mono-rt] at MvvmCross.ViewModels.MvxObservableCollection`1[T].<>n__0 (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) <0x727c3f6d68 + 0x00043> in <687f2e5f7efd4e33b498a18ba9db221f>:0
[mono-rt] at MvvmCross.ViewModels.MvxObservableCollection`1+<>c_DisplayClass7_0[T].b0 () [0x00000] in //MvvmCross/ViewModels/MvxObservableCollection.cs:72
[mono-rt] at MvvmCross.Base.MvxMainThreadAsyncDispatcher+<>c_DisplayClass0_0.b0 () [0x00000] in //MvvmCross/Base/MvxMainThreadAsyncDispatcher.cs:16
[mono-rt] at MvvmCross.Base.MvxMainThreadAsyncDispatcher+<>c_DisplayClass1_0.b0 () [0x00011] in //MvvmCross/Base/MvxMainThreadAsyncDispatcher.cs:27
[mono-rt] at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.26(intptr,intptr)
[mono-rt] at (wrapper native-to-managed) Android.Runtime.DynamicMethodNameCounter.26(intptr,intptr)
It also seems that sometimes after changing or deleting the data for the LineSeries, old data is retained in the UI element and two of the same LineSeries with the same color gets drawn, even if this data isn't anywhere in the data bound list.
What's weird is that two lines with the same color and a big value difference get drawn by the chart, although there only is one possible binding that one LineSeries should be able to get data from.
Best regards,
O.B.
The picture shows the chart with the wrong double yellow lines
The XAML looks like this:
<Grid
Grid.Row="0"
Grid.Column="0"
BackgroundColor="#0072BC"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.GestureRecognizers>
<TapGestureRecognizer Command="{Binding TapChartSelectionPopup}" CommandParameter="0" />
</Grid.GestureRecognizers>
<Label
Grid.Column="0"
BackgroundColor="#ED1B2F"
HorizontalOptions="FillAndExpand" />
<Label
Grid.Column="1"
Grid.ColumnSpan="4"
HorizontalOptions="Start"
Text="{Binding PanelAppModel.PanelApp.ChartModel.ChartDataList[0].Name}" />
<Label
x:Name="UnitLabel1"
Grid.Column="5"
Grid.ColumnSpan="2"
HorizontalOptions="FillAndExpand"
Text="{Binding PanelAppModel.PanelApp.ChartModel.ChartDataList[0].Unit}"
TextColor="White"
VerticalOptions="FillAndExpand" />
<Image
Grid.Column="6"
Grid.ColumnSpan="2"
Margin="0,0,-5,0"
HorizontalOptions="Center"
Scale="0.7"
Source="{Binding PanelAppModel.PanelApp.ChartModel.ChartDataList[0].ImagePath}" />
</Grid>
<Grid
Grid.Row="0"
Grid.Column="1"
BackgroundColor="#0072BC"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.GestureRecognizers>
<TapGestureRecognizer Command="{Binding TapChartSelectionPopup}" CommandParameter="1" />
</Grid.GestureRecognizers>
<Label
Grid.Column="0"
BackgroundColor="#8DC63F"
HorizontalOptions="FillAndExpand" />
<Label
Grid.Column="1"
Grid.ColumnSpan="4"
HorizontalOptions="Start"
Text="{Binding PanelAppModel.PanelApp.ChartModel.ChartDataList[1].Name}" />
<Label
x:Name="UnitLabel2"
Grid.Column="5"
Grid.ColumnSpan="2"
HorizontalOptions="FillAndExpand"
Text="{Binding PanelAppModel.PanelApp.ChartModel.ChartDataList[1].Unit}"
TextColor="White"
VerticalOptions="FillAndExpand" />
<Image
Grid.Column="6"
Grid.ColumnSpan="2"
Margin="0,0,-5,0"
HorizontalOptions="Center"
Scale="0.7"
Source="{Binding PanelAppModel.PanelApp.ChartModel.ChartDataList[1].ImagePath}" />
</Grid>
<Grid
Grid.Row="1"
Grid.Column="0"
BackgroundColor="#0072BC"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.GestureRecognizers>
<TapGestureRecognizer Command="{Binding TapChartSelectionPopup}" CommandParameter="2" />
</Grid.GestureRecognizers>
<Label
Grid.Column="0"
BackgroundColor="#07426E"
HorizontalOptions="FillAndExpand" />
<Label
Grid.Column="1"
Grid.ColumnSpan="4"
HorizontalOptions="Start"
Text="{Binding PanelAppModel.PanelApp.ChartModel.ChartDataList[2].Name}" />
<Label
x:Name="UnitLabel3"
Grid.Column="5"
Grid.ColumnSpan="2"
HorizontalOptions="FillAndExpand"
Text="{Binding PanelAppModel.PanelApp.ChartModel.ChartDataList[2].Unit}"
TextColor="White"
VerticalOptions="FillAndExpand" />
<Image
Grid.Column="6"
Grid.ColumnSpan="2"
Margin="0,0,-5,0"
HorizontalOptions="Center"
Scale="0.7"
Source="{Binding PanelAppModel.PanelApp.ChartModel.ChartDataList[2].ImagePath}" />
</Grid>
<Grid
Grid.Row="1"
Grid.Column="1"
BackgroundColor="#0072BC"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.GestureRecognizers>
<TapGestureRecognizer Command="{Binding TapChartSelectionPopup}" CommandParameter="3" />
</Grid.GestureRecognizers>
<Label
Grid.Column="0"
BackgroundColor="#FFCC00"
HorizontalOptions="FillAndExpand" />
<Label
Grid.Column="1"
Grid.ColumnSpan="4"
HorizontalOptions="Start"
Text="{Binding PanelAppModel.PanelApp.ChartModel.ChartDataList[3].Name}" />
<Label
x:Name="UnitLabel4"
Grid.Column="5"
Grid.ColumnSpan="2"
HorizontalOptions="FillAndExpand"
Text="{Binding PanelAppModel.PanelApp.ChartModel.ChartDataList[3].Unit}"
TextColor="White"
VerticalOptions="FillAndExpand" />
<Image
Grid.Column="6"
Grid.ColumnSpan="2"
Margin="0,0,-5,0"
HorizontalOptions="Center"
Scale="0.7"
Source="{Binding PanelAppModel.PanelApp.ChartModel.ChartDataList[3].ImagePath}" />
</Grid>
</Grid>
</StackLayout>
<StackLayout
HorizontalOptions="FillAndExpand"
Orientation="Horizontal"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent,
Property=Height,
Factor=0.75}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent,
Property=Width,
Factor=0.9}"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent,
Property=Width,
Factor=0.05}"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent,
Property=Height,
Factor=0.25}"
VerticalOptions="FillAndExpand">
<sfChart:SfChart
x:Name="chart"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand">
<sfChart:SfChart.PrimaryAxis>
<sfChart:DateTimeAxis />
</sfChart:SfChart.PrimaryAxis>
<sfChart:SfChart.ChartBehaviors>
<sfChart:ChartZoomPanBehavior EnableDirectionalZooming="True" EnableDoubleTap="True" />
</sfChart:SfChart.ChartBehaviors>
<sfChart:SfChart.Series>
<sfChart:FastLineSeries
x:Name="flSeries1"
ItemsSource="{Binding PanelAppModel.PanelApp.ChartModel.ChartDataList[0].ChartDataLog}"
XBindingPath="TestDT"
YBindingPath="Value"
Color="#ED1B2F" />
<sfChart:FastLineSeries
x:Name="flSeries2"
ItemsSource="{Binding PanelAppModel.PanelApp.ChartModel.ChartDataList[1].ChartDataLog}"
XBindingPath="TestDT"
YBindingPath="Value"
Color="#8DC63F" />
<sfChart:FastLineSeries
x:Name="flSeries3"
ItemsSource="{Binding PanelAppModel.PanelApp.ChartModel.ChartDataList[2].ChartDataLog}"
XBindingPath="TestDT"
YBindingPath="Value"
Color="#07426E" />
<sfChart:FastLineSeries
x:Name="flSeries4"
ItemsSource="{Binding PanelAppModel.PanelApp.ChartModel.ChartDataList[3].ChartDataLog}"
XBindingPath="TestDT"
YBindingPath="Value"
Color="#FFCC00" />
</sfChart:SfChart.Series>
</sfChart:SfChart>
</StackLayout>
I have a ListView which is populating the result based on DataTemplate. See the code below
I am raising property changed event in cpp to reflect the same in UI for ResultText field.
But the same value is not getting reflected in AutomationProperties.Name.
How to update AutomationProperties.Name ?
<DataTemplate x:DataType="local:testResults">
<Grid x:Name="diagGrid" HorizontalAlignment="Stretch" Visibility="{x:Bind ShowStage, Mode=OneWay}" AutomationProperties.Name="{x:Bind ResultText}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<SymbolIcon Grid.Column="0" Symbol="{x:Bind ResultSymbol, Mode=OneWay}" Foreground="{x:Bind SymbolColor, Mode=OneWay}" Visibility="{x:Bind IsStageComplete, Mode=OneWay}" HorizontalAlignment="Center"/>
<ProgressRing Grid.Column="0" IsActive="{x:Bind IsStageRunning, Mode=OneWay}" Margin="10,0,20,0" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="1" Text="{x:Bind StageName, Mode=OneWay}" Foreground="{ThemeResource AppBarItemDisabledForegroundThemeBrush}">
</TextBlock>
<TextBlock x:Name="test" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="1" Text="{x:Bind ResultText, Mode=OneWay}" Margin="10" TextWrapping="Wrap"/>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>```
I added mode=OneWay, then it worked.
AutomationProperties.Name="{x:Bind ResultText, Mode=OneWay}">
I am using xamarin. forms, I need the create a circle as following, As the colours are generic I am unable to use the image. Is there any way to get a circle as follows.
I tried:
<Grid ColumnSpacing="-10" HorizontalOptions="EndAndExpand">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="25"/>
<ColumnDefinition Width="25"/>
</Grid.ColumnDefinitions>
<Frame CornerRadius="16" HeightRequest="25" WidthRequest="25" BackgroundColor="Red" Padding="0" Grid.Column="0" HasShadow="False"/>
<Frame CornerRadius="16" HeightRequest="25" WidthRequest="25" BackgroundColor="Green" Padding="0" Grid.Column="1" HasShadow="False"/>
</Grid>
Got output as:
You can use the frame, but you must use the ClipToBounds property, with a Grid inside.
<Frame HorizontalOptions="Center" VerticalOptions="Center"
HeightRequest="100" WidthRequest="100" CornerRadius="50" IsClippedToBounds="True" Padding="0">
<Grid ColumnSpacing="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<BoxView BackgroundColor="Yellow"/>
<BoxView Grid.Column="1" BackgroundColor="Red"/>
</Grid>
</Frame>
Which results in:
Make Corner radius half of width/height request. Suppose widthrequest = 26 then heightrequest should be the same and Cornerradius should be 13(26/2);
I managed to setup rows and columns from the code but couldn't move this settings to xaml:
grid.RowDefinitions = new RowDefinitionCollection {
new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }
};
grid.ColumnDefinitions = new ColumnDefinitionCollection {
new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }
};
The following doesn't work:
<Grid x:Name="grid" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
...
</Grid>
From the documentation I managed to fetch only c# implementation
I also get the same behaviour (does not fill and expand) for a grid with a single cell (1 row / column, although I am not sure why we would ever need a grid with a single cell full size of screen), but it seems to work fine for a 2 x 2, 3 x 3 cell grid (have not tried others yet).
The Height="" and Width="" attributes are required in Xamarin Forms although I "think" they are not needed in WPF as the default assumes this is the case.
<ContentPage.Content>
<Grid VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button Grid.Row="0" Grid.Column="0" Text="1"></Button>
<Button Grid.Row="1" Grid.Column="1" Text="2"></Button>
</Grid>
</ContentPage.Content>
Here is a sample
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="Top Left" Grid.Row="0" Grid.Column="0" />
<Label Text="Top Right" Grid.Row="0" Grid.Column="1" />
<Label Text="Bottom Left" Grid.Row="1" Grid.Column="0" />
<Label Text="Bottom Right" Grid.Row="1" Grid.Column="1" />
</Grid>
I created a project using the default Grid Template with VS2012, and added a button to the upper right hand corner and it is NOT clickable, and if I remove the GridView then it's clickable. Strange to me, could someone point out why this is the case
<Grid Style="{StaticResource LayoutRootStyle}">
<Grid.RowDefinitions>
<RowDefinition Height="140"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Back button and page title -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
<TextBlock x:Name="pageTitle" Text="{StaticResource AppName}" Grid.Column="1" IsHitTestVisible="false" Style="{StaticResource PageHeaderTextStyle}"/>
<Button
x:Name="SettingsButton"
Grid.Column="2"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Margin="0,0,120,0"
AutomationProperties.Name="Settings"
Content="Settings"
Click="SettingsButton_Click"
/>
</Grid>
<GridView .... />
</Grid>
Your GridView is being drawn on top of your button grid. Move the button grid declaration below the GridView.
<Grid Style="{StaticResource LayoutRootStyle}">
<Grid.RowDefinitions>
<RowDefinition Height="140"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Move the GridView Here -->
<GridView .... />
<!-- Back button and page title -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
<TextBlock x:Name="pageTitle" Text="{StaticResource AppName}" Grid.Column="1" IsHitTestVisible="false" Style="{StaticResource PageHeaderTextStyle}"/>
<Button
x:Name="SettingsButton"
Grid.Column="2"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Margin="0,0,120,0"
AutomationProperties.Name="Settings"
Content="Settings"
Click="SettingsButton_Click"
/>
</Grid>
</Grid>