Telerik Forums
UI for .NET MAUI Forum
1 answer
33 views

Hi!

How do I select an item in the listview at runtime (mvvm) and make this item always visible on the screen? Can you help me?

Example:
I press a button to select any item from the list. If this item is not appearing on the screen, listview automatically positions it on the item, making it visible.

Regards,

Rodrigo

Didi
Telerik team
 answered on 20 Feb 2024
1 answer
21 views

What is the proper layout type to use when doing a searchbar?

In IOS, with a page that contains several controls, you would want the listview to appear only when you are typing into the searchbar.

I experimented with Grids, StackLayouts, etc.  Whatever space gets allocated in the layout for the listview is never collapsed when done searching & you hide the listview.   Work fine in Windows and Android.

What is the proper way to do this?

One of many unsuccessful attempts:

 

 <Grid RowDefinitions="Auto,Auto,Auto" Grid.Row="0">
 <Label Text="Employee:" FontSize="Small" WidthRequest="120" Grid.Row="0" />
 <SearchBar x:Name="EmployeeSearch"   Placeholder="Select Employee..." TextChanged="OnTextChangedEmployee" HorizontalOptions="Center" WidthRequest="120"  BackgroundColor="Red" HeightRequest="200" Grid.Row="1" />
 <telerik:RadListView x:Name="searchResultsEmployee"  ItemTapped="OnItemTappedEmployee" Grid.Row="2" BackgroundColor="Green" HeightRequest="200">
                        <telerik:RadListView.ItemTemplate>
         <DataTemplate>
             <telerik:ListViewTemplateCell>
                 <telerik:ListViewTemplateCell.View>
                     <Grid>
                         <Label Margin="10" Text="{Binding EmployeeName}" />
                     </Grid>
                 </telerik:ListViewTemplateCell.View>
             </telerik:ListViewTemplateCell>
         </DataTemplate>
     </telerik:RadListView.ItemTemplate>
 </telerik:RadListView>
 </Grid>
Didi
Telerik team
 answered on 19 Feb 2024
1 answer
9 views

Using the DataTable and RadDataGrid example at https://docs.telerik.com/devtools/maui/controls/datagrid/datatable-support

How do I specify the binding for a CellContentTemplate  DataTemplate in XAML ?

For example, for IsVisited

<telerik:RadDataGrid.Columns>
    <telerik:DataGridBooleanColumn PropertyName="IsVisited" HeaderText="IsVisited" SizeMode="Auto"
                           CanUserEdit="False" CanUserFilter="false" IsResizable="false">
        <telerik:DataGridBooleanColumn.CellContentStyle>
            <telerik:DataGridTextCellStyle TextColor="Black" FontSize="14" SelectedTextColor="Blue" HorizontalTextAlignment="End" />
        </telerik:DataGridBooleanColumn.CellContentStyle>
        <telerik:DataGridColumn.CellContentTemplate>
            <DataTemplate>
                <telerik:RadCheckBox IsChecked="{Binding IsVisited}" IsEnabled="False" HorizontalOptions="Center"/>
            </DataTemplate>
        </telerik:DataGridColumn.CellContentTemplate>
    </telerik:DataGridBooleanColumn>
</telerik:RadDataGrid.Columns>

I'm getting the message

"Microsoft.Maui.Controls.Xaml.Diagnostics.BindingDiagnostics: Warning: 'IsVisited' property not found on 'System.Data.DataRowView', target property: 'Telerik.Maui.Controls.RadCheckBox.IsChecked'"

The checkbox is not checked when IsVisited is true.

Didi
Telerik team
 answered on 15 Feb 2024
0 answers
21 views
Hello,

I'm using Telelik entry control but, I can't type Korean when I use it. Please check if there's any way to solve it and let me know.
fyi, i'm using Mac OS now.


hyunkyoo
Top achievements
Rank 1
 updated question on 13 Feb 2024
1 answer
21 views

Hi There,

I want to load the DayTemplate according to the month displayed in the current calendar.

The DayTemplate xaml codes: 

 <local:ReminderTemplateSelector.TaskTemplate>
     <DataTemplate>
         <telerik:CalendarBorderLabel Text="{Binding Text}"
                                      TextColor="{StaticResource AccentColor4}"
                                      HorizontalTextAlignment="Center"
                                      VerticalTextAlignment="Center"
                                      FontAttributes="Bold">
             <Label FontFamily="TelerikFontExamples"
                    Text="&#xe80b;"
                    TextColor="{StaticResource AccentColor4}"
                    HorizontalTextAlignment="Center"
                    VerticalTextAlignment="End"
                    Margin="{OnPlatform Default=0, WinUI='0, 0, 0, 4'}" />
         </telerik:CalendarBorderLabel>
     </DataTemplate>
 </local:ReminderTemplateSelector.TaskTemplate>

