Telerik Forums
UI for WPF Forum
4 answers
793 views

Hi Guys,

I'm struggling with this issue for a couple of day's now and I assume this is because I'm new to WPF. but I need some help with the following.

I am creating a custom planner, and for this I'm using the radschedular like this

<telerik:RadScheduleView x:Name="MachineplanningScheduleView"
                         ActiveViewDefinitionIndex="{Binding ActiveViewDefinitionIndex, Mode=TwoWay}"                              
                         CurrentDate="{Binding SelectedDate, Mode=TwoWay}"
                         SelectedAppointment="{Binding SelectedAppointment, Mode=TwoWay}"
                         ShowDialog="ShowDialog"
                         AppointmentsSource="{Binding Appointments}"
                         NavigationHeaderVisibility="Collapsed"
                         GroupDescriptionsSource="{Binding GroupDescriptions}"
                         GroupHeaderContentTemplateSelector="{StaticResource GroupHeaderContentTemplateSelector}"
                         ResourceTypesSource="{Binding ResourceTypes}">

The Binding Appointments works perfect and the calender gets updated when appointments get changed.

The ShowDialog function in the codebehind should do some database updates and then update the planning without showing the dialog.
The database updates are going fine, I can cancel the dialog and also I'm able to update the ResourceTypesSource like this

    db.SaveChanges();
 
    RadScheduleView rsv = (RadScheduleView)sender;
    rsv.AppointmentsSource = MachineplanningViewModel.GetCalendarAppointments();
 
    e.Cancel = true;
}
the only problem is, while calling "rsv.AppointmentsSource" I lose my binding on Appointments and the calender doesn't get updated anymore when I switch user.

so my question is, how can I update "Appointments" directly from codebehind so I won't lose my binding.

 

I hope my explanation is clear and someone can help me.

 

Thank you.

Yana
Telerik team
 answered on 20 Sep 2016
5 answers
437 views

Hi,

I'm trying to find reason of memory leak which occurs in data binding to RadTreeView.

In data set there is 270 items, and I checked all DAO methods which are used for retrieving data, and during execution there is no memory increase, in moment

when I fire PropertyChangeNotify memory starts to increase.

Memory increase is about 70MB per each call.

Also, it seems that virtualization doesn't work, because binding of this data takes about 1-2s.

I'll put all relevant xaml files. In first snippet is file where we define RadTreeView, itemssource is HierarchyFolderList which holds individual items.

Next is FolderTemplateSelector... The most complicated is last one in which defined style "SecureItemsListBoxStyle" in which RadDropDownButton is referenced also. It is a lot of code but I wanted to show everything that is related in order to give more details for troubleshooting.

Is there some potential places where memory leak could occur? I tryed to remove some parts of SecureItemsListBoxStyle, but didn' get any success.

<telerik:RadTreeView x:Name="treeView" ItemsSource="{Binding HierarchyFolderList}"
ItemTemplateSelector="{StaticResource FolderTemplateSelector}"  AllowDrop="True" ScrollViewer.HorizontalScrollBarVisibility="Disabled" Margin="5" IsDropPreviewLineEnabled="False" IsVirtualizing="True"  telerik:TreeViewPanel.IsVirtualizing="True"
telerik:AnimationManager.IsAnimationEnabled="False"                              telerik:TreeViewPanel.TreeVirtualizationMode="Hierarchical"   >

<myHelpers:TreeDataTemplateSelector x:Key="FolderTemplateSelector" FolderTemplate="{StaticResource HierarchicalTemplate}" myListTemplate="{StaticResource ListOfItems}"  />
<HierarchicalDataTemplate x:Key="HierarchicalTemplate"
ItemsSource="{Binding ChildList}"  >
<StackPanel Orientation="Horizontal"
Tag="{Binding DataContext.FolderActions, RelativeSource={RelativeSource AncestorType={x:Type telerik:RadTreeView}}}">
<TextBlock FontSize="12" FontWeight="Bold"  Text="{Binding FolderName,Converter={StaticResource StringToUppercase}}" />
<TextBlock FontSize="12" FontWeight="Bold"  Text=" (" />
<TextBlock FontSize="12" FontWeight="Bold"  Text="{Binding Count}" />
<TextBlock FontSize="12" FontWeight="Bold"  Text=")" />
<Image Visibility="{Binding Shared, Converter={StaticResource BoolToVisibility}}"
Margin="5 0"  Grid.Column="4"   Height="12" Style="{DynamicResource SharedIconStyle}"/>
</StackPanel>
</HierarchicalDataTemplate>

 

