Telerik Forums
UI for WPF Forum
3 answers
128 views
If i try to add one new element to the RadGridView with filter set for one or more columns and defaults for new item correspond to filtered elements , the new element isn't diplayed and can't be edited ....
There is a way to edit new item with filters activated ?

Thanks in advance
Florian
Top achievements
Rank 1
 answered on 02 Mar 2012
1 answer
94 views
Hi.

<

telerik:RadGridView.RowDetailsTemplate>

<DataTemplate>

     <telerik:RadGridView Margin="4,5,5,4" ShowColumnFooters="False" ShowGroupPanel="False" AutoGenerateColumns="False" ShowInsertRow="False" ItemsSource="{Binding IoTerminals}">

     <telerik:RadGridView.Columns>

         <telerik:GridViewDataColumn Header="Name" DataMemberBinding="{Binding Name}"/>

        <telerik:GridViewCheckBoxColumn Header="Simulated" DataMemberBinding="{Binding Simulated}"/>

         <telerik:GridViewCheckBoxColumn Header="Sim is possible" DataMemberBinding="{Binding SimPossible}" />

    </telerik:RadGridView.Columns>

    </telerik:RadGridView>

</DataTemplate>

</telerik:RadGridView.RowDetailsTemplate>

(Edit: I have made two edits on this post to try to make the above xaml look approachable, but to little avail)

The two Checkbox columns shows up empty. In the debugger I see that the property "SimPossible" is executed correctly and that it return "true". The "Name" column shows the correct value (boolean True).
If I change AutoGenerateColumns to True, then the additional generated columns shows correct value (and checked status).
No binding error is displayed in the debugger output window.

Is there any further parameterization necessary to map boolean "True" to display checked status? Do I need a value converter?

As you can see, this is in the rowdetails section of another GridView (in case that is relevant).

(New Info : Replacing the GridViewCheckBoxColumn with regular GridViewDataColumn is displayed correctly)

I use Q1 2012.

 

Dimitrina
Telerik team
 answered on 02 Mar 2012
0 answers
112 views
I am using RadTreeListView control to display data as a hierarchical view. I am binding my entity collection to the control using ItemSource, and my entity collection is of type ObservableCollection<T>. Whenever some data is changed in the source collection, i am performing an ItemSource again on the control. This is leading to losing all the expand/collapse state of the control. Thats is, as soon as I bind the new data (ItemSource), it updated the data but closes the expand/collapse state. How can I maintain the expand/collapse state of control even after ItemSource.
Bhaskar Khaund
Top achievements
Rank 1
 asked on 02 Mar 2012
0 answers
123 views
Hello,

I have a radgridview which i have bind to an ObservableCollection<objects>.
Now i want to insert a new row. I Have the following columns - Countryid | CountryName | Currency.

For the countryid and name i just type in some value in the cell...as for the Currency...i get the value from lookup.

When i double click on the cell Currency - i have a Search screen from which i select the currency.

Now the issue is that on closing the search screen , i can't return the value to the cell Currency.

Does anyone know how we can do this ?
i was trying to set the value of current cell but it did nt work.
gvcountries.Currentcell.Value = "text";

Please giv some hints on how i could tackle this.

Regards
Shaimaa
Shaimaa
Top achievements
Rank 1
 asked on 02 Mar 2012
4 answers
288 views
When binding the RadListBox, the list items have a gray foreground color on load. It is only until I mouse over each item that they turn to black. After the mouse over it is working fine.

My Listbox is:
<telerik:RadListBox x:Name="lb1" Width="116" HorizontalAlignment="Left" IsEnabled="True" telerik:StyleManager.Theme="Windows7" ItemsSource="{Binding}">
               <telerik:RadListBox.ItemTemplate>
                   <StaticResource ResourceKey="Template1"/>
               </telerik:RadListBox.ItemTemplate>
           </telerik:RadListBox>

