Telerik Forums
UI for WPF Forum
6 answers
164 views
In the good old version of RadGrid in Asp.Net, it's documented how to use an EditForm with Insert/Update/Cancel, but how is this done in WPF when using MVVM pattern?

I can not find anything in the docs about RadGrid when using MVVM. Is there a separate documentation, or is Telerik ignoring the pattern?
Jason
Top achievements
Rank 1
 answered on 15 Nov 2011
2 answers
91 views
I feel like I must be missing something simple, but I've been through the examples and can't find anything.  I have a gridview bound to a datatable.  The values populate fine, but when I try to edit, the textbox shows up blank.  It works fine if I set AutoGenerateColumns="true", I need to be able to set it to false

<telerik:RadGridView Margin="10,10,10,10" Name="rgridUsers" ItemsSource="{Binding}" RowIndicatorVisibility="Collapsed" ShowGroupPanel="False"
     SelectionMode="Extended" AutoGenerateColumns="False" CanUserFreezeColumns="False">
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding User}" Header="Users" />
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Active}" Header="Active" />
        <telerik:GridViewColumn>
            <telerik:GridViewColumn.CellTemplate>
                <DataTemplate>
                    <telerik:RadButton Command="Delete">
                        <Image Source="Images/Delete.png" />
                    </telerik:RadButton>
                </DataTemplate>
            </telerik:GridViewColumn.CellTemplate>
        </telerik:GridViewColumn>
 
    </telerik:RadGridView.Columns>
 
</telerik:RadGridView>


      DataTable dt = new DataTable();
public Administration()
 {
     InitializeComponent();
 
 
     dt.Columns.Add("User", typeof(string));
     dt.Columns.Add("Active", typeof(bool));
 
     DataRow row;
     row = dt.NewRow();
     row["User"] = "User1";
     row["Active"] = true;
     dt.Rows.Add(row);
     row = dt.NewRow();
     row["User"] = "User2";
     row["Active"] = true;
     dt.Rows.Add(row);
     row = dt.NewRow();
     row["User"] = "User3";
     row["Active"] = false;
     dt.Rows.Add(row);
     row = dt.NewRow();
     row["User"] = "User4";
     row["Active"] = true;
     dt.Rows.Add(row);
     row = dt.NewRow();
     row["User"] = "User5";
     row["Active"] = false;
     dt.Rows.Add(row);
     row = dt.NewRow();
     row["User"] = "User6";
     row["Active"] = true;
     dt.Rows.Add(row);
 
     rgridUsers.ItemsSource = dt;
 }

Gama
Top achievements
Rank 1
 answered on 15 Nov 2011
1 answer
107 views
Hello,

I would like to use the loading indicator in the WPF GridView for when the DataLoadMode is asynchronous.

I also intend to use instances of the BusyIndicator control in other areas of my application.

I would like the loading indicator in the GridView to look the same as my instances of the BusyIndicator control - is it possible to change the style of GridView indicator? If so, please could you provide an example?

Thanks,

Tom
Vanya Pavlova
Telerik team
 answered on 15 Nov 2011
6 answers
148 views
Hi,

I'm using WPF controls version 2011.2.712.35.
Randomly getting following exception below.

If there is a workaround to this exception please let me know.

Thanks,
Ruben

at Telerik.Windows.Controls.RadTreeView.InheritTreeProperties(RadTreeViewItem treeViewItem) in c:\TB\101\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\TreeView\RadTreeView.CommonItemContainer.cs:line 600
at Telerik.Windows.Controls.RadTreeView.PrepareContainerForDescendant(DependencyObject element, Object item, ItemsControl owner) in c:\TB\101\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\TreeView\RadTreeView.CommonItemContainer.cs:line 152
at Telerik.Windows.Controls.RadTreeViewItem.PrepareContainerForItemOverride(DependencyObject element, Object item) in c:\TB\101\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\TreeView\RadTreeViewItem.cs:line 1513
at System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.PrepareItemContainer(DependencyObject container, Object item)
at System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainer(DependencyObject container)
at Telerik.Windows.Controls.TreeView.TreeViewPanel.InsertContainer(Int32 childIndex, UIElement container, Boolean isRecycled) in c:\TB\101\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\TreeView\Virtualization\TreeViewPanel.cs:line 2257
at Telerik.Windows.Controls.TreeView.TreeViewPanel.AddContainerFromGenerator(Int32 childIndex, UIElement child, Boolean newlyRealized) in c:\TB\101\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\TreeView\Virtualization\TreeViewPanel.cs:line 2309
at Telerik.Windows.Controls.TreeView.TreeViewPanel.MeasureOverride(Size constraint) in c:\TB\101\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\TreeView\Virtualization\TreeViewPanel.cs:line 1454
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
Petar Mladenov
Telerik team
 answered on 15 Nov 2011