<DataTemplate x:Key="ListOfItems">
           <StackPanel Orientation="Vertical"
                       Margin="{Binding RelativeSource={RelativeSource AncestorType={x:Type telerik:RadTreeViewItem}},Converter={StaticResource NodeLevelToMargine}}">
                
               <Rectangle Fill="{DynamicResource LightGrayTextForegroundColor}"
                          Height="1"
                          Margin="0 0 0 5"
                          HorizontalAlignment="Stretch" />
                
              <ListBox x:Name="secureItemsList"
                        ItemsSource="{Binding SecureList}"
                        Style="{DynamicResource SecureItemsListBoxStyle}"                       
                        behaviors:ListBoxDragDropBehavior.IsEnabled="True"    helpers:ListBoxSelector.Enabled="False"             
                        helpers:ListBoxHelper.SelectedItems="{Binding SelectedItems,Mode=TwoWay}">
              
               </ListBox>
           </StackPanel>
 
       </DataTemplate>

<Style x:Key="SecureItemsListBoxStyle" TargetType="{x:Type ListBox}" >
        <Setter Property="ContextMenu" Value="{x:Null}" />
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="SelectionMode" Value="Extended"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
        <Setter Property="ItemContainerStyle" Value="{StaticResource SIWithContextMenuListBoxItemStyle}"/>
        <Setter Property="VirtualizingStackPanel.IsVirtualizing" Value="True" />
        <Setter Property="VirtualizingStackPanel.VirtualizationMode" Value="Recycling" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBox}">
                    <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="1" SnapsToDevicePixels="true">
                        <ScrollViewer Focusable="false" Padding="{TemplateBinding Padding}">
                            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding DataContext.IsTileView,RelativeSource={RelativeSource FindAncestor,  AncestorType={x:Type telerik:RadTreeView}}}" Value="True">
                <Setter Property="ItemsPanel">
                    <Setter.Value>
                        <ItemsPanelTemplate >
                            <WrapPanel Orientation="Horizontal" IsItemsHost="True"/>
                        </ItemsPanelTemplate>
                    </Setter.Value>
                </Setter>
            </DataTrigger>
            <DataTrigger Binding="{Binding DataContext.IsTileView,RelativeSource={RelativeSource FindAncestor,  AncestorType={x:Type telerik:RadTreeView}}}" Value="False">
                <Setter Property="ItemsPanel">
                    <Setter.Value>
                        <ItemsPanelTemplate >
                            <VirtualizingStackPanel  />
                        </ItemsPanelTemplate>
                    </Setter.Value>
                </Setter>
            </DataTrigger>
 
             <!--<DataTrigger Binding="{Binding DataContext.IsTileView,RelativeSource={RelativeSource FindAncestor,  AncestorType={x:Type telerik:RadTreeView}}}" Value="True">
                <Setter Property="ItemTemplate" Value="{DynamicResource TileSecureItemTemplate}" />
            </DataTrigger>
            <DataTrigger Binding="{Binding DataContext.IsTileView,RelativeSource={RelativeSource FindAncestor,  AncestorType={x:Type telerik:RadTreeView}}}" Value="False">
                <Setter Property="ItemTemplate" Value="{DynamicResource ListSecureItemTemplate}" />
            </DataTrigger>-->
 
            <DataTrigger Binding="{Binding DataContext.IsTileView,RelativeSource={RelativeSource FindAncestor,  AncestorType={x:Type telerik:RadTreeView}}}" Value="True">
                <Setter Property="ItemTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <Border x:Name="mainBorder" Width="142" BorderBrush="Transparent" BorderThickness="1" Margin="0,0,15,10" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                <Grid  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="75"/>
                                        <RowDefinition MinHeight="23" Height="auto" />
                                    </Grid.RowDefinitions>
                                    <Grid Background="{DynamicResource WhiteColor}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                        <Grid Background="{Binding Background}" Grid.Column="0"  Margin="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  >
                                            <Grid Visibility="{Binding IsWebSiteLogo,Converter={StaticResource InvertedBooleanToVisibility}}">
                                            <Image x:Name="dataImg"  Visibility="{Binding IsDefaultImage,Converter={StaticResource InvertedBooleanToVisibility}}"
                            Source="{Binding Image}" Stretch="Fill" >
                                            </Image>
                                            <Image   MaxHeight="50" VerticalAlignment="Center" Visibility="{Binding IsDefaultImage,Converter={StaticResource BoolToVisibility}}"
                            Source="{Binding Image}" Stretch="Uniform" >
                                            </Image>
                                            </Grid>
                                            <uc:WebSiteLogo Width="50" Height="50" FontSize="22" HorizontalAlignment="Center" VerticalAlignment="Center" RenderTransformOrigin="0.5, 0.5"
                                                        URL="{Binding Name}" Brush="{Binding Background}" Visibility="{Binding IsWebSiteLogo,Converter={StaticResource BoolToVisibility}}"/>
 
                                        </Grid>
 
                                        <Image Margin="1" Visibility="{Binding Favorite, Converter={StaticResource BoolToVisibility}}" HorizontalAlignment="Left" VerticalAlignment="Top"
                            Source="{DynamicResource star_green_21x20}"  Width="17" Height="16"  ToolTip="{DynamicResource Favorite}"/>
 
                                        <Image Margin="1"  Visibility="{Binding Shared, Converter={StaticResource BoolToVisibility}}" Grid.Column="4"  Width="20" Height="16"
                                               Style="{DynamicResource SharedIconStyle}" HorizontalAlignment="Right" VerticalAlignment="Top"/>
                                    </Grid>
 
                                    <Border x:Name="MouseOverBorder" Grid.RowSpan="2" Visibility="Collapsed" Opacity="0.45" Background="{DynamicResource MyAppGreenColor}"/>
 
                                    <TextBlock x:Name="txtName" VerticalAlignment="Top" HorizontalAlignment="Center" Grid.Row="1" Margin="0 5 0 0"
                                Foreground="{DynamicResource LightGrayTextForegroundColor}" TextWrapping="Wrap" TextAlignment="Center"
                                FontSize="10pt" FontWeight="Normal" MaxHeight="36"  LineStackingStrategy="BlockLineHeight" LineHeight="18"
                                FontFamily="{DynamicResource ProximaRegular}" Text="{Binding Name}" />
 
                                    <StackPanel x:Name="MouseOverPanel"  Visibility="Collapsed" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0 25 0 0">
 
                                        <telerik:RadDropDownButton x:Name="settingsButton" Style="{DynamicResource RadDropDownButtonWithArowStyle}"
                                                   Grid.Column="1"  Margin="12 0" IsOpen="{Binding ShowItemMenu,Mode=TwoWay}"
                           BorderThickness="0">
                                            <telerik:RadDropDownButton.Content>
                                                <Image Height="35" Width="35"  ContextMenu="{x:Null}" VerticalAlignment="Center" RenderOptions.BitmapScalingMode="HighQuality">
                                                    <Image.Style>
                                                        <Style TargetType="{x:Type Image}">
                                                            <Setter Property="Source" Value="{DynamicResource menu_green}"/>
                                                            <Style.Triggers>
                                                                <Trigger Property="IsMouseOver" Value="True">
                                                                    <Setter Property="Source" Value="{DynamicResource menu_white}"/>
                                                                </Trigger>
                                                            </Style.Triggers>
                                                        </Style>
                                                    </Image.Style>
                                                </Image>
                                            </telerik:RadDropDownButton.Content>
                                            <telerik:RadDropDownButton.DropDownContent>
                                                <ListBox ItemsSource="{Binding Actions}"
                                                         ItemContainerStyle="{DynamicResource SecureItemsListBoxItemStyle}" 
                                                         BorderThickness="0" >
                                                    <ListBox.ItemTemplate>
                                                        <DataTemplate>
                                                            <telerik:RadMenuItem Style="{DynamicResource RadMenuItemStyle}" Width="200"/>
                                                        </DataTemplate>
                                                    </ListBox.ItemTemplate>
                                                </ListBox>
                                            </telerik:RadDropDownButton.DropDownContent>
                                        </telerik:RadDropDownButton>
 
                                        <Border   Margin="12 0" VerticalAlignment="Center" HorizontalAlignment="Center"
                           RenderOptions.BitmapScalingMode="HighQuality" Background="Transparent" Visibility="{Binding IsWebSite,Converter={StaticResource BoolToVisibility}}"
                           BorderThickness="0" Tag="{Binding DataContext,RelativeSource={RelativeSource Mode=Self}}">
                                            <Image Height="41" Width="41" VerticalAlignment="Center" RenderOptions.BitmapScalingMode="HighQuality">
                                                <Image.Style>
                                                    <Style TargetType="{x:Type Image}">
                                                        <Setter Property="Source" Value="{DynamicResource open_site_green}"/>
                                                        <Style.Triggers>
                                                            <Trigger Property="IsMouseOver" Value="True">
                                                                <Setter Property="Source" Value="{DynamicResource open_site_white}"/>
                                                            </Trigger>
                                                        </Style.Triggers>
                                                    </Style>
                                                </Image.Style>
                                            </Image>
                                            <Border.InputBindings>
                                                <MouseBinding MouseAction="LeftClick" Command="{Binding DoubleClickCommand}" />
                                            </Border.InputBindings>
                                        </Border>
                                    </StackPanel>
                                </Grid>
                                <Border.InputBindings>
                                    <MouseBinding MouseAction="LeftDoubleClick" Command="{Binding DoubleClickCommand}" />
                                </Border.InputBindings>
                            </Border>
                            <DataTemplate.Triggers>
                                <DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}, Mode=FindAncestor}}" Value="True">
                                    <Setter TargetName="mainBorder" Property="BorderBrush" Value="{DynamicResource MyAppGreenColor}"/>
                                    <Setter TargetName="mainBorder" Property="BorderThickness" Value="1"/>
                                </DataTrigger>
                                <Trigger Property="Border.IsMouseOver" Value="True">
                                    <Setter TargetName="MouseOverPanel" Property="Visibility" Value="Visible"/>
                                    <Setter TargetName="MouseOverBorder" Property="Visibility" Value="Visible"/>
                                    <Setter TargetName="txtName" Property="Foreground" Value="White"/>
                                </Trigger>
                            </DataTemplate.Triggers>
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
            </DataTrigger>
            <DataTrigger Binding="{Binding DataContext.IsTileView,RelativeSource={RelativeSource FindAncestor,  AncestorType={x:Type telerik:RadTreeView}}}" Value="False">
                <Setter Property="ItemTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <Border x:Name="mainBorder" Margin="0" Padding="5 0 14 0" Height="51"  BorderThickness="1" BorderBrush="Transparent"
                CornerRadius="2" Background="{DynamicResource WhiteColor}" HorizontalAlignment="Stretch">
                                <Grid x:Name="gridlist" ContextMenu="{x:Null}"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch"     Background="{DynamicResource WhiteColor}" UseLayoutRounding="True">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="auto"/>
                                        <ColumnDefinition Width="auto" />
                                        <ColumnDefinition MinWidth="280" Width="*"/>
                                        <ColumnDefinition Width="130"/>
                                        <ColumnDefinition Width="50"/>
                                        <ColumnDefinition  Width="50"/>
                                        <ColumnDefinition  Width="50"/>
                                        <ColumnDefinition  Width="50"/>
                                    </Grid.ColumnDefinitions>
 
                                    <Grid Background="{Binding Background}" Grid.Column="0"  Margin="0 0 12 0" HorizontalAlignment="Center" Width="90" Height="45"  VerticalAlignment="Center">
                                        <Grid Visibility="{Binding IsWebSiteLogo,Converter={StaticResource InvertedBooleanToVisibility}}">
                                        <Image x:Name="dataImg"  Visibility="{Binding IsDefaultImage,Converter={StaticResource InvertedBooleanToVisibility}}"
                            Source="{Binding Image}" Stretch="Fill" >
                                        </Image>
                                        <Image   MaxHeight="35" Width="90" Visibility="{Binding IsDefaultImage,Converter={StaticResource BoolToVisibility}}"
                            Source="{Binding Image}" Stretch="Uniform" VerticalAlignment="Center" >
                                        </Image>
                                        </Grid>
                                        <uc:WebSiteLogo Width="35" Height="35" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center" RenderTransformOrigin="0.5, 0.5"
                                                        URL="{Binding Name}" Brush="{Binding Background}" Visibility="{Binding IsWebSiteLogo,Converter={StaticResource BoolToVisibility}}"/>
 
 
                                    </Grid>
                                    <telerik:RadDropDownButton x:Name="settingsButton" Style="{DynamicResource RadDropDownButtonWithArowStyle}" Grid.Column="1" Height="30" Width="30" Margin="12 0" VerticalAlignment="Center" HorizontalAlignment="Center"
                           RenderOptions.BitmapScalingMode="HighQuality" Visibility="Hidden" Background="Transparent"
                           BorderThickness="0" IsOpen="{Binding ShowItemMenu,Mode=TwoWay}">
                                        <telerik:RadDropDownButton.Content>
                                            <Image Height="30" Width="30"  ContextMenu="{x:Null}" VerticalAlignment="Center" RenderOptions.BitmapScalingMode="HighQuality">
                                                <Image.Style>
                                                    <Style TargetType="{x:Type Image}">
                                                        <Setter Property="Source" Value="{DynamicResource menu_grey}"/>
                                                        <Style.Triggers>
                                                            <Trigger Property="IsMouseOver" Value="True">
                                                                <Setter Property="Source" Value="{DynamicResource menu_green}"/>
                                                            </Trigger>
                                                        </Style.Triggers>
                                                    </Style>
                                                </Image.Style>
                                            </Image>
                                        </telerik:RadDropDownButton.Content>
                                        <telerik:RadDropDownButton.DropDownContent>
                                            <ListBox ItemsSource="{Binding Actions}"             ItemContainerStyle="{DynamicResource SecureItemsListBoxItemStyle}"  BorderThickness="0" >
                                                <ListBox.ItemTemplate>
                                                    <DataTemplate>
                                                        <telerik:RadMenuItem  HorizontalAlignment="Stretch" />
                                                    </DataTemplate>
                                                </ListBox.ItemTemplate>
                                            </ListBox>
                                        </telerik:RadDropDownButton.DropDownContent>
                                    </telerik:RadDropDownButton>
                                    <!--</Border>-->
 
                                    <StackPanel x:Name="LeftPartOfItemGrid" Grid.Column="2" Background="Transparent" VerticalAlignment="Center" Margin="0 0 12 0" >
 
                                        <Grid Margin="3 0 0 0">
                                            <TextBlock x:Name="dataTb" HorizontalAlignment="Left" Width="260"
                                Foreground="{DynamicResource MyAppBlackBackgroundColor}" TextWrapping="Wrap" TextAlignment="Left"
                                Padding="0,0,0,0" VerticalAlignment="Bottom" FontSize="11pt" FontWeight="Bold"
                                FontFamily="{DynamicResource ProximaRegular}" Text="{Binding Name}" />
                                            <TextBox x:Name="editDataTb" HorizontalAlignment="Left" Width="260" Margin="-4 0 0 0"
                                Foreground="{DynamicResource MyAppBlackBackgroundColor}" TextWrapping="Wrap" TextAlignment="Left" Style="{DynamicResource TextBoxTemplate}" Grid.RowSpan="2"
                                Padding="0" VerticalAlignment="Bottom" FontSize="11pt" FontWeight="Bold"
                                FontFamily="{DynamicResource ProximaRegular}" Text="{Binding Name,Mode=TwoWay, UpdateSourceTrigger=LostFocus}" Visibility="Collapsed" >
                                                <i:Interaction.Triggers>
                                                    <i:EventTrigger EventName="LostFocus">
                                                        <i:InvokeCommandAction  Command="{Binding Path=NameLostFocusCommand}" />
                                                    </i:EventTrigger>
                                                </i:Interaction.Triggers>
                                            </TextBox>
                                        </Grid>
                                        <TextBlock x:Name="UsernameTextBlock" HorizontalAlignment="Left" TextAlignment="Left" Margin="3 2 0 0"
                            Foreground="{DynamicResource LightGrayTextForegroundColor}" Grid.Column="0" Grid.Row="2"
                            Padding="0,0,0,0" VerticalAlignment="Top" FontSize="10pt" FontWeight="Normal"   TextWrapping="Wrap"
                            FontFamily="{DynamicResource ProximaRegular}" Text="{Binding ListViewSecondName}" />
 
                                    </StackPanel>
 
                                    <Grid x:Name="lastUsedGrid"  HorizontalAlignment="Left" Grid.Column="3" Margin="0 0 12 0" Background="Transparent" Visibility="Collapsed" >
                                        <StackPanel VerticalAlignment="Center" Visibility="{Binding ShowLastModifiedDate,Converter={StaticResource InvertedBooleanToVisibility}}">
 
                                            <TextBlock HorizontalAlignment="Left" Visibility="{Binding IsWebSite,Converter={StaticResource BoolToVisibility}}" Foreground="{DynamicResource MyAppBlackBackgroundColor}" TextWrapping="Wrap" TextAlignment="Left"
                                Padding="0,0,0,0" VerticalAlignment="Bottom" FontSize="10pt" FontWeight="Thin"
                                FontFamily="{DynamicResource ProximaRegular}" Text="{DynamicResource LastUsedAndroidSort}" />
 
 
 
                                            <TextBlock  Visibility="{Binding IsWebSite,Converter={StaticResource BoolToVisibility}}" HorizontalAlignment="Left" TextAlignment="Left"
                            Foreground="{DynamicResource LightGrayTextForegroundColor}" Grid.Column="0" Grid.Row="2" 
                            Padding="0,2,0,0" VerticalAlignment="Top" FontSize="10pt" TextWrapping="Wrap" FontWeight="Thin"
                            FontFamily="{DynamicResource ProximaRegular}" Text="{Binding LastAcceessTime}" />
 
                                        </StackPanel>
                                        <StackPanel VerticalAlignment="Center"  Visibility="{Binding ShowLastModifiedDate,Converter={StaticResource BoolToVisibility}}">
 
                                            <TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource MyAppBlackBackgroundColor}" TextWrapping="Wrap" TextAlignment="Left"
                                Padding="0,0,0,0" VerticalAlignment="Bottom" FontSize="10pt" FontWeight="Thin"
                                FontFamily="{DynamicResource ProximaRegular}" Text="{DynamicResource MenuLastModified}" />
 
                                            <TextBlock
                       HorizontalAlignment="Left" TextAlignment="Left"
                            Foreground="{DynamicResource LightGrayTextForegroundColor}" Grid.Column="0" Grid.Row="2" 
                            Padding="0,2,0,0" VerticalAlignment="Top" FontSize="10pt" TextWrapping="Wrap" FontWeight="Thin"
                            FontFamily="{DynamicResource ProximaRegular}" Text="{Binding LastModifiedDate,StringFormat='{}{0:MMM yyyy}'}" />
                                        </StackPanel>
                                    </Grid>
 
 
                                    <Image Visibility="{Binding Shared, Converter={StaticResource BoolToVisibility}}" x:Name="listBoxShare"  Margin="12 0"  Grid.Column="4"  Width="22" Height="18"
                                           Style="{DynamicResource SharedIconStyle}"/>
                                    <Image  Visibility="{Binding Favorite, Converter={StaticResource BoolToVisibility}}" Grid.Column="5" Margin="12 0" x:Name="favoritesGridImage" Source="{DynamicResource star_green_21x20}"  Width="21" Height="20" VerticalAlignment="Center" HorizontalAlignment="Center"  ToolTip="{DynamicResource Favorite}"/>
                                    <Image Visibility="{Binding HasNote, Converter={StaticResource BoolToVisibility}}" x:Name="notesGridImage" Margin="12 0"  Grid.Column="6"  ToolTip="{DynamicResource Notes}" Source="{DynamicResource imgNotes}" Width="17" Height="20" />
 
                                    <Border x:Name="DeleteImageBorder" Visibility="Hidden" Margin="12 -1 12 0" Grid.Column="7" Background="Transparent" Cursor="Hand">
                                        <Border Height="26" Width="26" BorderBrush="{DynamicResource LightGrayTextForegroundColor}" >
                                            <i:Interaction.Triggers>
                                                <i:EventTrigger EventName="MouseLeftButtonUp">
                                                    <i:InvokeCommandAction Command="{Binding DeleteItemCommand}" CommandParameter="{Binding Id}" />
                                                </i:EventTrigger>
                                            </i:Interaction.Triggers>
                                            <Border.Style>
                                                <Style>
                                                    <Setter Property="Border.BorderThickness" Value="0"/>
                                                    <Style.Triggers>
                                                        <Trigger Property="Border.IsMouseOver" Value="True">
                                                            <Setter Property="Border.BorderThickness" Value="1"/>
                                                        </Trigger>
                                                    </Style.Triggers>
                                                </Style>
                                            </Border.Style>
                                            <Image HorizontalAlignment="Center" VerticalAlignment="Center" Height="20" Width="20" Source="{DynamicResource imgTrashMedium}" RenderOptions.BitmapScalingMode="HighQuality"  ToolTip="{DynamicResource Delete}" />
                                        </Border>
                                    </Border>
                                </Grid>
                                <Border.InputBindings>
                                    <MouseBinding MouseAction="LeftDoubleClick" Command="{Binding DoubleClickCommand}" />
                                </Border.InputBindings>
                            </Border>
                            <DataTemplate.Triggers>
                                <DataTrigger Binding="{Binding IsMouseOver, ElementName=mainBorder}" Value="True">
                                    <Setter Property="Visibility" TargetName="settingsButton" Value="Visible"/>
                                    <Setter Property="Visibility" TargetName="DeleteImageBorder" Value="Visible" />
                                    <Setter Property="Visibility" TargetName="settingsButton" Value="Visible" />
                                    <Setter Property="Visibility" TargetName="lastUsedGrid" Value="Visible" />
                                    <Setter Property="Border.BorderBrush" TargetName="mainBorder"  Value="{DynamicResource MyAppGreenColor}" />
                                </DataTrigger>
                                <DataTrigger Binding="{Binding IsMouseOver, ElementName=dataTb}" Value="True">
                                    <Setter Property="Visibility" TargetName="editDataTb" Value="Visible"/>
                                    <Setter Property="Visibility" TargetName="dataTb" Value="Collapsed"/>
                                </DataTrigger>
                                <DataTrigger Binding="{Binding IsMouseOver, ElementName=editDataTb}" Value="True">
                                    <Setter Property="Visibility" TargetName="dataTb" Value="Collapsed"/>
                                    <Setter Property="Visibility" TargetName="editDataTb" Value="Visible"/>
                                </DataTrigger>
                                <DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}, Mode=FindAncestor}}" Value="True">
                                    <Setter TargetName="mainBorder" Property="BorderBrush" Value="{DynamicResource MyAppGreenColor}"/>
                                    <Setter TargetName="mainBorder" Property="BorderThickness" Value="1"/>
                                </DataTrigger>
                            </DataTemplate.Triggers>
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
            </DataTrigger>
        </Style.Triggers>
   
    </Style>
