Telerik Forums
UI for WPF Forum
7 answers
222 views
I installed the Beta (Q1 2010) and was using the Docking feature in the Docking/FirstLook demo. If I pull out the control (floating window) and try to drag it onto another monitor, it disappears. For example, it will show half of the floating window if dragged in between monitors (see 1st screen shot).

After this happened, there seems to be an invisible area that floating windows can occupy (see 2nd screen shot).

If you start the demo app on the 2nd monitor, then try to float the window, it disappears right away.

--Sean
George
Telerik team
 answered on 04 Mar 2011
5 answers
376 views
Hello All.

We have a wpf client application (xbap) with a custom Grid which display billions of records.
We implemented data load on demand, when we only fetch (load) the current page into the client.
We also support sorting and filter on the entire data at server side, and filter data for our excel like filters from all the records.

We would like to move into telerik wpf controls, what is the way to achieve such a behavior using telerik wpf controls?

Thanks
Roee
Milan
Telerik team
 answered on 03 Mar 2011
0 answers
325 views
public partial class MainWindow : Window
   {
       public MainWindow()
       {
           InitializeComponent();
           ICollection<DocumentResultHit> results = ResultHitManager.GetDummyData();
             
           //Add the known columns
           this.radGridView1 .Columns.Add(new GridViewDataColumn()
           {
               UniqueName = "DocId"
               ,
               DataMemberBinding = new Binding("DocumentID")
           });
           //add the dynamic columns
           List<string> docColumns = ResultHitManager.GetDocumentColumns();
           foreach(string str in docColumns )
           {
               GridViewDataColumn docCol = new GridViewDataColumn();
               docCol.Header = str;
               docCol.DataMemberBinding = new Binding(("SearchFields["+str+"]"));
               this.radGridView1.Columns.Add(docCol);
           }
           // Finally, bind the grid
           this.radGridView1 .ItemsSource = results ;
       }
        
   }
public class DocumentResultHit
{
    public int DocumentID
    {
        get;
        set;
    }
    Dictionary<string, List<string>> searchFields = new Dictionary<string, List<string>>();
    public Dictionary<string, List<string>> SearchFields
    {
        get { return this.searchFields ; }
    }
    public IList<PageResultHit> Pages { get; set; }
}
public static class ResultHitManager
    {
  
        public static ICollection<DocumentResultHit> GetDummyData()
        {
            ICollection<DocumentResultHit> results = new List<DocumentResultHit>();
  
            DocumentResultHit doc1 = new DocumentResultHit() { DocumentID = 1 };
            doc1.SearchFields.Add("DocCol1", new List<string>() {"MultiField1", "MultiFiled2"});
            doc1.SearchFields.Add("DocCol2", new List<string>() { "MultiField3", "MultiFiled4" });
            PageResultHit page1 = new PageResultHit();
            page1.PageFields.Add("PageCol1", new List<string>() { "MultiPageField1", "MultiPageFiled2" });
            page1.PageFields.Add("PageCol2", new List<string>() { "MultiPageField3", "MultiPageFiled4" });
            doc1.Pages = new List<PageResultHit>();
            doc1.Pages.Add(page1);
  
             
            results.Add(doc1);
  
            DocumentResultHit doc2 = new DocumentResultHit() { DocumentID = 2 };
            doc2.SearchFields.Add("DocCol1", new List<string>() { "Multidoc2Field1", "Multidoc2Filed2" });
            doc2.SearchFields.Add("DocCol2", new List<string>() { "Multidoc2Field3", "Multidoc2Filed4" });
            results.Add(doc2);
  
            return results;
        }
        public static List<string> GetDocumentColumns()
        {
            return new List<string>() {"DocCol1", "DocCol2"};
        }
        public static List<string> GetPageColumns()
        {
            return new List<string>() { "PageCol1", "PageCol2" };
        }
    }
Hi,
I want to display a read-only list of valueswhich come from a dictionary type in a gridview column . I cannot do it in XAML as the columns are created at runtime. What is the appropriate column type or should I do it via data templates. Currently with the code below the column displays the text "Collection" .Please help. Here is the code:

 

 

