Telerik Forums
UI for WPF Forum
2 answers
163 views
I have used two grid in second grid. I want to make sum of the Amount so i used SumFunction but is is not showingthe sum at the end and can you please provide a sample for binding to custom function. because Data is coming in a currency formated string.

<Page 
    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:Navigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation" 
    xmlns:telerikData="clr-namespace:Telerik.Windows.Data;assembly=Telerik.Windows.Data" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  
    xmlns:controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" 
    xmlns:sys="clr-namespace:System;assembly=mscorlib" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" x:Class="RestaurantWave_Administrator_Console.Desktop.Views.Home" 
    Title="Home" mc:Ignorable="d"
    <Page.Resources> 
        <Storyboard x:Key="UpAnimationSB"
            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="txtNewOrderCount" Storyboard.TargetProperty="(FrameworkElement.Height)"
                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="20"/> 
                <SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="0"/> 
            </DoubleAnimationUsingKeyFrames> 
        </Storyboard> 
        <Storyboard x:Key="DownAnimationSB"
            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="txtNewOrderCount" Storyboard.TargetProperty="(FrameworkElement.Height)"
                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/> 
                <SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="21"/> 
            </DoubleAnimationUsingKeyFrames> 
        </Storyboard> 
    </Page.Resources> 
    <Grid> 
        <Grid.RowDefinitions> 
            <RowDefinition Height="*" /> 
            <RowDefinition Height="470"/> 
            <RowDefinition Height="Auto"/> 
        </Grid.RowDefinitions> 
        <Grid.ColumnDefinitions> 
        </Grid.ColumnDefinitions> 
        <StackPanel Grid.Row="0"
            <UniformGrid x:Name="UniformGrid" HorizontalAlignment="Stretch"
                <StackPanel x:Name="stackPanel"
                    <TextBlock HorizontalAlignment="Center" x:Name="txtNewOrderCount" FontSize="16" Height="20"/> 
                    <telerik:RadButton x:Name="btnShowPanel" Height="21" Style="{DynamicResource DropDownButton}" RenderTransformOrigin="0.5,0.5" Margin="0.068,0,-0.068,0" Content="Show Orders"
                        <telerik:RadButton.RenderTransform> 
                            <TransformGroup> 
                                <ScaleTransform/> 
                                <SkewTransform AngleX="-7.765"/> 
                                <RotateTransform/> 
                                <TranslateTransform X="-1.364"/> 
                            </TransformGroup> 
                        </telerik:RadButton.RenderTransform> 
                    </telerik:RadButton> 
                </StackPanel> 
            </UniformGrid> 
        </StackPanel> 
        <telerik:RadGridView  
            Grid.Row="1"  
            AutoGenerateColumns="False" 
            CanUserDeleteRows="False"  
            CanUserReorderColumns="False"  
            EnableRowVirtualization="True"  
            IsReadOnly="True"  
            MultipleSelect="True"  
            RowDetailsVisibilityMode="Collapsed"         
            HorizontalAlignment="Stretch"                
            ItemsSource="{Binding OrdersCollections, Source={StaticResource orderWebService}}" 
            IsBusy="{Binding IsBusy, Source={StaticResource orderWebService}}" ScrollViewer.VerticalScrollBarVisibility="Auto" telerik:StyleManager.Theme="Office_Blue" Style="{DynamicResource RadGridViewStyle1}" Margin="0" d:LayoutOverrides="Height" MinHeight="0" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" UseAlternateRowStyle="True"
            <telerik:RadGridView.Columns> 
                <telerik:GridViewSelectColumn/> 
                <telerik:GridViewToggleRowDetailsColumn/> 
                <telerik:GridViewDataColumn Width="150" Header="Order No" DataMemberBinding="{Binding OrderCode}" /> 
                <telerik:GridViewDataColumn Width="150" Header="Order Type" DataMemberBinding="{Binding OrderType}"/> 
                <telerik:GridViewDataColumn Width="150" Header="Order Amount" DataMemberBinding="{Binding OrderAmount}"/> 
                <telerik:GridViewDataColumn Width="200" Header="Placed Date/Time" DataMemberBinding="{Binding Order_Placed_Time}" DataFormatString="{}{0:dd,MMM,yy hh:mm tt}"/> 
            </telerik:RadGridView.Columns> 
            <telerik:RadGridView.RowDetailsTemplate> 
                <DataTemplate> 
                    <StackPanel Background="Black" HorizontalAlignment="Stretch"
                        <Navigation:RadTabControl Margin="30,30,30,30" x:Name="CustomerOrderDetail" HorizontalAlignment="Stretch" Height="261" Style="{DynamicResource RadTabControlStyle}" SelectedIndex="1"
                            <Navigation:RadTabItem Header="CustomerDetails" Margin="10,0,0,0" Height="24" FontSize="14.667"
                                <Grid Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" DataContext="{Binding ConsumerDetail}"
                                    <Grid.RowDefinitions> 
                                        <RowDefinition Height="0*"/> 
                                        <RowDefinition Height="0.055*"/> 
                                        <RowDefinition Height="0.108*"/> 
                                        <RowDefinition Height="0.108*"/> 
                                        <RowDefinition Height="0.108*"/> 
                                        <RowDefinition Height="0.108*"/> 
                                        <RowDefinition Height="0.108*"/> 
                                        <RowDefinition Height="0.108*"/> 
                                        <RowDefinition Height="0.108*"/> 
                                        <RowDefinition Height="0.189*"/> 
                                    </Grid.RowDefinitions> 
                                    <Grid.ColumnDefinitions> 
                                        <ColumnDefinition Width="0*"/> 
                                        <ColumnDefinition Width="0.02*"/> 
                                        <ColumnDefinition Width="Auto"/> 
                                        <ColumnDefinition Width="0.025*"/> 
                                        <ColumnDefinition Width="0.692*"/> 
                                    </Grid.ColumnDefinitions> 
                                    <TextBlock Margin="0" VerticalAlignment="Stretch" Height="Auto" Text="Name :" TextWrapping="Wrap" Grid.Column="2" Grid.Row="2" FontSize="18.667" Grid.RowSpan="1" HorizontalAlignment="Right"/> 
                                    <TextBlock HorizontalAlignment="Right" Margin="0" VerticalAlignment="Stretch" FontSize="18.667" Text="Phone :" TextWrapping="Wrap" Grid.Column="2" Grid.Row="3"/> 
                                    <TextBlock HorizontalAlignment="Right" Margin="0" VerticalAlignment="Stretch" FontSize="18.667" Text="Street 1 :" TextWrapping="Wrap" Grid.Column="2" Grid.Row="4"/> 
                                    <TextBlock HorizontalAlignment="Right" Margin="0" VerticalAlignment="Stretch" FontSize="18.667" Text="Street 2 :" TextWrapping="Wrap" Grid.Column="2" Grid.Row="5"/> 
                                    <TextBlock HorizontalAlignment="Right" Margin="0" VerticalAlignment="Stretch" FontSize="18.667" Text="City :" TextWrapping="Wrap" Grid.Column="2" Grid.Row="6"/> 
                                    <TextBlock HorizontalAlignment="Right" Margin="0" VerticalAlignment="Stretch" FontSize="18.667" Text="State :" TextWrapping="Wrap" Grid.Column="2" Grid.Row="7"/> 
                                    <TextBlock HorizontalAlignment="Right" Margin="0" VerticalAlignment="Stretch" FontSize="18.667" Text="E-Mail :" TextWrapping="Wrap" Grid.Column="2" Grid.Row="8"/> 
                                    <TextBlock HorizontalAlignment="Left" Margin="0" VerticalAlignment="Stretch" FontSize="18.667" Text="{Binding ConsumerName}" Grid.Column="4" Grid.Row="2"/> 
                                    <TextBlock HorizontalAlignment="Left" Margin="0" VerticalAlignment="Stretch" FontSize="18.667" Text="{Binding ConsumerPhone}" Grid.Column="4" Grid.Row="3"/> 
                                    <TextBlock HorizontalAlignment="Left" Margin="0" VerticalAlignment="Stretch" FontSize="18.667" Text="{Binding Address_Street1}" Grid.Column="4" Grid.Row="4"/> 
                                    <TextBlock HorizontalAlignment="Left" Margin="0" VerticalAlignment="Stretch" FontSize="18.667" Text="{Binding Address_Street2}" Grid.Column="4" Grid.Row="5"/> 
                                    <TextBlock HorizontalAlignment="Left" Margin="0" VerticalAlignment="Stretch" FontSize="18.667" Text="{Binding Address_City}" Grid.Column="4" Grid.Row="6"/> 
                                    <TextBlock HorizontalAlignment="Left" Margin="0" VerticalAlignment="Stretch" FontSize="18.667" Text="{Binding Address_State}" Grid.Column="4" Grid.Row="7"/> 
                                    <TextBlock HorizontalAlignment="Left" Margin="0" VerticalAlignment="Stretch" FontSize="18.667" Text="{Binding ConsumerEmail}" Grid.Column="4" Grid.Row="8"/> 
                                    <Button Margin="-2.78,11.037,-4.748,8" Content="Print Order" Grid.Column="1" Grid.ColumnSpan="5" Grid.Row="9" d:LayoutOverrides="VerticalAlignment, GridBox" HorizontalAlignment="Center"/> 
                                </Grid> 
                            </Navigation:RadTabItem> 
                            <Navigation:RadTabItem Header="Ordered Item Details" Margin="0,0,0,0" Height="24"
                                <Grid Height="Auto" HorizontalAlignment="Stretch"
                                    <telerik:RadGridView x:Name="MenuItems" AutoGenerateColumns="False" ItemsSource="{Binding CurrentMenuItems}"
                                        <telerik:RadGridView.Columns> 
                                            <telerik:GridViewDataColumn Header="Serial No" DataMemberBinding="{Binding Path=SerialNumber}"
                                                <telerik:GridViewColumn.AggregateFunctions> 
                                                    <telerikData:SumFunction Caption="Hi:" SourceField="SerialNumber"  SourceFieldType="{x:Type sys:Int32}"></telerikData:SumFunction> 
                                                </telerik:GridViewColumn.AggregateFunctions>                                                 
                                            </telerik:GridViewDataColumn> 
                                            <telerik:GridViewDataColumn Header="Item Name" DataMemberBinding="{Binding Path=ItemName}"></telerik:GridViewDataColumn> 
                                            <telerik:GridViewDataColumn Header="Quantity" DataMemberBinding="{Binding Path=Quantity}"></telerik:GridViewDataColumn> 
                                            <telerik:GridViewDataColumn Header="Amount" DataMemberBinding="{Binding Amount}"
                                            </telerik:GridViewDataColumn> 
                                        </telerik:RadGridView.Columns> 
                                    </telerik:RadGridView> 
                                </Grid> 
                            </Navigation:RadTabItem> 
 
                        </Navigation:RadTabControl> 
                    </StackPanel> 
                </DataTemplate> 
            </telerik:RadGridView.RowDetailsTemplate> 
        </telerik:RadGridView> 
        <Grid Grid.Row="2" Height="20" Background="Black"
            <Grid.ColumnDefinitions> 
                <ColumnDefinition Width="0.995*"/> 
                <ColumnDefinition Width="0.005*"/> 
            </Grid.ColumnDefinitions> 
 
        </Grid> 
    </Grid> 