Petar Mladenov
Telerik team
 answered on 19 Sep 2016
1 answer
1.6K+ views

Hi,

    I am trying to bind dictionary object to ListBoxControl as shown below

         <telerik:RadListBox ItemsSource="{Binding Path=BooksAvailable}" Height="270">
            <telerik:RadListBox.ItemTemplate>
                <DataTemplate>
                <StackPanel Orientation="Horizontal">
                    <CheckBox IsChecked="{Binding Path=Value}"
                       Width="20" />
                    <TextBlock Text="{Binding Path=Key}"
                       Width="100" />
                </StackPanel>
                </DataTemplate>
            </telerik:RadListBox.ItemTemplate>
        </telerik:RadListBox>

      I want to do two way binding of the values so that if user unchecked I have to update internal Boolean value property.But it is giving exception two way binding can't be possible with dictionary value.

Please help to resolve this.

 

Regards,

Nagasree.

Polya
Telerik team
 answered on 19 Sep 2016
1 answer
511 views
Is there any way to implement Excel-style "Delete" key behavior for selected cells in RadGridView? I want the Delete key to clear the selected cell's contents, setting the underlying data-bound property value to null or whatever the default value of the databound type is.
I haven't been able to find any info on whether this is possible-- somebody posted a related issue in 2010 (http://www.telerik.com/forums/cleaar-the-cell-content-at-runtime) but it does not appear to have been resolved.
Could someone please help me implement this behavior? I'm currently trying to override the delete key in a custom KeyboardCommandProvider but none of the RadGridViewCommand options do what I want.
Dilyan Traykov
Telerik team
 answered on 19 Sep 2016