DataTemplate:
<Grid.Resources>
                <DataTemplate x:Key="Template1">
                    <WrapPanel>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" Text="{Binding Path=A1}"/>
                            <TextBlock Grid.Column="1" Text="{Binding Path=B1}" Margin="4,0,0,0"/>
                        </Grid>
                    </WrapPanel>
                </DataTemplate>
            </Grid.Resources>

Boyan
Telerik team
 answered on 02 Mar 2012
4 answers
96 views
Hey,

Was labbing some this morning and i come over this.

   <telerik:GridViewDataColumn Header="LogistikID" DataMemberBinding="{Binding nOrderID}" />
   <telerik:GridViewDataColumn Header="Namn" DataMemberBinding="{Binding strDisplayName}"/>
   <telerik:GridViewDataColumn Header="CareOf" DataMemberBinding="{Binding strCareOf}"/>
   <telerik:GridViewDataColumn Header="Gata" DataMemberBinding="{Binding strAddress}"/>
   <telerik:GridViewDataColumn Header="" />


If i leave one column not binded the Gridview lags like hell.

Im pretty sure i have to bind them all because i use GridViewDataColumn, but is it realy gonna lag so bad?

If i leave it empty, Shouldn't it just be ignored?

If i bind the last GridViewDataColumn it's lag free while scrolling/filtering.

Bug or Feature? 

/Joachim
Joachim Karlsson
Top achievements
Rank 1
 answered on 02 Mar 2012
2 answers
114 views
http://www.telerik.com/community/forums/wpf/gridview/filtered-records-list.aspx

I found an old forum thread describing the problem, but its from 2009.

Within a DataTemplate I have GridView.
Within the same datatemplate I have a button where I want to do a bulk operation on the filtered set of items.
The datacontext of the DataTemplate is an INotifyPropertyChanged derived object, which provides the GridView ItemsSource.

How do I, when handling the button click, obtain the list of filtered items back from the RadGridView?

The DataTemplate is hosted within the body of a data driven RadTabControl, if it matters.
Tormod
Top achievements
Rank 1
 answered on 02 Mar 2012
2 answers
236 views
Dear Telerik team,

i'm using a RadScheduleView Control, with Appointment Templates as used in your examples/demos (works great).
Now i want to extend the show duration of a tooltip from an appointment.

Per default it's set to 5-6 seconds, but i need it at least for 20 seconds.

I read in your forum that this can be done by setting the ToolStipService ShowDuration

eg.:
ToolTipService.ShowDuration="20000"

I tried to set his in the control template of the "root" Grid, but it doesn't work.
Can you tell me how to set this property to take this effect, or is there another configuration needed ?

eg.: Horizontal Style for an Appointment

<Style x:Key="Level200HorizontalStyle" TargetType="telerik:AppointmentItem">   
           <Setter Property="Background" Value="{StaticResource AppointmentBackground}" />
           <Setter Property="BorderBrush" Value="{StaticResource AppointmentBorder}" />
           <Setter Property="Padding" Value="5" />
           <Setter Property="Foreground" Value="{StaticResource AppointmentForeground}" />
           <Setter Property="FontSize" Value="10" />
           <!-- Setter Property="FontFamily" Value="Arial"/ -->
           <Setter Property="Template">
               <Setter.Value>
                   <ControlTemplate TargetType="{x:Type telerik:AppointmentItem}">
                       <Grid x:Name="Root" ToolTipService.ShowDuration="20000"