</Page> 
 

Chintan Shah
Top achievements
Rank 2
 answered on 09 Feb 2010
2 answers
82 views
Is it possible for the ContextMenu to support other controls such as ComboBoxes or TextBoxes? Every time I add and then try to click on them, the ContextMenu closes before you can make any changes.

Thanks,
Shawn
David
Top achievements
Rank 1
 answered on 09 Feb 2010
3 answers
234 views
I have a datagrid which is styled for my requirement. Each datagrid row consists of 7 columns. The datatemplates of each column is as follows.

Column 1 - TextBox
Column 2 - ComboBox
Column 3 - TextBlock
Column 4 - TextBox
Column 5 - TextBox
Column 6 - TextBox
Column 7 - TextBlock

I have  an event handler for the PreviewMouseLeftButtonDown of the datagrid, in which I select or deselect the clicked row using code (toggling selection). I have a button in my application.When this button is pressed, I set the  selection mode of the datagrid to Microsoft.Windows.Controls.DataGridSelectionMode.Extended. Everything works fine until now.

But consider the following scenario.

The selection mode of the datagrid is DataGridSelectionMode.Extended. Now I click on the combobox, its dropdown menu opens, And when I press on the scrollbars of the dropdown of the combobox all the selected items of the datagrid gets deselected. In the callstack it is shown that it occurs due to an event raised from datagrids internal method HandleSelectionForCellInput(Microsoft.Windows.Controls.DataGridCell cell = {Microsoft.Windows.Controls.DataGridCell}, bool startDragging = true, bool allowsExtendSelect = true, bool allowsMinimalSelect = true). What is shown in the call stack is shown below.