0 answers
173 views
So, I figured out how to create the Child grid int he code behind, but now I need to have a click event on the Child grid rows. With the following code I get a "Handler type is mismatched" on the order.AddHandler line.

Any help on how to get this to work?

Thanks,

Doug

    private void rgvPatientImages_DataLoading(object sender, Telerik.Windows.Controls.GridView.GridViewDataLoadingEventArgs e)
    {
        GridViewDataControl dataControl = (GridViewDataControl)sender;
 
        if (dataControl.ParentRow != null)
        {
            dataControl.BorderThickness = new Thickness(0, 1, 0, 1);
            dataControl.GridLinesVisibility = GridLinesVisibility.None;
            dataControl.CanUserFreezeColumns = false;
            dataControl.ShowGroupPanel = false;
            dataControl.AutoGenerateColumns = false;
            dataControl.ChildTableDefinitions.Clear();
            dataControl.IsReadOnly = true;
            dataControl.SelectionMode = SelectionMode.Single;
            dataControl.SelectionUnit = GridViewSelectionUnit.Cell;
 
            GridViewDataColumn customerId = new GridViewDataColumn();
            customerId.Header = "Customer Id";
            customerId.DataMemberBinding = new Binding("CustId");
            customerId.DataType = typeof(int);
            dataControl.Columns.Add(customerId);
 
            GridViewDataColumn order = new GridViewDataColumn();
            order.UniqueName = "OrderIdId";
            order.Header = "Order Id";
            order.DataType = typeof(int);
 
            order.AddHandler(MouseLeftButtonDownEvent, new EventHandler<MouseButtonEventArgs> (orderId_MouseLeftButtonUp));
            dataControl.Columns.Add(order);
     }
}
 
    private void orderId_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
    {
        object ID = ((Button)sender).CommandParameter;
 
        CustomerOrder NewWindow = new CustomerOrder();
        NewWindow.orderId = Convert.ToInt32(sender.ToString());
        NewWindow.Show();
        this.Close();
    }
Doug
Top achievements
Rank 1
 asked on 15 Nov 2011
10 answers
203 views
Hello,

I have a Problem with the Databinding to a RichTextBox that is located in a Datatemplate for a RadCarousel.

Here my Xaml:

<DataTemplate x:Key="customItemTemplate">
                    <Border Background="LightSlateGray" Padding="10">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />                                
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="600" />         
                            </Grid.RowDefinitions>                         
                            <telerik:RadRichTextBox Name="radRichTextBox"
                                    IsReadOnly="True"
                                    HorizontalAlignment="Stretch"
                                    VerticalAlignment="Stretch" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="5">
                                <telerik:RadDocument LayoutMode="Paged">
                                    <telerik:Section PageMargin="10, 10, 10, 10">                                     
                                        <telerik:Paragraph TextAlignment="Left">
                                            <telerik:Span Text="{Binding Redner}" />                                          
                                            <telerik:Span FontWeight="Bold" Text=" RadRichTextBox!" />
                                        </telerik:Paragraph>                                    
                                        <telerik:Paragraph>
                                            <telerik:Span FontWeight="Bold" Text="RadRichTextBox" />
                                            <telerik:Span Text=" is a control that is able to display and edit rich-text content including  formatted  text arranged in pages, paragraphs, spans (runs) etc." />
                                        </telerik:Paragraph>
                                        <telerik:Table LayoutMode="AutoFit">
                                            <telerik:TableRow>
                                                <telerik:TableCell>
                                                    <telerik:Paragraph>
                                                        <telerik:Span Text="Cell 1" />
                                                    </telerik:Paragraph>
                                                </telerik:TableCell>
                                                <telerik:TableCell>
                                                    <telerik:Paragraph>
                                                        <telerik:Span Text="Cell 2" />
                                                    </telerik:Paragraph>
                                                </telerik:TableCell>
                                            </telerik:TableRow>
                                            <telerik:TableRow>
                                                <telerik:TableCell ColumnSpan="2">
                                                    <telerik:Paragraph>
                                                        <telerik:Span Text="Cell 3" />
                                                    </telerik:Paragraph>
                                                </telerik:TableCell>
                                            </telerik:TableRow>
                                        </telerik:Table>
                                    </telerik:Section>
                                </telerik:RadDocument>
                            </telerik:RadRichTextBox>
                        </Grid>
                    </Border>
                </DataTemplate>
            </Grid.Resources>

The first Problem is the access to the line with <telerik:Span Text="{Binding Redner}" />
How can I make a Binding from Code-behind to the Controls in the Datatemplate?
The second Question is: How can i Bind the Width from the Carousel-Item to the Variable Monitor-Resolution? I need a Width with max 90% from the Carousel.

Sorry for my bad English. I hope you now what i mean.