1 answer
161 views

Hey telerik,

 

My grid's external spinner (RadBusyIndicator) won't work when grouping the grid. It works only when loading data.

Here is some sample code illustrating my scenario:

<telerik:RadBusyIndicator Name="busyIndicator" IsBusy="True" DisplayAfter="0">
           <telerik:RadGridView Name="RadGridView"  ItemsSource="{Binding View}" IsReadOnly="True" Style="{StaticResource VitorStyle}"  AutoGenerateColumns="False">

private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ((ViewModel)DataContext).Load(complete);
            var view = (DataContext as ViewModel).View;
            view.ItemsLoading += View_ItemsLoading;
            view.ItemsLoaded += View_ItemsLoaded;
 
 
            //the spinner wont work for the grouping.
            //this.RadGridView.Grouping += RadGridView_Grouping;
            //this.RadGridView.Grouped += RadGridView_Grouped;
            //this.RadGridView.GroupRowIsExpandedChanging += RadGridView_GroupRowIsExpandedChanging;
            //this.RadGridView.GroupRowIsExpandedChanged += RadGridView_GroupRowIsExpandedChanged;
        }
        //private void RadGridView_GroupRowIsExpandedChanged(object sender, Telerik.Windows.Controls.GridView.GroupRowEventArgs e)
        //{
        //    this.busyIndicator.IsBusy = false;
        //}
 
 
        //private void RadGridView_GroupRowIsExpandedChanging(object sender, Telerik.Windows.Controls.GridView.GroupRowCancelEventArgs e)
        //{
        //    this.busyIndicator.IsBusy = true;
        //}
 
 
        //private void RadGridView_Grouped(object sender, GridViewGroupedEventArgs e)
        //{
        //    this.busyIndicator.IsBusy = false;
        //}
 
 
        //private void RadGridView_Grouping(object sender, GridViewGroupingEventArgs e)
        //{
        //    this.busyIndicator.IsBusy = true;
        //}
 
 
        //B)
        private void View_ItemsLoading(object sender, VirtualQueryableCollectionViewItemsLoadingEventArgs e)
        {
            this.busyIndicator.IsBusy = true;
        }
 
        private void View_ItemsLoaded(object sender, VirtualQueryableCollectionViewItemsLoadedEventArgs e)
        {
            this.busyIndicator.IsBusy = false;
        }

