Hi
I've a following celltemplate:
<sync:GridTemplateColumn HeaderText="Title"
MappingName="Tol"
Width="130"
>
<sync:GridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Entry Grid.Column="0"
Grid.Row="0"
Text="{Binding Tol}"
FontSize="Small"
x:Name="tol_e"
IsVisible="{Binding TolEditable}"/>
<Picker Grid.Column="0"
Grid.Row="0"
x:Name="picker_tol"
Title="Choose ......"
IsVisible="{Binding TolEditable, Converter= {StaticResource inverter}}"
SelectedIndexChanged="PickerTol_SelectedIndexChanged"
ItemsSource="{Binding Tolok}"/>
</Grid>
</DataTemplate>
</sync:GridTemplateColumn.CellTemplate>
</sync:GridTemplateColumn>
The picker's items are different by rows. I'dont want to use picker's SelectedItem property. I would like to set picker's SelectedIndex from ContentPage. How to can access to picker_tol picker from code to do this.
Thanks,
Laszlo
<syncfusion:GridTemplateColumn HeaderText="Title" MappingName="No_1" Width="130">
<syncfusion:GridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.Behaviors>
<local:CustomBehavior></local:CustomBehavior>
</Grid.Behaviors>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Entry Grid.Column="0" Grid.Row="0" FontSize="Small" x:Name="tol_e">
</Entry>
<Picker Grid.Column="0" Grid.Row="0" x:Name="picker_tol"
BindingContext="{x:Reference viewModel}"
SelectedIndexChanged="picker_tol_SelectedIndexChanged"
ItemsSource="{Binding CustomerNames}"></Picker>
</Grid>
</DataTemplate>
</syncfusion:GridTemplateColumn.CellTemplate> </syncfusion:GridTemplateColumn>... public class CustomBehavior : Behavior<Grid> {
protected override void OnAttachedTo(Grid bindable)
{
base.OnAttachedTo(bindable);
(bindable.FindByName("picker_tol") as Picker).SelectedIndex = 3;
} } |
Thanks, but I'd like to acces to the picker via name e,g. picker_tolXXX where the XXX is a rowindex.