public

MainWindow()

 

 

{

 

InitializeComponent();

 

 

 

 

 

ICollection<DocumentResultHit> results = ResultHitManager

.GetDummyData();

 

 

 

 

 

 

 

 

//Add the known columns

 

 

 

 

this.radGridView1 .Columns.Add(new GridViewDataColumn

()

 

 

{

 

UniqueName =

 

 

 

"DocId"

 

 

,

DataMemberBinding =

 

new Binding("DocumentID"

)

 

 

});

 

 

 

 

 

//add the dynamic columns

 

 

 

 

List<string> docColumns = ResultHitManager

.GetDocumentColumns();

 

 

 

 

 

 

foreach(string str in

docColumns )

 

 

{

 

 

 

 

 

GridViewDataColumn docCol = new GridViewDataColumn

();

 

 

docCol.Header = str;

 

docCol.DataMemberBinding =

 

 

 

new Binding(("SearchFields["+str+"]"

));

 

 

 

 

 

 

this

.radGridView1.Columns.Add(docCol);

 

 

}

 

 

 

 

 

// Finally, bind the grid

 

 

 

 

this

.radGridView1 .ItemsSource = results ;

 

 

}

 

 

 

}

 



Here is the entity (object called DocumentResulHit ). As shown below "SearchFields" is of type Dictionary and I want to display the value corresponding to the column name key in the cell.

 

 

public class

DocumentResultHit

 

 

{

 

 

public int

DocumentID

 

 

{

 

 

 

 

 

get

;

 

 

 

 

 

 

set

;

 

 

}

 

 

 

 

 

Dictionary<string, List<string>> searchFields = new Dictionary<string, List<string

>>();

 

 

 

 

 

 

public Dictionary<string, List<string

>> SearchFields

 

 

{

 

 

 

 

 

get { return this

.searchFields ; }

 

 

}

 

 

 

 

 

public IList<PageResultHit> Pages { get; set

; }

 

 

}

Finally here is the "GetDummyData" and "GetDocumentColumns" method

 

 

 

 

 

 

public static ICollection<DocumentResultHit

> GetDummyData()

 

 

 

{

 

 

 

 

 

 

ICollection<DocumentResultHit> results = new List<DocumentResultHit

>();

 

 

 

 

 

 

 

 

DocumentResultHit doc1 = new DocumentResultHit

() { DocumentID = 1 };

 

 

 

doc1.SearchFields.Add(

 

 

 

 

"DocCol1", new List<string>() {"MultiField1", "MultiFiled2"

});

 

 

 

doc1.SearchFields.Add(

 

 

 

 

"DocCol2", new List<string>() { "MultiField3", "MultiFiled4"

});

 

 

 

 

 

 

 

 

PageResultHit page1 = new PageResultHit

();

 

 

 

page1.PageFields.Add(

 

 

 

 

"PageCol1", new List<string>() { "MultiPageField1", "MultiPageFiled2"

});

 

 

 

page1.PageFields.Add(

 

 

 

 

"PageCol2", new List<string>() { "MultiPageField3", "MultiPageFiled4"

});

 

 

 

doc1.Pages =

 

 

 

 

new List<PageResultHit

>();

 

 

 

doc1.Pages.Add(page1);

 

 

 

results.Add(doc1);

 

 

 

 

 

 

DocumentResultHit doc2 = new DocumentResultHit

() { DocumentID = 2 };

 

 

 

doc2.SearchFields.Add(

 

 

 

 

"DocCol1", new List<string>() { "Multidoc2Field1", "Multidoc2Filed2"

});

 

 

 

doc2.SearchFields.Add(

 

 

 

 

"DocCol2", new List<string>() { "Multidoc2Field3", "Multidoc2Filed4"

});

 

 

 

results.Add(doc2);

 

 

 

 

 

 

return

results;

 

 

 

}

 

 

 

 

 

 