>
                           <Grid.InputBindings>
                               <MouseBinding MouseAction="LeftDoubleClick" Command="scheduleView:RadScheduleViewCommands.EditAppointment"/>
                           </Grid.InputBindings>
                           <Border BorderBrush="{TemplateBinding BorderBrush}"
                                   BorderThickness="{TemplateBinding BorderThickness}"
                                   Background="{TemplateBinding Background}" CornerRadius="2" />
                           <Border x:Name="CommonStatesVisual" BorderThickness="{TemplateBinding BorderThickness}"
                                   Background="{StaticResource AppointmentMouseOver}"
                                   BorderBrush="{TemplateBinding BorderThickness}" CornerRadius="2"
                                   Visibility="Collapsed" />
                           <Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                   VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                   Margin="{TemplateBinding Padding}">
                               <Grid.ColumnDefinitions>
                                   <ColumnDefinition Width="20" />
                                   <ColumnDefinition Width="Auto" />
                               </Grid.ColumnDefinitions>
                               <ContentPresenter />
                           </Grid>
                           <Grid x:Name="MouseOverOverlay" Opacity="0" Visibility="Collapsed">
                               <Border x:Name="PART_StartResizeGrip" telerik:RadDragAndDropManager.AllowDrag="True"
                                       Background="Transparent" Cursor="SizeWE" HorizontalAlignment="Left"
                                       VerticalAlignment="Stretch">
                                   <StackPanel x:Name="StartResizeGrip"
                                           HorizontalAlignment="Center" Margin="1" VerticalAlignment="Center" Background="#FF878787">
                                       <Rectangle Fill="White" Height="2" Margin="1" Width="2" />
                                       <Rectangle Fill="White" Height="2" Margin="1" Width="2" />
                                       <Rectangle Fill="White" Height="2" Margin="1" Width="2" />
                                   </StackPanel>
                               </Border>
                               <Border x:Name="PART_EndResizeGrip" telerik:RadDragAndDropManager.AllowDrag="True"
                                       Background="Transparent" Cursor="SizeWE" HorizontalAlignment="Right"
                                       VerticalAlignment="Stretch">
                                   <StackPanel x:Name="EndResizeGrip"
                                           HorizontalAlignment="Center" Margin="1" VerticalAlignment="Center" Background="#FF878787">
                                       <Rectangle Fill="White" Height="2" Margin="1" Width="2" />
                                       <Rectangle Fill="White" Height="2" Margin="1" Width="2" />
                                       <Rectangle Fill="White" Height="2" Margin="1" Width="2" />
                                   </StackPanel>
                               </Border>
                           </Grid>
                       </Grid>
                       <ControlTemplate.Triggers>
                           <Trigger Property="IsDragged" Value="True">
                               <Setter Property="Opacity" TargetName="Root" Value="0.3" />
                           </Trigger>
                           <Trigger Property="IsMouseOver" Value="True">
                               <Trigger.EnterActions>
                                   <BeginStoryboard>
                                       <Storyboard>
                                           <ObjectAnimationUsingKeyFrames Duration="0:0:0.4"
                                                   Storyboard.TargetProperty="Visibility"
                                                   Storyboard.TargetName="MouseOverOverlay">
                                               <DiscreteObjectKeyFrame KeyTime="0">
                                                   <DiscreteObjectKeyFrame.Value>
                                                       <Visibility>Visible</Visibility>
                                                   </DiscreteObjectKeyFrame.Value>
                                               </DiscreteObjectKeyFrame>
                                           </ObjectAnimationUsingKeyFrames>
                                           <DoubleAnimation BeginTime="0:0:0.2" Duration="0:0:0.2" To="1"
                                                   Storyboard.TargetProperty="Opacity"
                                                   Storyboard.TargetName="MouseOverOverlay" />
                                       </Storyboard>
                                   </BeginStoryboard>
                               </Trigger.EnterActions>
                               <Trigger.ExitActions>
                                   <BeginStoryboard>
                                       <Storyboard>
                                           <ObjectAnimationUsingKeyFrames Duration="0:0:0.2"
                                                   Storyboard.TargetProperty="Visibility"
                                                   Storyboard.TargetName="MouseOverOverlay">
                                               <DiscreteObjectKeyFrame KeyTime="0:0:0.2">
                                                   <DiscreteObjectKeyFrame.Value>
                                                       <Visibility>Collapsed</Visibility>
                                                   </DiscreteObjectKeyFrame.Value>
                                               </DiscreteObjectKeyFrame>
                                           </ObjectAnimationUsingKeyFrames>
                                           <DoubleAnimation BeginTime="0" Duration="0:0:0.2" To="0"
                                                   Storyboard.TargetProperty="Opacity"
                                                   Storyboard.TargetName="MouseOverOverlay" />
                                       </Storyboard>
                                   </BeginStoryboard>
                               </Trigger.ExitActions>
                               <Setter Property="Visibility" TargetName="CommonStatesVisual" Value="Visible" />
                               <Setter Property="Visibility" TargetName="MouseOverOverlay" Value="Visible" />
                           </Trigger>
                           <Trigger Property="IsSelected" Value="True">
                               <Setter Property="Visibility" TargetName="CommonStatesVisual" Value="Visible" />
                           </Trigger>
                       </ControlTemplate.Triggers>
                   </ControlTemplate>
               </Setter.Value>
           </Setter>
       </Style>