ReminderTemplateSelector :

public class ReminderTemplateSelector : DataTemplateSelector
{

    public static readonly BindableProperty TasksProperty = BindableProperty.Create(nameof(Tasks), typeof(ReminderTemplateSelector), typeof(ReminderTemplateSelector), null);

    private List<DateTime> tasks;
    public ReminderTemplateSelector()
    {
      
    }

    public DataTemplate TaskTemplate { get; set; }

    public List<DateTime> Tasks
    {
        get => this.tasks;
        set
        {
            this.tasks = value;
        }
    }

    protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
    {
        var node = item as CalendarNode;
        var date = node.Date.Value;
          
        bool hasTaskReminder = false;
        if (this.tasks != null)
        {
            hasTaskReminder = this.tasks.Contains(date);
        }
         

        if (hasTaskReminder)
        {
            return this.TaskTemplate;
        }
         
        return null;
    }
}

I am trying to reload the "Task"  by month on OnDisplayDate event,  but OnSelectTemplate executed before the date change.

It is unable to load the correct DayTemplate based on the current month changes. How should I do it?

        private async void OnDisplayDateChanged(object sender, ValueChangedEventArgs<System.DateTime> e)
        {

            this.ReminderTemplateSelector.Tasks = LoadTask(e.NewValue);
        }


Yana
Telerik team
 answered on 12 Feb 2024
1 answer
11 views
hello, please can you help me fix the background color issue for the Android
Style can't help me fix the issue.
Didi
Telerik team
 answered on 12 Feb 2024
1 answer
19 views

HI,

I'm really struggling with customizing the conversational UI, there does not seem to be an example for changing the SuggestedActionsItem.

I know i need to define a temple for the SuggestedActionsTemplate on the ChatItemTemplateSelector, but how am i supposed to know what values are available? or what i am targetting.

A simple example of changing the background of each action would be nice :)

thanks

Yana
Telerik team
 answered on 09 Feb 2024
0 answers
20 views

i have a radsidedrwaer and i get System.ArgumentNullException: 'Value cannot be null. (Parameter 'view')' get 

on app center i get 