public static List<string

> GetDocumentColumns()

 

 

 

{

 

 

 

 

 

 

return new List<string>() {"DocCol1", "DocCol2"

};

 

 

 

}

 

 

Subarna Bandyopadhya
Top achievements
Rank 1
 asked on 03 Mar 2011
1 answer
222 views

Hi,All:

My application use Win32 window to host my WPF window. I am using WindowInteropHelper to set my WPF window owner to the Win32 window handler. It works fine. But If I move the Win32 window (like to 2nd screen), the WPF window does not move with it.  I have to manually set the WPF window Left, top, Width and Height. Is this by design or did I miss something here?  What is the difference between the Owner and Parent (window)? Should I set the WPF parent window to the win32 handler to let the WPF window move with the win32 window?

Code snippet:

IntPtr win32WndHandler;

WindowInteropHelper helper = new WindowInteropHelper(myWPFWindow);
helper.Owner = win32WndHandler;

 

Thanks a lot

Rossen Hristov
Telerik team
 answered on 03 Mar 2011
1 answer
83 views

I have some backend code that needs to look at a collection of appointments and determine which ones are active now.
Are there any helper methods that would assist in determining this?  or Will I have to use the appointment.Start & appointment.End times in conjunction with the appointment.RecurrenceRule.Patten & appointment.RecurrenceRule.Exceptions to determine which ones are active.

Thanks
Craig.

Valeri Hristov
Telerik team
 answered on 03 Mar 2011
2 answers
194 views
Hello there,

I had a quick look at the Silverlight documentation (is the WPF RichTextBox (beta) Documentation available already somewhere?) and I did not see any Events being mentioned regarding key events, as in e.g. whenever the user enters a key in the editor indicate what key(s) was/were pressed (or e.g. what combo like alt+shift+f etc). Is anything like that available/possible or planned for the editor?

Best regards,
-Jörg B.
Jörg B.
Top achievements
Rank 1
 answered on 03 Mar 2011
1 answer
94 views
Hy,
I know It's not easy but do you predict to manage right to left language like arabic [maybe a gift for the end of the year  ]? A new nice feature to complete this amazing control.
By Example http://msdn.microsoft.com/fr-fr/library/aa350685.aspx
Amts
Mr Bernard JOURDAIN 
Agency Press France
Iva Toteva
Telerik team
 answered on 03 Mar 2011
1 answer
59 views
Is there a way to rotate the data?

I've got a collection of objects, but I want the properties to show up as rows and the data points to show up as columns.
Rossen Hristov
Telerik team
 answered on 03 Mar 2011
2 answers
204 views
Hello,

when I am double clicking on a child row then also then also the event from parent grid will be fired, if a row is selected. How can I supress the event of the parent grid without deselecting the row?

In my example, I am using MVVM Light.