best regards
rudi
Rudolf
Top achievements
Rank 1
 answered on 01 Mar 2012
8 answers
443 views
Hi,

I have a RadGridView, depending of the grid type I need, I build dynamically each columns and each aggregate functions. Each time I build a grid, at least one decimal column exist. For othe aggregate functions than SUM, it work...
 
When I assign the ItemSource to the array of objects I receive from the back-end, I receive the following message: "Aucune méthode 'Sum' sur le type 'System.Linq.Enumerable' n'est compatible avec les arguments fournis."

xaml:

<

 

telerik:RadGridView x:Name="radGridViewList" Margin="5 0 5 5" Visibility="Visible" RowDetailsVisibilityMode="Collapsed" FrozenColumnCount="1"

 

 

RowIndicatorVisibility="Collapsed" IsReadOnly="True" AutoGenerateColumns="False" CanUserFreezeColumns="False" Grid.Row="3"

 

 

CanUserResizeColumns="True" ShowColumnFooters="True" ShowGroupFooters="True" SelectionMode="Extended" IsSynchronizedWithCurrentItem="True"> />

 


Code behind:

  static public void SetColumns(RadGridView pGrid, ColumnDescriptor[] pColumnNames)
  {
   if (pColumnNames != null)
   {               
                EnumerableAggregateFunctionBase aggFunc;

    for (int iColumnIndex = 0; iColumnIndex < pColumnNames.Length; iColumnIndex++)
    {
     ColumnDescriptor oneName = pColumnNames[iColumnIndex];
     GridViewDataColumn oneColumn = new Telerik.Windows.Controls.GridViewDataColumn();

     oneColumn.Header = oneName.ColumnName;
     
                    //Apply proper column display format.
     switch (oneName.Format.ToUpper())
     {
      case "$":
       oneColumn.DataFormatString = "C2";
       break;

      case "D":
       oneColumn.DataFormatString = "yyyy'-'MM'-'dd";                           
       break;

      case "H":
       oneColumn.DataFormatString = "HH':'mm";                           
       break;

      case "DH":
       oneColumn.DataFormatString = "yyyy'-'MM'-'dd' 'HH':'mm";
       break;
     }

     oneColumn.Width = new GridViewLength(1, GridViewLengthUnitType.Star);
     oneColumn.ShowFilterButton = true;
     oneColumn.IsSortable = true;
     oneColumn.IsFilterable = true;
     oneColumn.DataMemberBinding = new Binding(string.Format("ElementCells[{0:D}]", iColumnIndex));
     oneColumn.TextAlignment = (TextAlignment)oneName.TextAlignment;
     oneColumn.HeaderTextAlignment = (TextAlignment)oneName.TextAlignment;

                    //Create proper aggregate functions.
                    if (oneName.Agregation != AgregationFunction.None)
                    {
                        aggFunc = null;

                        switch (oneName.Agregation)
                        {
                            case AgregationFunction.Average:
                                aggFunc = new AverageFunction()
                                {
                                    Caption = LocGeneral.GetControlText("Average") + ": "
                                };
                                break;
                            case AgregationFunction.Count:
                                aggFunc = new CountFunction()
                                {
                                    Caption = LocGeneral.GetControlText("Count") + ": "
                                };
                                break;
                            case AgregationFunction.FirstValue:
                                aggFunc = new FirstFunction()
                                {
                                    Caption = LocGeneral.GetControlText("First") + ": "
                                };
                                break;
                            case AgregationFunction.LastValue:
                                aggFunc = new LastFunction()
                                {
                                    Caption = LocGeneral.GetControlText("Last") + ": "
                                };
                                break;
                            case AgregationFunction.MaxValue:
                                aggFunc = new MaxFunction()
                                {
                                    Caption = LocGeneral.GetControlText("Max") + ": "
                                };
                                break;
                            case AgregationFunction.MinValue:
                                aggFunc = new MinFunction()
                                {
                                    Caption = LocGeneral.GetControlText("Min") + ": "
                                };
                                break;
                            case AgregationFunction.Sum:
                                aggFunc = new SumFunction()
                                {
                                    Caption = LocGeneral.GetControlText("Sum") + ": ",
                                    SourceFieldType = typeof(Decimal)
                                };
                                break;

                        }

                        //If aggregate function created, we add it to the column.
                        if (aggFunc != null)
                        {
                            oneColumn.AggregateFunctions.Add(aggFunc);
                        }
                    }

     pGrid.Columns.Add(oneColumn);
    }
   }
  }