ElementExtensions.ToHandler (IElement view, IMauiContext context) D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:58
ElementExtensions.ToPlatform (IElement view, IMauiContext context) D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:127
Telerik.Maui.RadSideDrawerExtensions.UpdateDrawerContent(RadSideDrawer nativeSideDrawer, IRadSideDrawer sideDrawer)
Telerik.Maui.Handlers.RadSideDrawerHandler.MapDrawerContent(RadSideDrawerHandler handler, IRadSideDrawer virtualElement)
PublicKeyToken=5803cfa389c90ce7]].<Add>b__0 (IElementHandler h, IElement v) D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:172
PropertyMapper.UpdatePropertyCore (String key, IElementHandler viewHandler, IElement virtualView) D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:47
PropertyMapper.UpdateProperties (IElementHandler viewHandler, IElement virtualView) D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:82
ElementHandler.SetVirtualView (IElement view) D:\a\_work\1\s\src\Core\src\Handlers\Element\ElementHandler.cs:79
PublicKeyToken=5803cfa389c90ce7]].SetVirtualView (IView view) D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:53
PublicKeyToken=5803cfa389c90ce7]].SetVirtualView (IElement view) D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:56
Element.SetHandler (IElementHandler newHandler) D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:921
Element.set_Handler (IElementHandler value) D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:863
IElement.set_Handler (IElementHandler value) D:\a\_work\1\s\src\Controls\src\Core\VisualElement\VisualElement.cs:2031
ElementExtensions.ToHandler (IElement view, IMauiContext context) D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:96
ElementExtensions.ToPlatform (IElement view, IMauiContext context) D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:127
LayoutHandler.SetVirtualView (IView view) D:\a\_work\1\s\src\Core\src\Handlers\Layout\LayoutHandler.Android.cs:41
PublicKeyToken=null]].SetVirtualView (IElement view) D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:56
Element.SetHandler (IElementHandler newHandler) D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:921
Element.set_Handler (IElementHandler value) D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:863
IElement.set_Handler (IElementHandler value) D:\a\_work\1\s\src\Controls\src\Core\VisualElement\VisualElement.cs:2031
ElementExtensions.ToHandler (IElement view, IMauiContext context) D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:96
ElementExtensions.ToPlatform (IElement view, IMauiContext context) D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:127
ContentViewHandler.UpdateContent (IContentViewHandler handler) D:\a\_work\1\s\src\Core\src\Handlers\ContentView\ContentViewHandler.Android.cs:42
ContentViewHandler.MapContent (IContentViewHandler handler, IContentView page) D:\a\_work\1\s\src\Core\src\Handlers\ContentView\ContentViewHandler.Android.cs:47
PublicKeyToken=null]].<Add>b__0 (IElementHandler h, IElement v) D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:172
PropertyMapper.UpdatePropertyCore (String key, IElementHandler viewHandler, IElement virtualView) D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:47
PropertyMapper.UpdateProperties (IElementHandler viewHandler, IElement virtualView) D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:82
ElementHandler.SetVirtualView (IElement view) D:\a\_work\1\s\src\Core\src\Handlers\Element\ElementHandler.cs:79
PublicKeyToken=null]].SetVirtualView (IView view) D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:53
ContentViewHandler.SetVirtualView (IView view) D:\a\_work\1\s\src\Core\src\Handlers\ContentView\ContentViewHandler.Android.cs:26
PublicKeyToken=null]].SetVirtualView (IElement view) D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:56
Element.SetHandler (IElementHandler newHandler) D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:921
Element.set_Handler (IElementHandler value) D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:863
IElement.set_Handler (IElementHandler value) D:\a\_work\1\s\src\Controls\src\Core\VisualElement\VisualElement.cs:2031
ElementExtensions.ToHandler (IElement view, IMauiContext context) D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:96
ElementExtensions.ToPlatform (IElement view, IMauiContext context) D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:127
MauiContextExtensions.ToPlatform (IView view, IMauiContext fragmentMauiContext, Context context, LayoutInflater layoutInflater, FragmentManager childFragmentManager) D:\a\_work\1\s\src\Core\src\Platform\Android\MauiContextExtensions.cs:96
NavigationViewFragment.OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) D:\a\_work\1\s\src\Core\src\Platform\Android\Navigation\NavigationViewFragment.cs:56
Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_inflater, IntPtr native_container, IntPtr native_savedInstanceState) C:\a\_work\1\s\generated\androidx.fragment.fragment\obj\Release\net6.0-android\generated\src\AndroidX.Fragment.App.Fragment.cs:2031
JNINativeWrapper.Wrap_JniMarshal_PPLLL_L (_JniMarshal_PPLLL_L callback, IntPtr jnienv, IntPtr klazz, IntPtr p0, IntPtr p1, IntPtr p2) /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:367 

The sidedrawer:

