Telerik Forums
UI for WPF Forum
5 answers
158 views

Hi,

I want to show my user control Editor  as complete row in the property grid without display name column in the row. In the attached image I have shown what I am getting now. I want to show only Color editor once we open color group with out showing again color as display name in the row.How to achieve it?? 

 

Stefan
Telerik team
 answered on 20 Sep 2016
3 answers
172 views

Hi,

   I have WPF Form which has to be invoked as editor from RadPropertyGrid and here another difficult thing is I have to send input to the constructor of this form.In winform using UITypeEditor inherited class we have created another editor and used it.But in RadPropertyGrid how to achieve this??

 

Regards,

Nagasree.

Dilyan Traykov
Telerik team
 answered on 20 Sep 2016
1 answer
238 views

Hi, 

   I have to customize the modal dialog shown when propertygrid editor attribute editor style value is 'Modal'. I don't want to show user Minimize and Maximize buttons of the window,I don't want to allow user to resize the dialog.I want to show form name  and Icon for the form of my own.

How to achieve this??

Regards,

Nagasree.

Dilyan Traykov
Telerik team
 answered on 20 Sep 2016
1 answer
146 views

I use ColumnGroupDescriptor to group the GrieView 

<telerik:RadGridView.GroupDescriptors>
                <telerik:ColumnGroupDescriptor x:Name="columnGroupDescriptor" Column="{Binding Columns[\ContactTitleWithConverter\], ElementName=ESColumnGrid}"  SortDirection="Descending"/>
</telerik:RadGridView.GroupDescriptors>

the group sort  is according to the binding field  Ascending or Descending  

but my group is constant  for example   a,b,c  

Is any way to manual  sort the group for example as b c a

Stefan
Telerik team
 answered on 20 Sep 2016
15 answers
468 views
In my project some properties of my item could not be set in usual way. these are complicated types which have to set in a customized popup window. this behavior simply could be done by UI Type Editors in .net but it seems the radpropertygrid does not support the EditorAttribute's Component Model. This is exactly what I'm looking for but I couldn't find any similar approach for wpf and rad controls after hours of searching. I appreciate it if someone give me a hint.

Thanks in Advance
Dilyan Traykov
Telerik team
 answered on 20 Sep 2016
1 answer
175 views

I've got a series of DataFormDataFields, and I want the text within one of the boxes (if generated) to call a function if it's clicked once. When I attempt to style the text, I lose the textbox itself. All I want is for the DataMemberBinding to be blue and have an underline so it looks like a hyperlink almost. Here's what I'm trying:

 

<telerik:DataFormDataField  x:Name="Number"
                                                Label="Number"
                                                LabelPosition="Above"
                                                Foreground="{DynamicResource StandardForeground}"
                                                Grid.Row="1"
                                                Margin="0"
                                                IsReadOnly="True"
                                                Mode="ReadOnly"
                                                Padding="2"
                                                DataMemberBinding="{Binding DataContext.Number, Mode=OneWay, RelativeSource={RelativeSource AncestorType=UserControl}, UpdateSourceTrigger=PropertyChanged}" Template="{DynamicResource HyperlinkNumber}"/>
 
 
            <ControlTemplate x:Key="HyperlinkNumber" TargetType="{x:Type telerik:DataFormDataField}">
   <Grid x:Name="PART_DataFormDataFieldGrid" Margin="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition/>
   <RowDefinition/>
                </Grid.RowDefinitions>
 
                <ContentControl x:Name="PART_Label" Grid.Row="0" Grid.Column="0" Content="Number" Foreground="{DynamicResource StandardForeground}"  Margin="5,0,0,2"/>
<ContentControl x:Name="PART_FieldsContentPresenter" Grid.Row="1" Grid.Column="0" Content="{Binding DataContext.Number, Mode=OneWay, RelativeSource={RelativeSource AncestorType=UserControl}, UpdateSourceTrigger=PropertyChanged}" Margin="2" Foreground="Blue"/>
    </Grid>
            </ControlTemplate>

 

Once I hit this point, the textbox looking element disappears so I haven't even tried getting the underline or making the element clickable. Is there some additional content control that will make the box appear? Thanks.

Stefan
Telerik team
 answered on 20 Sep 2016
3 answers
192 views

When one or more rows are selected in a RadGridView, their cell backgrounds change to (by default) a pale orange color, with gradation I think.  But, when this happens, the backgrounds of those cells of the selected rows that are in GridViewCheckBoxColumns remain white.  I want to show the row selection color in the GridViewCheckBoxColumn cells, to make them consistent with the other cells in the selected rows.

I think the problem is that the embedded CheckBox completely fills the cell, obscuring the cell background proper.  If that is the case, then perhaps a solution would be to set the CheckBox's own background to transparent, so that the underlying cell color changes (when the row is selected and deselected) would be visible. 

If all that is true, then what I specifically want to know is how to set the background color of the embedded CheckBox in every cell of every GridViewCheckBoxColumn in the grid to transparent when the grid is shown.

Stefan Nenchev
Telerik team
 answered on 20 Sep 2016
4 answers
735 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
388 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.5K+ 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?