using System;
using System.Diagnostics;
using System.Runtime.Serialization;

namespace com.christiegrp.Neuron.Client
{
 [DataContract]
 public class CompleteConfiguration : NeuronClientBase
 {
  #region Constructors.
  public CompleteConfiguration(bool pReadFromDatabase)
   : base(pReadFromDatabase)
  {
  }
  #endregion

  #region NeuronClientBase overrides.
  protected override string getListBoxDisplay()
  {
   return Name;
  }

  protected override string[] getColumnNames()
  {
   switch (GuiLanguage)
   {
    case Languages.LanguageEn:
     return new string[] { "Code", "Name", "Contents" };

    case Languages.LanguageFr:
     return new string[] { "Code", "Nom", "Contenu" };
   }

   return null;
  }

  protected override object[] getItems()
  {
   return new object[] { Code, Name, Contents };
  }

  protected override void copyFrom(NeuronClientBase pSource)
  {
   base.copyFrom(pSource);

   CompleteConfiguration theSource = pSource as CompleteConfiguration;

   if (theSource == null)
   {
    throw new ArgumentException(WrongArgumentType, "pSource");
   }

   Code = theSource.Code;
   Name = theSource.Name;
   Contents = theSource.Contents;
   IsVisible = theSource.IsVisible;
  }
  #endregion

  #region Properties from main table.
  [DataMember]
  public string Code
  {
   [DebuggerStepThrough]
   get { return mCode; }
   [DebuggerStepThrough]
   set
   {
    if (mCode != value)
    {
     mCode = value;
     NotifyOfPropertyChange("Code");
    }
   }
  }

  [DataMember]
  public string Name
  {
   [DebuggerStepThrough]
   get { return mName; }
   [DebuggerStepThrough]
   set
   {
    if (mName != value)
    {
     mName = value;
     NotifyOfPropertyChange("Name");
    }
   }
  }

  [DataMember]
  public string Contents
  {
   [DebuggerStepThrough]
   get { return mContents; }
   [DebuggerStepThrough]
   set
   {
    if (mContents != value)
    {
     mContents = value;
     NotifyOfPropertyChange("Contents");
    }
   }
  }

  [DataMember]
  public bool IsVisible
  {
   [DebuggerStepThrough]
   get { return mIsVisible; }
   [DebuggerStepThrough]
   set
   {
    if (mIsVisible != value)
    {
     mIsVisible = value;
     NotifyOfPropertyChange("IsVisible");
    }
   }
  }
  #endregion

  #region Private fields.
  private string mCode;
  private string mName;
  private string mContents;
  private bool mIsVisible;
  #endregion
 }