Thank You



Johann
Top achievements
Rank 1
 answered on 15 Nov 2011
1 answer
105 views
Hi,

i have a GridView with Hierarchy.

1.How can i hide the expand Button.
2.How can i expand with the SelectChanged-Event. And i need the information from the Selected Row.

In your Forum i found a older Solution, but it wont work with the actual Telerik-Build.

Thank you

Nick
Telerik team
 answered on 15 Nov 2011
0 answers
231 views

Hello Telerik team,

When a user enters a value in the editable textbox of the RadCombobox that doesn't matches any of the available list of items then though the selected value is set to null , the text remains in the editable textbox even on lost focus of the RadCombobox.

I have a requirement where I have to perform a validation when the user tabs out of the editable RadCombobox or tries to click on a different control. The validation is to verify if the text entered by the user is available in the list of items and if not then alert the user of this and open the dropdown.

I implemented this validation on PreviewLostKeyboardFocus event as given below. But the problem is this event gets fired even when the focus enters the RadCombobox.

After the Ok button of the alert is clicked and then when I try to click of the dropdown's button, this event gets fired again and so the alert.

Why does this event fires when the focus enters the radcombobox.

Could you please guide me.

private void radCmbCustomer_PreviewLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
        {
            if ((sender as RadComboBox) != null
                && ((sender as RadComboBox).ItemsSource as Customer[]) != null)
            {
                Customer[] larrCustomer = ((sender as RadComboBox).ItemsSource as Customer[]);
  
                /*Check if the code entered by the user*/
                TextBox txtEditableTextBoxRadCmbCustomer = radCmbCustomer.Template.FindName("PART_EditableTextBox", radCmbCustomer) as TextBox;
  
                if (txtEditableTextBoxRadCmbCustomer != null)
                {
                    string lstrCustomer = txtEditableTextBoxRadCmbCustomer.Text;
  
                    if (lstrCustomer != null && !lstrCustomer.Trim().Equals(string.Empty))
                    {
                        var lvarCustomerRecordsMatched = from lobjCustomer in larrCustomer
                                                        where lobjCustomer.CustomerName.ToUpper() == lstrCustomer.ToUpper()
                                                        select lobjCustomer;
  
                        if (lvarCustomerRecordsMatched != null && lvarCustomerRecordsMatched.ToList<Customer>().Count <= 0)
                        {
                            MessageBox.Show("The text you entered isn't an item in the list. \nSelect an item from the list, or enter text that matches one of the listed items.", "Alert");
  
                            radCmbCustomer.IsDropDownOpen = true;
                            txtEditableTextBoxRadCmbCustomer.Focus();
                            e.Handled = true;
                            return; 
             }
                    }
                }
            }


Thanks,
Regards,
Mausami


Mausami
Top achievements
Rank 1
 asked on 15 Nov 2011
0 answers
145 views
Hi,

I am using special slots to differentiate working hours and non working hours in scheduleview. For non working hours I change the background color just to indicate that the slot is not available. My problem is if two slots with the same time-span are added in special slot list then I get the slot background color very darker. For example, I add the slots which are in the past time to special slot collection. If the current time is 11 AM then the slot (12 am - 10:59am) is added in special slots. So It is reflected in Scheduleview and background color is changed. Now I have one more slot for setting the day break. The slot (10am-10:30am) is the break time. So I also need to add this in the special slot collection. If I add this the bg color of the break slot is very darker when compared to others. Because already one slot ( from 12 am -10:59) is a special slot. I dont want this to happen. HOw to do this?

With Thanks and Regards
Jeyakumar
jeya
Top achievements
Rank 1
 asked on 15 Nov 2011
1 answer
108 views
Hello,

I have a treelistview.  When user right click on an item and applies filter then I add one FilterDescriptor to the treelistview.
But it tries to filter on all the rows. My requirement is when user right click on any item then the filter should be applied only to the expanded nodes, not to those are collapsed nodes.

I have treelistview having upto 7 levels of expanded nodes. What i want is when user applies filter descriptor then it should filter all the data whose first level is expanded

Level 1 Level 2 Level 3 Level 4 Level 5 Level 6 Level 7
(-) Org
Dept 1
Cell 1
Mgr 1
Lead 1
Resp 1
Work1
Work2
Work3
Resp 2
Work4
Work5
Work6
(+) Dept 2
(+) Dept 3
(-) Dept4
Cell 4
Mgr 4
Lead 4
Resp 4
Work1
Work2
Work3
Resp 4
Work4
Work5
Work6
Dept 2 & Dept 3 are not in expanded state. While I filter I want the filter should be applied to those records of Dept 1 & Dept 4 only
User can right click on Level 7 data
.
Manishkumar
Top achievements
Rank 1
 answered on 15 Nov 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?