Telerik Forums
UI for WPF Forum
8 answers
223 views

Hi,

I am trying to drop shape into a container shape, but the shape is not displaying inside the container. Could anyone help me solve it? Here is my code.

 

EventManager.RegisterClassHandler(typeof(RadDiagramContainerShape), RadDiagramShape.DropEvent, new System.Windows.DragEventHandler(OnDrop));

 

 

private void OnDrop(object sender, System.Windows.DragEventArgs e)
        {
            e.Handled = true;
            if ((e.Data as DataObject)?.GetData(typeof(DragObject)) is DragObject dragObject)
            {
                var itemBase = (ActivityBase)Activator.CreateInstance(dragObject.ContentType);
                var p = e.GetPosition(MainDiagram);
                var shape= createDiagramShape(itemBase);
 
                RadDiagramContainerShape target = (sender as RadDiagramContainerShape);
                target.Items.Add(shape);
            }
        }
 
 
private RadDiagramShape createDiagramShape(ActivityBase activity)
        {
            var shape = new RadDiagramShape
            {
                Content = activity,
                BorderThickness = new Thickness(1),
                UseGlidingConnector = true,
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                VerticalContentAlignment = VerticalAlignment.Stretch,
                DataContext = activity,
                UseDefaultConnectors = false,
                IsRotationEnabled = false,
                 
                Background = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255)),
                GlidingStyle = GlidingStyle.Rectangle
            };
 
            var outconnector = new InOutConnector
            {
                Offset = new Point(1, 0.2),
                Direction = eDirection.drOut,
                Name = "out" + DateTime.Now.Millisecond
            };
            shape.Connectors.Add(outconnector);
 
            var inconnector = new InOutConnector
            {
                Offset = new Point(0, 0.2),
                Direction = eDirection.drIn,
                Name = "in" + DateTime.Now.Millisecond,
            };
            shape.Connectors.Add(inconnector);
            return shape;
        }

 

 

The following function to drop shape inside the diagram works.

private void OnDropShape(object sender, DragEventArgs e)
        {
            e.Handled = true;
            if ((e.Data as DataObject)?.GetData(typeof(DragObject)) is DragObject dragObject)
            {
                var itemBase = (ActivityBase) Activator.CreateInstance(dragObject.ContentType);
                var p = e.GetPosition(MainDiagram);
                var shape = createDiagramShape(itemBase);
 
                MainDiagram.AddShape(shape, MainDiagram.GetTransformedPoint(p));
                _mainViewModel.ShapeCollection = MainDiagram.Shapes;
                _mainViewModel.SelectedActivity = calendar.DataContext as ActivityBase;
                 
            }
        }

 

 

Thanks,

Rahul

Martin Ivanov
Telerik team
 answered on 02 Jan 2020
1 answer
105 views

If there is only one wizardpage in the WizardPages collection, the AllowFinish property is ignored completely and the Finish button is enabled even if set to false directly or using a binding.

 

Using the latest version of UI for WPF.


Martin Ivanov
Telerik team
 answered on 01 Jan 2020
3 answers
377 views

I tried looking at the WPF GridView example for server side paging/sorting/filtering and it failed with an error. However I looked at the code and you are simply using entity framework to do all the work.

Are there any examples where I can use a different ORM like Ormlite? We don't use entity framework and frankly don't want to.

The only other solution for us would be to switch to using something like Kendo because then it is much easier in the web.

Aseman
Top achievements
Rank 1
Veteran
 answered on 01 Jan 2020
13 answers
3.9K+ views

Have a User Control that is called when a button "about" is pressed.

The UC works. Want to add a "Close" button that will close the window so it won't get orphaned later.

I could use the "IsVisible = Visibility.Collapsed;" which works but it is not really gone. The UC has to RadListboxes which collects different data in each box. When I use the "IsVisible = Visibility.Collapsed;" the box disappears. When click on the "About" button it reappears with previous data. I prefer to make it truly close/destroyed.

Is this possible and if so how? please.

What code do you need the XAML or the .CS?

herb
Top achievements
Rank 1
Veteran
Iron
 answered on 30 Dec 2019
9 answers
1.2K+ views
Hello Telerik Team,

I wanted to reduce the height of the header row but cannot figure out how. Setting the RowHeight property works only for the rows and not for the header row.

Is there a way to reduce the height of the header row?

Thanks,
Kumar
Martin Ivanov
Telerik team
 answered on 30 Dec 2019
4 answers
1.1K+ views

hello