 [DataContract]
 public class ColumnDescriptor
 {
  [DataMember]
  public string ColumnName { get; set; }

  [DataMember]
  public ColumnAlignment TextAlignment { get; set; }

  [DataMember]
  public AgregationFunction Agregation { get; set; }

  [DataMember]
  public int GroupingPosition { get; set; }

  [DataMember]
  public string Format { get; set; }
 }

 [DataContract]
 public class ListElements
 {
  public ListElements()
  {
   ElementGuid = Guid.Empty;
   ElementCells = null;
   IsSelected = false;
  }

  [DataMember]
  public Guid ElementGuid { get; set; }
  [DataMember]
  public object[] ElementCells { get; set; }
  public bool IsSelected { get; set; }
 }

 public enum ListContext
 {
  PatientExams, ToBeBilledExamsPublic, NotTransmittedClaimsPublic, TransmittedClaimsPublic, PaidClaimsPublic, InErrorClaimsPublic, ToBeBilledExamsPrivate, NotTransmittedClaimsPrivate, TransmittedClaimsPrivate,
  PaidClaimsPrivate, InErrorClaimsPrivate, NmbListContexts
 }

 public enum AgregationFunction
 {
  None, Average, MinValue, MaxValue, FirstValue, LastValue, Count, Sum, NmbAgregationFunction
 }

 public enum ColumnAlignment
 {
  Left, Right, Center
 }
}

Oliver
Top achievements
Rank 1
 answered on 01 Mar 2012
3 answers
365 views
Hello,
I am using RadToolbar with ItemsSource.
Here is code:
<telerik:RadToolBar   Grid.Row="0" Grid.Column="0"
                          FocusManager.IsFocusScope="False"
                          ItemsSource="{TemplateBinding local:TBaseReadsWn.ExtToolbarButtons}"
                          ItemTemplate="{StaticResource dtToolbarButton}" 
                          HorizontalAlignment="Stretch"
                          VerticalAlignment="Stretch"
                          HorizontalContentAlignment="Left" 
                          VerticalContentAlignment="Center"
                          Padding="30 4 0 4"  >
    </telerik:RadToolBar>

ItemTemplate:
<DataTemplate x:Key="dtToolbarButton" DataType="UICommandItem">
       <Button
          Command="{Binding Command}"
          CommandParameter="{Binding CommandParameter}"
          Margin="{Binding Margins}"
          IsEnabled ="{Binding IsEnabled}"
          ToolTip="{Binding ToolTip}"
          Width = "22"
          Height= "20">
           <Button.Content>
               <Grid>
                   <Grid.ColumnDefinitions>
                       <ColumnDefinition Width="Auto"></ColumnDefinition>
                       <ColumnDefinition Width="Auto"></ColumnDefinition>
                   </Grid.ColumnDefinitions>
                   <Image Grid.Row="0" Grid.Column="0"    Name="img" Style="{StaticResource stlImgBtnIm}"   Source="{Binding Image}"></Image>
                   <TextBlock Grid.Row="0" Grid.Column="1" Style="{StaticResource stlImgBtnTb}" Text="{Binding Text}"></TextBlock>
               </Grid>
           </Button.Content>
       </Button>
       <DataTemplate.Triggers>
           <DataTrigger Binding="{Binding Image}" Value="{x:Null}">
               <DataTrigger.Setters>
                   <Setter TargetName="img" Property="Visibility" Value="Collapsed"></Setter>
               </DataTrigger.Setters>
           </DataTrigger>
 
           <DataTrigger Binding="{Binding Margins}" Value="0">
               <DataTrigger.Setters>
                   <Setter Property="Margin" Value="2 2 2 2"></Setter>
               </DataTrigger.Setters>
           </DataTrigger>
       </DataTemplate.Triggers>
   </DataTemplate>

When I add elements to ExtToolbarButtons collection I see normal - styled buttons.
How to use ItemsSource with  telerik - styled buttons on RadToolbar?
Petar Mladenov
Telerik team
 answered on 01 Mar 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?