public class ViewModel
{
    public VirtualQueryableCollectionView View { get; set; }
    Controller controller;
 
    public ViewModel()
    {
        controller = new Controller();
    }
    public void Load(bool complete)
    {
        //G the virtual queryable collection. this is the Key Class telerik grid needs to perform the Infinite scrolling. or virtualization.
        View = new VirtualQueryableCollectionView(controller.GetList(complete)) { LoadSize = 10 };
    }
 }

 

This spinning issue has been troubling me for quite some time by now.

It won't show on grouping, sorting and filtering.

 

please send a light

 

Thank you!

Stefan Nenchev
Telerik team
 answered on 19 Sep 2016
3 answers
100 views

Hi,

I'm creating RibbonView with an ApplicationMenu, I have several items, and it structured in 2 levels.

The 2nd level can has a lot of voice, these voices exeeds over ApplicationMenu area.

I tryed to value ApplicationMenu.Content with Grid sized, but ApplicationMenu area does not expand.

How should I go about doing this?

 

Dario Concilio
Top achievements
Rank 2
 answered on 19 Sep 2016
2 answers
229 views

Hi to all,

I create a docking, when add new usercontrol, I insert a new RadPane that contains the usercontrol selected, ok.

After I add other one usercontrol, docking activates my last usercontrol, ok.

