Notifications
Clear all

[Closed] WPF advantages and disadvantages

 MZ1

Would you please tell me What are the advantages and disadvantages of making UI with WPF?

15 Replies
2 Replies
(@denist)
Joined: 11 months ago

Posts: 0

according to my experience:

advantages:
#1: almost unlimited ability to make custom UI controls
#2: less flickers than .net forms

disadvantages
#1: slower than .net forms
#2: has more problems with redraw (update) and events handling especially if it’s added to mxs rollouts (plugins)

 MZ1
(@mz1)
Joined: 11 months ago

Posts: 0

Thank You, As always I have another questions :

1- How many custom controls we need to recreate? I mean controls like Spinner,Color Picker,etc which are not included in the WPF.
2- I know Max already created a library of custom controls for Ribbon (“WPFCustomControls.dll”), But they only work inside Ribbon. Is there any possible way to integrate them inside WPF controls?

Well, its has great support for binding controls with data, also scales well with different DPI’s. If you follow MVVM or MVC its great, but if you want something simple, it can become quite complex. Also if you target older frameworks, its slower, like DennisT as said, but we do use it max, just check our Nyx Voltron demo or Nyx DBR, no redraws or updates issues.

3 Replies
 MZ1
(@mz1)
Joined: 11 months ago

Posts: 0

1- Binding: (This question is not just about WPF) Is there any functionality-converter to bind WPF control to the max data? for example binding with max controller?
2- Speed: You and denisT talked about speed, If we compare it with dotnet (not max) controls, Is that slower only at creation time (like Ribbon :)) or in general is slower than dotnet.

(@denist)
Joined: 11 months ago

Posts: 0

#1 there is no way to bind a wpf (or .net form) control with max controller
#2 wpf controls are just slower… adding 100 items to System.Windows.Controls.ListView is slower than add them to System.Windows.Forms.ListView (at least it was slower the last time i’ve checked it)

(@dgsantana)
Joined: 11 months ago

Posts: 0

There are ways around this, and I think the lastest versions of .NET already solved this out of the box. Also as Dennis said, avoid any WPF custom control from 3dsmax libraries, they are messy and very bad optimized. You have better luck finding better ones in the wpf community, there are lots of open source libraries with this controls.

#1 you don’t need to recreate any basic controls. built-in wpf have them all. they might work different than a mxs control (like spinner) but can be adjusted to be similar

#2 WPFCustomControls.dll is made for max internal use and shouldn’t be used in general.(bad, slow, ugly) IMHO (and please don’t call me a negative person ;))

3 Replies
 MZ1
(@mz1)
Joined: 11 months ago

Posts: 0

I think spinner (NumericUpDown) is missing in built-in WPF, would you please tell me where I can find it?

#2 I’m completely agree with you

(@denist)
Joined: 11 months ago

Posts: 0

there are several examples of wpf numericupdown you can find on the internet. many of them are open source.
but the spinner is a basic control. you can use .net form’s one in combination with wpf…
you can host wpf controls in .net form environment and vise versa.

 MZ1
(@mz1)
Joined: 11 months ago

Posts: 0

About “ElementHost” is OK, but when I use “WindowsFormsHost” my max will crash!

lucky… or you have never really used it in max rollouts.

2 Replies
 MZ1
(@mz1)
Joined: 11 months ago

Posts: 0

Do we really have to use it inside max rollout? what if we just plug it above max rollout?

try
(
	cui.UnRegisterDialogBar MaxDialog
	destroydialog MaxDialog
)
catch()

rollout MaxDialog "" width:100 height:10000
(
	local ChildWindow
	
	fn MatchUI = 
	(
		if ChildWindow!=undefined do
		(
			ChildWindow.Left = (getdialogpos MaxDialog)[1]-2
			ChildWindow.Top = (getdialogpos MaxDialog)[2]-5
			ChildWindow.height = MaxDialog.height+10
			ChildWindow.Width = MaxDialog.Width+4
		)
	)
	
	on MaxDialog moved Val do
	(
		MatchUI()
	)
	
	on MaxDialog Resized Val do
	(
		MatchUI()
	)
	
	on MaxDialog close do
	(
		ChildWindow.close()
	)
)
createdialog MaxDialog style:#()

WPFWindow = dotnetobject "System.Windows.Window"
WPFWindow.ResizeMode = WPFWindow.ResizeMode.NoResize
WPFWindow.ShowInTaskbar = False
WPFWindow.WindowStyle = WPFWindow.WindowStyle.None
WPFWindow.WindowStartupLocation = WPFWindow.WindowStartupLocation.CenterOwner

MaxDialog.ChildWindow = WPFWindow
(dotnetobject "System.Windows.Interop.WindowInteropHelper" WPFWindow).owner = dotnetobject "IntPtr" (MaxDialog.hwnd)

WPFWindow.Show()

cui.RegisterDialogBar MaxDialog style:#(#cui_dock_all) minSize:1 maxSize:-1
cui.DockDialogBar MaxDialog #cui_dock_Left
(@dgsantana)
Joined: 11 months ago

Posts: 0

No, just WPF Windows, I had problems with max dialogs :D. We did had some versions with dockable max windows, but it had all sort of bad problems like, crashing on resize below minimum size.

hmm… what is the reason to use wpf this way? it should be just a wpf window with max application

1 Reply
 MZ1
(@mz1)
Joined: 11 months ago

Posts: 0

I’m not sure, but in this way I guess we don’t have any dependency to the max rollout redraw-update. This way comes to my head when I could not enter any number in the NumericUpDown (even with enabling-disabling accelerator). i don’t know it was bug or not, But solved this way.