PresentationFramework.dll!System.Windows.Controls.SelectionChangedEventArgs.InvokeEventHandler(System.Delegate genericHandler, object genericTarget) + 0x31 bytes   
     PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) + 0x27 bytes   
     PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs) + 0x3e bytes   
     PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source = {Microsoft.Windows.Controls.DataGrid Items.Count:148}, System.Windows.RoutedEventArgs args = {System.Windows.Controls.SelectionChangedEventArgs}, bool reRaised = false) + 0x1bf bytes   
     PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender = {Microsoft.Windows.Controls.DataGrid Items.Count:148}, System.Windows.RoutedEventArgs args = {System.Windows.Controls.SelectionChangedEventArgs}) + 0x79 bytes   
     PresentationCore.dll!System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs e) + 0x17 bytes   
     PresentationFramework.dll!System.Windows.Controls.Primitives.Selector.OnSelectionChanged(System.Windows.Controls.SelectionChangedEventArgs e) + 0x5 bytes   
     WPFToolkit.dll!Microsoft.Windows.Controls.DataGrid.OnSelectionChanged(System.Windows.Controls.SelectionChangedEventArgs e = {System.Windows.Controls.SelectionChangedEventArgs}) + 0x1ef bytes   
     PresentationFramework.dll!System.Windows.Controls.Primitives.Selector.InvokeSelectionChanged(System.Collections.Generic.List<object> unselectedItems, System.Collections.Generic.List<object> selectedItems) + 0x4c bytes   
     PresentationFramework.dll!System.Windows.Controls.Primitives.Selector.SelectionChanger.End() + 0xe1 bytes   
     PresentationFramework.dll!System.Windows.Controls.SelectedItemCollection.EndUpdateSelectedItems() + 0x3b bytes   
     PresentationFramework.dll!System.Windows.Controls.Primitives.MultiSelector.EndUpdateSelectedItems() + 0x30 bytes   
     WPFToolkit.dll!Microsoft.Windows.Controls.DataGrid.MakeFullRowSelection(object dataItem = {ePlace.PackageInfo}, bool allowsExtendSelect = true, bool allowsMinimalSelect = true) + 0x85a bytes   
     WPFToolkit.dll!Microsoft.Windows.Controls.DataGrid.HandleSelectionForCellInput(Microsoft.Windows.Controls.DataGridCell cell = {Microsoft.Windows.Controls.DataGridCell}, bool startDragging = true, bool allowsExtendSelect = true, bool allowsMinimalSelect = true) + 0x6b bytes   
     WPFToolkit.dll!Microsoft.Windows.Controls.DataGridCell.OnAnyMouseLeftButtonDown(System.Windows.Input.MouseButtonEventArgs e = {System.Windows.Input.MouseButtonEventArgs}) + 0x155 bytes   
     WPFToolkit.dll!Microsoft.Windows.Controls.DataGridCell.OnAnyMouseLeftButtonDownThunk(object sender = {Microsoft.Windows.Controls.DataGridCell}, System.Windows.Input.MouseButtonEventArgs e = {System.Windows.Input.MouseButtonEventArgs}) + 0x4f bytes   
     PresentationCore.dll!System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate genericHandler, object genericTarget) + 0x31 bytes   
     PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) + 0x27 bytes   
     PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs) + 0x3e bytes   
     PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source = {Microsoft.Windows.Controls.DataGridCell}, System.Windows.RoutedEventArgs args = {System.Windows.Input.MouseButtonEventArgs}, bool reRaised = true) + 0x1bf bytes   
     PresentationCore.dll!System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject sender = {Microsoft.Windows.Controls.DataGridCell}, System.Windows.RoutedEventArgs args = {System.Windows.Input.MouseButtonEventArgs}, System.Windows.RoutedEvent newEvent) + 0x10a bytes   
     PresentationCore.dll!System.Windows.UIElement.CrackMouseButtonEventAndReRaiseEvent(System.Windows.DependencyObject sender, System.Windows.Input.MouseButtonEventArgs e) + 0x2e bytes   
     PresentationCore.dll!System.Windows.UIElement.OnMouseDownThunk(object sender, System.Windows.Input.MouseButtonEventArgs e) + 0xde bytes   
     PresentationCore.dll!System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate genericHandler, object genericTarget) + 0x31 bytes   
     PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) + 0x27 bytes   
     PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs) + 0x3e bytes   
     PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source = {System.Windows.Controls.TextBlock}, System.Windows.RoutedEventArgs args = {System.Windows.Input.MouseButtonEventArgs}, bool reRaised = false) + 0x1bf bytes   
     PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender = {System.Windows.Controls.TextBlock}, System.Windows.RoutedEventArgs args = {System.Windows.Input.MouseButtonEventArgs}) + 0x79 bytes   
     PresentationCore.dll!System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs args = {System.Windows.Input.MouseButtonEventArgs}, bool trusted) + 0x35 bytes   
     PresentationCore.dll!System.Windows.Input.InputManager.ProcessStagingArea() + 0x311 bytes   
     PresentationCore.dll!System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs input) + 0x42 bytes   
     PresentationCore.dll!System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport inputReport) + 0x62 bytes   
     PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.ReportInput(System.IntPtr hwnd, System.Windows.Input.InputMode mode, int timestamp, System.Windows.Input.RawMouseActions actions, int x, int y, int wheel) + 0x2e2 bytes   
     PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.FilterMessage(System.IntPtr hwnd = 2819506, int msg = 513, System.IntPtr wParam = 1, System.IntPtr lParam = 45155482, ref bool handled = false) + 0x4e1 bytes   
     PresentationCore.dll!System.Windows.Interop.HwndSource.InputFilterMessage(System.IntPtr hwnd = 2819506, int msg = 513, System.IntPtr wParam = 1, System.IntPtr lParam = 45155482, ref bool handled = false) + 0x75 bytes   
     WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd = 2819506, int msg = 513, System.IntPtr wParam = 1, System.IntPtr lParam = 45155482, ref bool handled = false) + 0xbe bytes   
     WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) + 0x7a bytes   
     WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback = {Method = {System.Object DispatcherCallbackOperation(System.Object)}}, object args = {MS.Win32.HwndSubclass.DispatcherOperationCallbackParameter}, bool isSingleParameter = true) + 0x8a bytes   
     WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source = {System.Windows.Threading.Dispatcher}, System.Delegate callback, object args, bool isSingleParameter, System.Delegate catchHandler = null) + 0x4a bytes   
     WindowsBase.dll!System.Windows.Threading.Dispatcher.WrappedInvoke(System.Delegate callback, object args, bool isSingleParameter, System.Delegate catchHandler) + 0x44 bytes   
     WindowsBase.dll!System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, bool isSingleParameter) + 0x91 bytes   
     WindowsBase.dll!System.Windows.Threading.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority priority, System.Delegate method, object arg) + 0x40 bytes   
     WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd = 2819506, int msg = 513, System.IntPtr wParam = 1, System.IntPtr lParam = 45155482) + 0xdc bytes   
     [Native to Managed Transition]   
     [Managed to Native Transition]   
     WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame = {System.Windows.Threading.DispatcherFrame}) + 0xc7 bytes   
     WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame frame) + 0x49 bytes   
     WindowsBase.dll!System.Windows.Threading.Dispatcher.Run() + 0x4c bytes   
     PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore) + 0x1e bytes   
     PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) + 0x6f bytes   
     PresentationFramework.dll!System.Windows.Application.Run(System.Windows.Window window) + 0x26 bytes   
     PresentationFramework.dll!System.Windows.Application.Run() + 0x19 bytes   
     ePlace.exe!ePlace.App.Main() + 0x5e bytes    C#
     [Native to Managed Transition]   
     [Managed to Native Transition]   
     mscorlib.dll!System.AppDomain.ExecuteAssembly(string assemblyFile, System.Security.Policy.Evidence assemblySecurity, string[] args) + 0x3a bytes   
     Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() + 0x2b bytes   
     mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x66 bytes   
     mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x6f bytes   
     mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x44 bytes   