In my 2nd usercontrol I have gridview, apply filter by filtersearch.

Click on 1st usercontrol (first radpaneheader),

after that, click again on 2nd, my filter is cleared, and gridview reload all data.

Can I disable this behavior?

 

 

Dario Concilio
Top achievements
Rank 2
 answered on 19 Sep 2016
3 answers
86 views

I am currently upgrading our customer Aplication from Telerik UI for WPF version 2010.3.1314 to Telerik UI for WPF version 2016.2.613

Currently I am upgrading RadScheduler to RadScheduleView in XAML file.

  • ViewMode="Day"
    ===> ActiveViewDefinitionIndex="0"
    <telerik:RadScheduleView.ViewDefinitions>
        <telerik:DayViewDefinition/>
        <telerik:MonthViewDefinition/>
        <telerik:WeekViewDefinition/>
        <telerik:TimelineViewDefinition/>
    </telerik:RadScheduleView.ViewDefinitions>
  • AppointmentTemplate="{StaticResource AppointmentTemplate}"
    ===> AppointmentItemContentTemplate="{StaticResource AppointmentTemplate}"
  • SelectedViewStartDateChanged="_RadScheduler_SelectedViewStartDateChanged"
    ===> VisibleRangeChanged="_RadScheduler_SelectedViewStartDateChanged"
  • SelectedTimeSlot="{Binding Path=SelectedTimeSlot,Mode=TwoWay}"
    ===> SelectedSlot="{Binding Path=SelectedTimeSlot,Mode=TwoWay}"
  • IsReadOnly="True"
    ===> SpecialSlotsSource="{Binding EventSlots}"
  • IsViewModeNavigationEnabled="True"
    ===> NavigationHeaderVisibility="Collapsed"
  • MonthViewScrollBarVisibility="Collapsed"
    ===> ???
  • CalendarVisibility="Visible"
    ===>???
  • DisplayEmptyGroup="False"
    ===><telerik:RadScheduleView.GroupDescriptionsSource ShowNullGroup="False">
            <telerik:GroupDescriptionCollection />
            </telerik:RadScheduleView.GroupDescriptionsSource>
  • ActiveViewDefinitionChanged="_RadScheduler_ActiveViewDefinitionChanged"
    ===>AppointmentSelectionChanged ="_RadScheduler_ActiveViewDefinitionChanged"
  • TimeSlotTemplateSelector="{StaticResource SelectTemplate}"
    ===>AppointmentItemContentTemplateSelector="{StaticResource SelectTemplate}"

I cannot run the program yet because of a large number line of code in project.

Please help me to review my modify source code, expecialy how to migrate MonthViewScrollBarVisibility="Collapsed" and  alendarVisibility="Visible". 

Thanks,Liem.

Yana
Telerik team
 answered on 19 Sep 2016
7 answers
253 views

Hi,

RadGridView behavior after update/insert row is different between NewRowPosition="Top" and NewRowPosition="Bottom".
When position is defined "top", after saving the scroll is on the same position as before saving. However, when the position is defined "Bottom", after saving it scrolls to top.
Workaround with ScrollIntoView() is not useful in my case, because I may have many rows updated.
How can I achieve the same behaviour as NewRowPosition="Top" after saving?

Thanks

Lynda Golomb
Top achievements
Rank 1
 answered on 18 Sep 2016
9 answers
2.2K+ views
How I can programmatically clear all filters that have been manually set using the built in 'column' filters?
I want to add a 'CLEAR FILTERS' button.
thx again
John
Top achievements
Rank 1
Iron
Iron
 answered on 16 Sep 2016
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?