I am trying to implement a Grid View with row number column and pagination.That is, the row number can also be changed when the page is changed

but the code I wrote is that the row number column on each page is only 1 to 10. And by going to the next page the row number starts again from 1 and does not increase to 11 and more.

this is my cs code for row number:

public override FrameworkElement CreateCellElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem)

        {
            TextBlock textBlock = cell.Content as TextBlock;

            if (textBlock == null)
            {
                textBlock = new TextBlock();
            }
            textBlock.Text = string.Format("{0}", this.DataControl.Items.IndexOf(dataItem) + 1);
            return textBlock;
        }

and xaml code:

<telerik:RadDataPager DisplayMode="all" PageSize="10" Source="{Binding Items, ElementName=RadGridView}"  />

also i need a label that represents the total number of Grid View rows. The value of this label must be updated by applying a filter or searching.

but my code always represents total number of Grid View rows and does not change with filtering.

 

Thanks!

Sara.

Sara
Top achievements
Rank 1
 answered on 28 Dec 2019
1 answer
299 views

Have a RadListbox, in xaml have set (SelectionMode="Multiple").

Want the user able to copy a selected item(s) and paste it anywhere (text file, excel, etc.) having issue finding topics in forum that helps me complete the operation of "copy".

Is there a method to do this?

Martin Ivanov
Telerik team
 answered on 26 Dec 2019
1 answer
122 views
I found a post from 2014 where telerik rep is stating that virtual scrolling will not work with dynamic data. is this still the case?

https://www.telerik.com/forums/virtual-scrolling-doesn't-work-with-dynamic-data
Martin Ivanov
Telerik team
 answered on 26 Dec 2019
10 answers
3.7K+ views
I'm building a rules engine that allows date constraints.  I want to be able to use a datetime picker to select the month and day, but I don't want to show the year.  Is this possible with your control?

Jason
Moses
Top achievements
Rank 1
 answered on 26 Dec 2019
1 answer
7.5K+ views

I have "Product" AutoCompletebox where the user type Product Name. When the user press enter, this "Product" will be added to the GridView and auto-focus to "Quantity "cell. (I've successfully developed this part.)

After the user type Quantity in GridView's Cell, I want to Commit and End Edit to this row and focus (cursor) return back to "Product" AutoCompletebox. This is the part that I don't know how to do it.

Currently I have tried something like the following:

private void RadGridViewInvoiceItems_CellEditEnded( object sender, GridViewCellEditEndedEventArgs e )
{
         if ( e.Cell.Column.Header.ToString() == "Quantity")
         {              this.gridView.CommitEdit();
                this.productAutoCompleteBox.Focus();            
         }
}

 

But the above code cause "StackOverFlow" exception. How should I solve this problem?

P.S. I have developed this app with C# Wpf with MVVM pattern.

I have "Product" Textbox where the user type Product Name. When the user press enter, this "Product" will be added to the GridView and auto-focus to "Quantity "cell. (I've successfully developed this part.)

After the user type Quantity in GridView's Cell, I want to CommitEdit to this row and focus return back to "Product" textbox. This is the part that I don't know how to do it.

Currently I have tried something like the following:

private void RadGridViewInvoiceItems_CellEditEnded( object sender, GridViewCellEditEndedEventArgs e )
{
      if ( e.Cell.Column.Header.ToString() == "Quantity" )
      {
           this.gridView.CommitEdit();
           this.productTextBox.Focus();
      }         
}

But the above code cause "StackOverFlow" exception. How should I solve this problem?

P.S. I have developed this app with C# Wpf with MVVM pattern and Telerik controls.

I have "Product" Textbox where the user type Product Name. When the user press enter, this "Product" will be added to the GridView and auto-focus to "Quantity "cell. (I've successfully developed this part.)

After the user type Quantity in GridView's Cell, I want to CommitEdit to this row and focus return back to "Product" textbox. This is the part that I don't know how to do it.

Currently I have tried something like the following:

private void RadGridViewInvoiceItems_CellEditEnded( object sender, GridViewCellEditEndedEventArgs e )
{
      if ( e.Cell.Column.Header.ToString() == "Quantity" )
      {
           this.gridView.CommitEdit();
           this.productTextBox.Focus();
      }         
}

But the above code cause "StackOverFlow" exception. How should I solve this problem?

P.S. I have developed this app with C# Wpf with MVVM pattern and Telerik controls.

Ras Ran
Top achievements
Rank 2
Iron
Veteran
Iron
 answered on 26 Dec 2019
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
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
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
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?