Telerik Forums
UI for WPF Forum
5 answers
267 views

Hi,

I am try to bind a RadGridView to DataView because of the Notify events that are already available. I am using the WPF MVVM architecture therefore the Grid is defined in the XAML and the DataView in my presentation Layer. I have a background worker that will populate the table in the DataView and I was hoping the RadGridView would then update accordingly. I am not too sure why it is not working or whether it can work in this context. Please see the code snippet below.

 


View:

<telerikGrid:RadGridView x:Name="activeSessionsGrid" AutoGenerateColumns="True" ItemsSource="{Binding Path=ActiveSessions}"

</telerikGrid:RadGridView> 


Presentation Model:

private DataView _activeSessions;

 

public DataView ActiveSessions

{

     get

     {

        return this._activeSessions;

     }           

}

private void GenereateTableStructure ( )

{

this._activeSessions = new DataView ( ); 

this._activeSessions.Table = new DataTable ( "Sessions" );

this._activeSessions.Table.Columns.Add ( "ID" );

this._activeSessions.Table.Columns.Add ( "Name" );

this._activeSessions.Table.Columns.Add ( "Surname" );

this._activeSessions.Table.Columns.Add ( "Designation" );

this._activeSessions.Table.Columns.Add ( "User Name" );

this._activeSessions.Table.Columns.Add ( "Email Address" );

this._activeSessions.Table.Columns.Add ( "Last Access Time" );
}

//BackgroundWorker that populates the _activeSessions table

 


Thanks in advance for your assistance.

Chris
Top achievements
Rank 1
 answered on 22 Oct 2010
1 answer
271 views

I want to localize my GridView from xml file which has translation for my GridView headers.

I use next code:

   <Window.Resources>
        <Style TargetType="telerik:GridViewDataColumn">
            <Setter Property="Header" Value="someValue"/>
        </Style>
    </Window.Resources>
  
  
<Grid>
    <telerik:RadGridView HorizontalAlignment="Left" Name="radGridView1"  VerticalAlignment="Top"  >
  
    </telerik:RadGridView>
  
</Grid>


and my code behind:
public partial class Window1 : Window
{
    public Window1()
    {
        InitializeComponent();
 
        var lst = new List<Foo>
                      {
                          new Foo() {CompanyName = "Burkinafaso", Phone = "6666"},
                          new Foo() {CompanyName = "Reebok", Phone = "555"}
                      };
 
        radGridView1.SetBinding(RadGridView.ItemsSourceProperty, new Binding {Source = lst});
    }
}
 
public class Foo
{
    public string CompanyName { get; set; }
    public string Phone { get; set; }
 
}

 
But Headers not change. Why I cannot change headers with this approach?
 I am planning to bind TextBlock to the XmlNode value and get appropriate translation by Header system name



Vanya Pavlova
Telerik team
 answered on 21 Oct 2010
7 answers
860 views
Hi,

Given the grid below:

<my:RadGridView 
            x:Name="grdData"
            VerticalAlignment="Stretch"
            ItemsSource="{Binding List}"
            ShowGroupPanel="False"
            AutoGenerateColumns="False"
            EditTriggers="None"
            CanUserSelect="False"
            Tag="{Binding ComboBoxList}"
            >
            <my:RadGridView.Columns>
                <my:GridViewDataColumn Header="Variable" TextAlignment="Center">
                    <my:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <ComboBox 
                                ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, 
                                                AncestorType={x:Type my:RadGridView}, AncestorLevel=1}, Path=Tag}"
                                SelectedValuePath="Value"
                                DisplayMemberPath="Name"
                                SelectedValue="{Binding SelectedItem}"
                                />
                        </DataTemplate>
                    </my:GridViewDataColumn.CellTemplate>
                </my:GridViewDataColumn>
            </my:RadGridView.Columns>
        </my:RadGridView>

Which is a grid with a single column which has a custom datatemplate with a combobox in it. Each item in the list has a value assigned (no ComboBox is empty).

When the list is long and the vertical scrollbars are visible, if I drag the scrollbar down, hiding a few items at the top, sometimes the items that were hidden re-appear unselected (DependencyProperty.UnsetValue).

I solved the issue by turning off the Row Virtualization (EnableRowVirtualization="False") but I would like to know if this is a bug or if I am missing a step when using custom datatemplates with virtualization.

I can submit a bug report with a demo of the problem if you prefer.

Thanks,
Jose
Jose Simas
Top achievements
Rank 2
 answered on 21 Oct 2010
1 answer
92 views

"Consider whether the performance impact of registering in the container and resolving instances from it is acceptable in your scenario. For example, if you need to create 10,000 polygons to draw a surface within the local scope of a rendering method, the cost of resolving all of those polygon instances through the container might have a significant performance cost because of the container's use of reflection for creating each entity." 

Please see the section title, "Considerations for Using the Container", in the following link:
http://msdn.microsoft.com/en-us/library/ff921140(v=PandP.20).aspx

One possible solution is not to resolve/inject the module containing your rendering method inside the Unity Container.

You folks at Telerik may want to take a closer look at this, perhaps do a mockup to test this out,  given that Unity is being use for a great many projects.

Patrick
Vladimir Milev
Telerik team
 answered on 21 Oct 2010