Now I would like to avoid this internal call for selection from datagrid. Is there any way to do that? Please advise.
Milan
Telerik team
 answered on 08 Feb 2010
3 answers
386 views
Hello

I am building a windows application using the MVVM pattern.

My scenario is as following:
I have a window with several viewmodels in it.

(VM1) Viewmodel containing a list of items displayed through it's view with the help of RadGridView. 

(VM2) Viewmodel with a search-like function, given a search criteria it sets the SelectedItem in VM1.

My first problem was that the selecteditem could be out of view. I made a mvvm-exception and added code behind and used ScrollIntoView to solve that problem (works like a charm).

private void SelectionChangedHandler(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e)  
{  
   if (this.radGridView.SelectedItem != null)  
   {  
        this.radGridView.ScrollIntoView(radGridView.SelectedItem);  
   }  
My problem now is that when scrolling occurs, the RadGridView gains focus. Is there any way to prevent this?

Best regards and thanks.
Thomas
Hristo
Telerik team
 answered on 08 Feb 2010
1 answer
234 views
Hi,

In my gridviewcolumns I can set a sortmemberpath and a groupmemberpath, what I'm missing is something like a FilterMemberPath.
Is it possible to implement this? This would be very helpful in a lookup value scenario.

Best regards,
Thomas.
Rossen Hristov
Telerik team
 answered on 08 Feb 2010
1 answer
331 views
Is there a way to either set the header to be vertical or to style a column in XAML.  I have a old  vb6 Flexgrid control that I need to replicate and I can do all of it in vb.net code -- but I wanted to style it to be grey(ghostwhite) and set the width and if possible define the static parts all in XAML and then just update the data parts in code
Private Sub BuildGrid(ByRef g As Telerik.Windows.Controls.RadGridView, ByRef d As IBIDData.Client) 
        Dim dt As New DataTable(g.Name) 
        dt.Columns.Add(0) 
        dt.Columns.Add(1) 
        Select Case g.Name 
            Case "grd1" 
                '// This is done after the call - grd1.Columns(0).Width = 80 
                '//                               grd1.Columns(0).Background = System.Windows.Media.Brushes.GhostWhite 
                '//                               grd1.Columns(1).Width = 68 
                dt.Rows.Add(New Object() {"Author", d.FieldStr(0, "Author")}) 
                dt.Rows.Add(New Object() {"Vendor", d.FieldStr(0, "Vendor")}) 
                dt.Rows.Add(New Object() {"Dept", d.FieldStr(0, "DptCode")}) 
                dt.Rows.Add(New Object() {"Publisher", d.FieldStr(0, "Publisher")}) 
                dt.Rows.Add(New Object() {"Pub. Date", d.FieldStr(0, "PubDate")}) 
                dt.Rows.Add(New Object() {"Last Sold", d.FieldStr(0, "LastDateSold")}) 
                dt.Rows.Add(New Object() {"Last Recv", d.FieldStr(0, "LastInvoiceDate")}) 
            Case "grd2" 
                dt.Rows.Add(New Object() {"List", d.FieldStr(0, "ListPrice")}) 
                dt.Rows.Add(New Object() {"Binding", d.FieldStr(0, "BookType")}) 
                dt.Rows.Add(New Object() {"Category 1", d.FieldStr(0, "Cat1")}) 
                dt.Rows.Add(New Object() {"Category 2", d.FieldStr(0, "Cat2")}) 
                dt.Rows.Add(New Object() {"Misc. 1", d.FieldStr(0, "Misc1")}) 
                dt.Rows.Add(New Object() {"Misc. 2", d.FieldStr(0, "Misc2")}) 
                dt.Rows.Add(New Object() {""""}) 
            Case "grd3" 
                dt.Rows.Add(New Object() {"Cost", d.FieldStr(0, "CostPrice")}) 
                dt.Rows.Add(New Object() {"Sell", d.FieldStr(0, "SellPrice")}) 
                dt.Rows.Add(New Object() {"Net", d.FieldStr(0, "NetPrice")}) 
                dt.Rows.Add(New Object() {"Retd YTD", d.FieldStr(0, "YTDReturns")}) 
                dt.Rows.Add(New Object() {"Retd LYR", d.FieldStr(0, "PYRReturns")}) 
                dt.Rows.Add(New Object() {"All Retd", d.FieldStr(0, "AllReturns")}) 
                dt.Rows.Add(New Object() {"All Sales", d.FieldStr(0, "AllSales")}) 
            Case "grd4" 
                dt.Rows.Add(New Object() {"On Hand", d.FieldStr(0, "OnHand")}) 
                dt.Rows.Add(New Object() {"TBO", d.FieldStr(0, "")}) 'fnTBO 
                dt.Rows.Add(New Object() {"On Ord", d.FieldStr(0, "")}) 'fnORD 
                dt.Rows.Add(New Object() {"SPO", d.FieldStr(0, "")}) 'fnSPOSOLD 
                dt.Rows.Add(New Object() {"TBR", d.FieldStr(0, "")}) 'fnTBR 
                dt.Rows.Add(New Object() {"Minimum", d.FieldStr(0, "Minimum")}) 
                dt.Rows.Add(New Object() {"Reorder", d.FieldStr(0, "Reorder")}) 
 
        End Select 
        g.ItemsSource = dt 
    End Sub

<UserControl x:Class="InvGrid" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:dg="http://schemas.microsoft.com/wpf/2008/toolkit"   
    Height="Auto" Width="Auto" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    <UserControl.Resources> 
        <ResourceDictionary> 
            <Style TargetType="telerik:GridViewRow" x:Key="RowStyle"
                <Setter Property="MinHeight" Value="18"/> 
                <Setter Property="FontSize" Value="14"/> 
                <Setter Property="Foreground" Value="Black"/> 
            </Style> 
            <ResourceDictionary.MergedDictionaries> 
                <ResourceDictionary Source="Dictionary1.xaml"/> 
            </ResourceDictionary.MergedDictionaries> 
        </ResourceDictionary> 
    </UserControl.Resources> 
    <Grid x:Name="Container"
        <Grid Margin="0,0,0,0" Name="Grid1"
            <Grid.ColumnDefinitions> 
                <ColumnDefinition x:Name="Column1" MinWidth="200"    /> 
                <ColumnDefinition x:Name="Column2" MinWidth="200"  /> 
                <ColumnDefinition x:Name="Column3" MinWidth="200"  /> 
                <ColumnDefinition x:Name="Column4" MinWidth="200" /> 
                <ColumnDefinition x:Name="Column5" MinWidth="200"  /> 
            </Grid.ColumnDefinitions> 
            <telerik:RadGridView Name="grd1" RowStyle="{StaticResource RowStyle}" Background="White" RowIndicatorVisibility="Collapsed"  IsFilteringAllowed="False" Grid.Column="1" Height="198"  Width="200" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserSelect="False" CanUserSortColumns="False" CanUserFreezeColumns="False" CanUserDeleteRows="False" ShowColumnHeaders="False" ShowGroupPanel="False" FontFamily="Microsoft San Serif" FontSize="13" IsTabStop="False" IsHitTestVisible="False" BorderThickness="1" ShowGroupFooters="False" ScrollMode="RealTime"  MinHeight="26" BorderBrush="Black" Foreground="Black" ClipToBounds="False" /> 
            <telerik:RadGridView Name="grd2" RowStyle="{StaticResource RowStyle}" Background="White" RowIndicatorVisibility="Collapsed"  IsFilteringAllowed="False" Grid.Column="2" Height="158"   Width="150" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserSelect="False" CanUserSortColumns="False" CanUserFreezeColumns="False" CanUserDeleteRows="False" ShowColumnHeaders="False" ShowGroupPanel="False" FontFamily="Microsoft San Serif" FontSize="13" IsTabStop="False" IsHitTestVisible="False" BorderThickness="1" ShowGroupFooters="False" ScrollMode="RealTime"  MinHeight="26" BorderBrush="Black" /> 
            <telerik:RadGridView Name="grd3" RowStyle="{StaticResource RowStyle}" Background="White" RowIndicatorVisibility="Collapsed"  IsFilteringAllowed="False" Grid.Column="3" Height="198"   Width="150" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserSelect="False" CanUserSortColumns="False" CanUserFreezeColumns="False" CanUserDeleteRows="False" ShowColumnHeaders="False" ShowGroupPanel="False" FontFamily="Microsoft San Serif" FontSize="13" IsTabStop="False" IsHitTestVisible="False" BorderThickness="1" ShowGroupFooters="False" ScrollMode="RealTime"  MinHeight="26" /> 
            <telerik:RadGridView Name="grd4" RowStyle="{StaticResource RowStyle}" Background="White" RowIndicatorVisibility="Collapsed"  IsFilteringAllowed="False" Grid.Column="4" Height="198"   Width="150" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserSelect="False" CanUserSortColumns="False" CanUserFreezeColumns="False" CanUserDeleteRows="False" ShowColumnHeaders="False" ShowGroupPanel="False" FontFamily="Microsoft San Serif" FontSize="13" IsTabStop="False" IsHitTestVisible="False" BorderThickness="1" ShowGroupFooters="False" ScrollMode="RealTime"  MinHeight="26" /> 
        </Grid> 
    </Grid> 
</UserControl> 

Milan
Telerik team
 answered on 08 Feb 2010
2 answers
219 views

Hi,

I'd like to implement an MDI-like workspace in xbap application, is there any container for multiple RadWindows?

In my xbap application, I'd like the content-region would hold multiple RadWindows which can be dragged around, minimized, maximized, etc.

For dragging, I'd like it so that the windows themselves cannot be dragged outside of the mdi-window content region.

I'd appreciate any help/sample solution on how to implement this.

My xaml code is as follows:I have try to create MDI RadWindows in container1, but failed.

        <telerik:RadDocking Name="radDocking1" Grid.Column="1" Grid.Row="1" AllowUnsafeMode="True">  
            <telerik:RadDocking.DocumentHost> 
                <telerik:RadSplitContainer InitialPosition="DockedLeft" Name="container1" HorizontalContentAlignment="Left">  
                    <telerik:RadPaneGroup Name="editGroup">  
                    </telerik:RadPaneGroup> 
                </telerik:RadSplitContainer> 
            </telerik:RadDocking.DocumentHost> 
 
            <telerik:RadSplitContainer telerik:DockingPanel.InitialSize="150,150" InitialPosition="DockedBottom" Height="250">  
                <telerik:RadPaneGroup Name="listGroup">  
                    <telerik:RadDocumentPane Title="Error Message" Name="errorMSGPane">  
                        <telerik:RadDocumentPane.Content> 
                            <TextBlock Name="tberrorMSG" Foreground="Red"</TextBlock> 
                        </telerik:RadDocumentPane.Content> 
                    </telerik:RadDocumentPane>                      
                </telerik:RadPaneGroup> 
            </telerik:RadSplitContainer> 
 
        </telerik:RadDocking> 

xu jundong
Top achievements
Rank 1
 answered on 08 Feb 2010
2 answers
144 views
Hi, I need your help.
While in a RadPaneGroup, I can accomplish this by using " ((RadDocumentPane)radPaneGroup.SelectedItem).Name; " to get it.
but how to get the selected RadDocumentPane when I have dragged it out from a RadPaneGroup?

Thank you!

xu jundong
Top achievements
Rank 1
 answered on 08 Feb 2010
2 answers
75 views
Hi,I have a problem.
While using the RadDocumentPane control, how can I add a minimizeButton or maximizeButton on it?
Is there any minimizeButton or maximizeButton on the RadDocumentPane control?

Thank you!
xu jundong
Top achievements
Rank 1
 answered on 08 Feb 2010
2 answers
62 views
Hello,

It looks like using a filter on one of my grid columns stops RowEditEnded from being invoked properly after the filtering.

I'm binding my grid to an ObservableCollection<> of business objects, and I have everything set up so updating/inserting rows works properly in most cases.  However I've noticed that if I use a column filter and narrow down the rows displayed, for example to only those rows including certain text in that column, that any subsequent edits won't be saved because RowEditEnded no longer gets invoked when I finish editing one of the remaining rows.

Have you seen this behavior before?  Is there something I'm doing wrong, or is this a known issue? 

I can submit a ticket and provide a sample project if necessary.

Thanks for any help you can provide!

Eddie
Eddie
Top achievements
Rank 2
 answered on 05 Feb 2010
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?