<Grid>
        <telerik:RadSideDrawer x:Name="drawer" DrawerLength="250">
            <telerik:RadSideDrawer.MainContent>
                <tools:KeyboardView>
                    <AbsoluteLayout x:Name="mainLayout">
                        <StackLayout x:Name="mainStackLayout" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0, 0, 1, 1" Spacing="0">
                            <StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand" HeightRequest="50">
                                <Grid Style="{StaticResource BottomGrid}" >
                                    <Grid.RowDefinitions>
                                         <RowDefinition Height="50"/>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="70*" />
                                        <ColumnDefinition Width="15*" />
                                        <ColumnDefinition Width="15*" />
                                    </Grid.ColumnDefinitions>
                                    <StackLayout Grid.Row="0" Grid.Column="0" Margin="-10, 0, 0, 0">
                                        <SearchBar x:Name="SearchBox" TextChanged="SearchBox_TextChanged" SearchButtonPressed="SearchBox_SearchButtonPressed" Style="{StaticResource SearchBar}" />
                                    </StackLayout>
                                    <StackLayout Grid.Row="0" Grid.Column="1">
                                        <Button x:Name="BtnTopologies" Grid.Row="0" Grid.Column="1" Style="{StaticResource Icon}" ImageSource="TreeView.png" Clicked="BtnTopologies_Clicked"/>
                                    </StackLayout>
                                    <StackLayout Grid.Row="0" Grid.Column="2">
                                        <Image Source="barcodeBtn.png">
                                            <Image.GestureRecognizers>
                                                <TapGestureRecognizer Tapped="BtnBarcode_Clicked" NumberOfTapsRequired="1" />
                                            </Image.GestureRecognizers>
                                        </Image>
                                    </StackLayout>
                                </Grid>
                            </StackLayout>
                            <StackLayout Orientation="Horizontal">
                                <telerik:RadComboBox x:Name="sortByField" IsClearButtonVisible="False" SelectionChanged="sortByField_SelectionChanged" VerticalOptions="Center" WidthRequest="150" TextColor="{StaticResource LightBlueColor}"/>
                                <Image x:Name="sortingImg" Source="arrow.png">
                                    <Image.GestureRecognizers>
                                        <TapGestureRecognizer Tapped="OrderTapped" NumberOfTapsRequired="1" />
                                    </Image.GestureRecognizers>
                                </Image>
                            </StackLayout>
                            <StackLayout x:Name="listViewDynamic">
 
                            </StackLayout>
                            <telerik:RadListView x:Name="AssetsList" 
                                                             Grid.Row="1"
                                                             SelectionMode="Single" 
                                                             SelectionGesture="Tap"            
                                                             SwipeOffset="50, 0, 50, 0" 
                                                             SwipeThreshold="10"
                                                             HeightRequest="30"
                                                             SelectionChanged="AssetsList_ItemTapped"
                                                             RefreshRequested="AssetsList_RefreshRequested"
                                                             IsPullToRefreshActive="True"
                                                             IsPullToRefreshEnabled="True"
                                                             VerticalOptions="FillAndExpand"
                                                             BackgroundColor="LightGray" >
                                <telerik:RadListView.ItemStyle>
                                    <telerik:ListViewItemStyle BackgroundColor="Transparent"
                                           BorderColor="Transparent"
                                           BorderLocation="None"
                                           BorderWidth="0"/>
                                </telerik:RadListView.ItemStyle>
                                <telerik:RadListView.ItemTemplate >
                                    <DataTemplate>
                                        <telerik:ListViewTemplateCell >
                                            <telerik:ListViewTemplateCell.View>
                                                <telerik:RadBorder BorderColor="#268ecd" Margin="3,6" BorderThickness="0" CornerRadius="18" >
                                                    <StackLayout Orientation="Horizontal" 
                                                                 Style="{StaticResource ListItem}" 
                                                                 VerticalOptions="Start" 
                                                                 Padding="0" 
                                                                 BackgroundColor="White">                                                        
                                                        <StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand" Spacing="0" Padding="10, 15, 0, 15">
                                                            <StackLayout Orientation="Vertical" HorizontalOptions="StartAndExpand" Spacing="5">
                                                                <Label Text="{Binding Code}" Style="{StaticResource ListHeader}" TextColor="{StaticResource BlueColor}" />
                                                                <Label Text="{Binding Description}" Style="{StaticResource ListInfo}" TextColor="{StaticResource LightBlueColor}" />
                                                                <Label MaxLines="2" LineBreakMode="TailTruncation" Text="{Binding FullPath}" Style="{StaticResource ListInfo}" TextColor="{StaticResource LightGreyColor}" />
                                                            </StackLayout>
                                                        </StackLayout>
                                                    </StackLayout>
                                                </telerik:RadBorder>
                                            </telerik:ListViewTemplateCell.View>
                                        </telerik:ListViewTemplateCell>
                                    </DataTemplate>
                                </telerik:RadListView.ItemTemplate>
                            </telerik:RadListView>
                        </StackLayout>
                    </AbsoluteLayout>
                </tools:KeyboardView>
            </telerik:RadSideDrawer.MainContent>
        </telerik:RadSideDrawer>
    </Grid>

 

Ioannis
Top achievements
Rank 1
Iron
 asked on 09 Feb 2024
1 answer
25 views

How to get AutoComplete / filtering functionality for RadComboBox so that the list gets smaller as a user types?

<telerik:RadComboBox x:Name="TankComboBox"
                     IsEditable="True"
                     DisplayMemberPath="TankName"
                     ItemsSource="{Binding TanksObs}"
                     SelectedItem="{Binding SelectedTank, Mode=TwoWay}"
                     TextSearchPath="TankName"
                     Placeholder="Select tank...">
    <telerik:RadComboBox.FilterDescriptors>
        <telerik:FilterDescriptor PropertyName="TankName"
                                  Operator="Contains"
                                  IsCaseSensitive="False"/>
    </telerik:RadComboBox.FilterDescriptors>
</telerik:RadComboBox>
Didi
Telerik team
 answered on 06 Feb 2024
1 answer
18 views

I couldn't figure out how to clean up ListView items after changing the item-source or leaving a page.

Let's take your TemplateCell Example from

https://docs.telerik.com/devtools/maui/controls/listview/cells/template-cell

If i use a custom view instead of the grid it doesn't get a unloaded event or disposed or something else.
This prevents me to do a native view cleanup in my custom view.  Consequently i can't disconnect Handlers resulting in memory leaks.

Am I missing something here? Something in the documentation?
Is there an example?

Didi
Telerik team
 answered on 02 Feb 2024
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?