2 answers
113 views
Hi,
I've got two Radpane in one RadPaneGroup. If i change the IsHiddenProperty it works fine.
But if i Float One of the Pane Outside the COmpass Area and then i change IsHidden Property .. this pane hide but never shows again.
private void radDockPanel1_Close(object sender, Telerik.Windows.Controls.Docking.StateChangeEventArgs e)
      {
          p1.IsHidden = !p1.IsHidden;
      }

this is the code in a button click.. It doesn' work if i drag a pane outside the compass area.

THX AGAIN
Claudio
Top achievements
Rank 1
 answered on 21 Oct 2010
1 answer
75 views

Hello again,

 

    I want to suggest a better behavior for this control that would help it stay 508 compliant.  When I use the RadTabControl in my applications, and a user attempts to change the tab using just the keyboard, this control behaves in a way that is not typical.   For starters, the RadTabItem’s default IsTabStop value is “false”.  Second, even when we set the IsTabStop to “true”, the focus is automatically changed from the Tabs to the first control in the tab being activated.  This is not a typical behavior as seen in the stock TabControl that Microsoft wrote (or any other Tab control to speak of).  Finally there is the matter of the AutomationPeer (as in there is none for either the RadTabControl or RadTabItem).  This presents an issue for customers like me who are required to make our products accessible.    

- Rashad Rivera

Miro Miroslavov
Telerik team
 answered on 21 Oct 2010
1 answer
100 views
I am adding items to the carousel at runtime. Although the items are added, none is displayed until I use the horizontal scroll bar.
How to bring the item in view when added?
Vlad
Telerik team
 answered on 21 Oct 2010
1 answer
67 views
Hi..
How can I create Header hyperlink so when you click on the header it fires a hyperlink event?
For example my header will be file names and I want to open the file when the header is clicked.
thanks again
Vlad
Telerik team
 answered on 21 Oct 2010
3 answers
177 views


Binding to the DataTable when DataBinding multiple Row to the error

DataCode
public DataTable GetDataTable()
{
    DataTable dataTable = new DataTable();
    dataTable.Columns.Add("Time", typeof(DateTime));
    dataTable.Columns.Add("DoubleData", typeof(double));
    dataTable.Columns.Add("Time2", typeof(DateTime));
    dataTable.Columns.Add("DoubleData2", typeof(double));
      
    for (int index = 0; index <1000; index++)
    {
        DataRow dataRow = dataTable.NewRow();
        dataRow["DoubleData"] = 21.7003078460693;
        dataRow["DoubleData2"] = 21.7003078460693 + 10;
        dataRow["Time"] = DateTime.Now.AddSeconds(index);
        dataRow["Time2"] = DateTime.Now.AddSeconds(index+1);
        dataTable.Rows.Add(dataRow);
    }
    return dataTable;
}


Chart Code
        radChart.DefaultView.ChartArea.AxisX.LayoutMode = AxisLayoutMode.Auto;
            radChart.DefaultView.ChartArea.AxisX.IsDateTime = true;
            radChart.DefaultView.ChartArea.AxisX .DefaultLabelFormat = "hh:mm MM:ss";
            radChart.DefaultView.ChartArea.AxisX.AutoRange = true;
  
            SeriesMapping seriesMapping = new SeriesMapping();
            LineSeriesDefinition lineSeriesDefinition = new LineSeriesDefinition();
            ItemMapping YItem = new ItemMapping("DoubleData", DataPointMember.YValue);
            ItemMapping XItem = new ItemMapping("Time", DataPointMember.XValue);
            seriesMapping.LegendLabel = "1";
            lineSeriesDefinition.ShowItemLabels = false;
            lineSeriesDefinition.ShowPointMarks = false;
            seriesMapping.SeriesDefinition = lineSeriesDefinition;
            seriesMapping.ItemMappings.Add(YItem);
            seriesMapping.ItemMappings.Add(XItem);
            lineSeriesDefinition.ShowItemToolTips = true;    
            radChart.SeriesMappings.Add(seriesMapping);
              
            SeriesMapping seriesMapping2 = new SeriesMapping();
            LineSeriesDefinition lineSeriesDefinition2 = new LineSeriesDefinition();
            ItemMapping YItem2 = new ItemMapping("DoubleData2", DataPointMember.YValue);
           ItemMapping XItem2 = new ItemMapping("Time2", DataPointMember.XValue);
            seriesMapping2.LegendLabel = "2";
            lineSeriesDefinition2.ShowItemLabels = false;
            lineSeriesDefinition2.ShowPointMarks = false;
            lineSeriesDefinition2.ItemLabelFormat = "mm:dd hh:MM:ss";
            seriesMapping2.SeriesDefinition = lineSeriesDefinition2;
            seriesMapping2.ItemMappings.Add(YItem2);
            seriesMapping2.ItemMappings.Add(XItem2);
            radChart.SeriesMappings.Add(seriesMapping2);
  
  
  
            radChart.ItemsSource = GetDataTable(); <-- Error

Error
No generic method 'Average' on type 'System.Linq.Enumerable' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic.

What should I do?
Emily
Top achievements
Rank 1
 answered on 21 Oct 2010
4 answers
158 views
Hello All,

    Is Telerik planning on completing the AutomationPeer implementations of these two controls?  The current implementation returns null for both control's OnCreateAutomationPeer() methods. 

- Rashad Rivera
  Omegus Prime, LLC
Rashad Rivera
Top achievements
Rank 1
 answered on 20 Oct 2010
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
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
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
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?