<Window x:Class="DoubleClickEventFiredTwice.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" 
        xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4" 
        Title="MainWindow" Height="350" Width="525" x:Name="window">
    <Grid>
        <telerik:RadGridView Margin="12" ShowGroupPanel="False" ItemsSource="{Binding Employees}"
                             AutoGenerateColumns="False" CanUserFreezeColumns="False" CanUserResizeColumns="False" IsReadOnly="True" 
                             SelectedItem="{Binding Path=SelectedEmployee, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" CanUserInsertRows="False" 
                             CanUserDeleteRows="False" DataLoadMode="Asynchronous" PreviewMouseDoubleClick="RadGridView_PreviewMouseDoubleClick">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Name" DataMemberBinding="{Binding Name, Mode=TwoWay}" Width="1*" />
            </telerik:RadGridView.Columns>
            <telerik:RadGridView.ChildTableDefinitions>
                <telerik:GridViewTableDefinition>
                    <telerik:GridViewTableDefinition.Relation>
                        <telerik:PropertyRelation ParentPropertyName="Notes" />
                    </telerik:GridViewTableDefinition.Relation>
                </telerik:GridViewTableDefinition>
            </telerik:RadGridView.ChildTableDefinitions>
            <telerik:RadGridView.HierarchyChildTemplate>
                <DataTemplate>
                    <telerik:RadGridView x:Name="GridViewDetail" CanUserFreezeColumns="False" AutoGenerateColumns="False" ItemsSource="{Binding Notes}" 
                                                 ShowGroupPanel="False" IsReadOnly="True" CanUserInsertRows="False" 
                                                 SelectedItem="{Binding Mode=TwoWay, Path=DataContext.SelectedNote, RelativeSource={RelativeSource FindAncestor, AncestorType=Window, AncestorLevel=1}}" 
                                                 CanUserDeleteRows="False" DataLoadMode="Asynchronous" PreviewMouseDoubleClick="RadGridView_PreviewMouseDoubleClick">
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding Text, Mode=TwoWay}" Header="Note" Width="200" />
                        </telerik:RadGridView.Columns>
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="MouseDoubleClick">
                                <cmd:EventToCommand Command="{Binding Mode=OneWay, Path=DataContext.EditNoteCommand, RelativeSource={RelativeSource FindAncestor, AncestorType=Window, AncestorLevel=1}}"
                                                    PassEventArgsToCommand="True" />
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </telerik:RadGridView>
                </DataTemplate>
            </telerik:RadGridView.HierarchyChildTemplate>
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="MouseDoubleClick">
                    <cmd:EventToCommand Command="{Binding EditEmployeeCommand, Mode=OneWay}" PassEventArgsToCommand="True" />
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </telerik:RadGridView>
    </Grid>
</Window>

using System;
using System.Linq;
using System.Windows;
using System.Windows.Input;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.GridView;
 
namespace DoubleClickEventFiredTwice
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            this.InitializeComponent();
 
            this.DataContext = new ViewModel();
        }
 
        private void RadGridView_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var clicked = e.OriginalSource as UIElement;
 
            e.Handled = clicked == null || clicked.ParentOfType<GridViewRow>() == null;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Input;
using GalaSoft.MvvmLight.Command;
 
namespace DoubleClickEventFiredTwice
{
    public class ViewModel
    {
        public ViewModel()
        {
            this.EditEmployeeCommand = new RelayCommand<RoutedEventArgs>(
                args => this.EditEmployee(this.SelectedEmployee),
                args => this.SelectedEmployee != null);
 
            this.EditNoteCommand = new RelayCommand<RoutedEventArgs>(
                args => this.EditNote(this.SelectedNote),
                args => this.SelectedNote != null);
        }
 
        public IList<Employee> Employees
        {
            get
            {
                return new List<Employee>
                       {
                           new Employee { Name = "Hans Meier", Notes = new[]{ new Note { Text = "Hinweis 1"}, new Note { Text = "Hinweis 2"}   }},
                           new Employee { Name = "Klaus Schuster", Notes = new[]{ new Note { Text = "Hinweis 3"}, new Note { Text = "Hinweis 4"}   }}
                       };
            }
        }
 
        public Employee SelectedEmployee { getset; }
 
        public Note SelectedNote { getset; }
 
        public ICommand EditEmployeeCommand { getprivate set; }
 
        public ICommand EditNoteCommand { getprivate set; }
 
        public void EditEmployee(Employee item)
        {
            MessageBox.Show(item.Name);
        }
 
        public void EditNote(Note item)
        {
            MessageBox.Show(item.Text);
        }
    }
 
    public class Employee
    {
        public String Name { getset; }
 
        public IList<Note> Notes { getset; }
    }
    public class Note
    {
        public String Text { getset; }
    }
}

Thanks and greetings,
Ronny
Ronny
Top achievements
Rank 1
 answered on 03 Mar 2011
0 answers
80 views
In my application I want to  have an empty datagrid at start. Then the user must be able to add record
the columns in the gridview must  appear as combobox for the user to select the data for entry.
How can this be achieved?
Xaria D
Top achievements
Rank 1
 asked on 03 Mar 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?