Ok. I know wpf and am learning programming windows runtime via c# and xaml.
Both use xaml that have the same namespace. Win rt is new and has the same namespace declared at the root element.
What are the similarities and differences.
Here are some of the differences between WPF and WinRT:
Different XML namespace declaration in XAML code (Instead of using a clr-namespace:/assembly= qualifier set for code-to-XAML namespace references, you use the using: qualifier. XAML namespaces no longer reference specific assemblies)
Missing Expression SDK in WPF
Missing Property-/DataTriggers in WPF
Reduced BindingMode enum
Missing Multi/Priority Binding in WPF
Missing RoutedCommands in WPF
Missing InputBindings in WPF
DependencyProperty value calculation goes without coercion and validation
There are lot more differences. You can check this link to know further.
Related
Our company is trying to setup a framework with default styling for the different UWP controls and maybe even a few custom controls.
We do this in a solution i will refer to as "Core" for this post.
The different applications that we create have a reference to this Core.
In the root of Core we have a Resource Dictionary called CoreStyle.xaml which merges all the different ResourceDictionaries with Core together.
This works flawlessly using a structure as:
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///Core.UWP.Presentation/ControlStyles/RelativePanel.xaml" /> <--- the Namespace here is different because it is in the same solution and it is a Project reference.
</ResourceDictionary.MergedDictionaries>
Now what we would like to accomplish is the following within the App.xaml of an app:
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///ChipSoft.Mobile.Core.UWP.Presentation/CoreStyle.xaml"/> <--- The Namespace here is the full namespace because it is a DLL reference
</ResourceDictionary.MergedDictionaries>
For some reason this does not work however.
The exception we are getting is:
Failed to assign to property 'Windows.UI.Xaml.ResourceDictionary.Source' because the type 'Windows.Foundation.String' cannot be assigned to the type 'Windows.Foundation.Uri'. [Line: 17 Position: 37]
Does anyone have a clue how to accomplish this?
Just for extra measure we are looking for a way to do this in UWP (W10), the WPF, SilverLight and even the posted above Windows 8.1 App way of doing this all do not work.
I am using Netbeans and Scenebuilder to create a JavaFX project. I realized that Scenebuilder does not have a date picker component so I downloaded the jfxtras and added the library to my classpath. I used the following code to add the CalendarTextField Object to my FXML file:
<?import jfxtras.labs.scene.control.*?>
<CalendarTextField fx:id="setupdate" prefWidth="200.0" showTime="true" GridPane.columnIndex="3" GridPane.rowIndex="8" />
It appeared to have worked ok, however, when I opened my FXML file in Scenebuilder I am getting the following error:
fxml:99: error:
javafx.fxml.LoadException: Element does not define a default property.
I am not sure what this means.
Java 8 DatePicker
Use Java 8 + SceneBuilder 2, it has a DatePicker.
Both are early access (especially SceneBuilder 2). Don't expect much in the way of SceneBuilder 2 stability for a little while, it's implementation is currently pretty rough and not as polished as SceneBuilder 1.1.
jfxtras and fxml
With regards to the use of jfxtras controls in SceneBuilder 1.1, my guess is that it is just not supported.
In order to build the jfxtras controls for Java 7, it was necessary for the jfxtras developers to make use of private APIs as feature complete public APIs for building custom controls are not available in Java 8. Usage of private APIs may cause compatibility issues with different SceneBuilder versions as it ties the control binaries to only work with certain JavaFX versions (as backward compatibility of private JavaFX apis is not guaranteed in new Java versions).
Also, the jfxtras developers may not have implemented the builder classes required to make their controls work with FXML. This would seem to be the case, as lack of an appropriate builder is what generates the error: javafx.fxml.LoadException: Element does not define a default property.
Implementing your own builder
You can read more about builders and fxml in an Introduction to FXML. You could implement a builder for the jfxtras CalendarTextField if you wish (I will not write one in this answer though). If you did implement an appropriate builder, there is a reasonable chance that you would then be able to use the control in FXML used by SceneBuilder 1.1.
I have VB6 ActiveX (e.g. MyActiveX) that is used from MFC:
m_pControl = new CWnd;
m_pControl->CreateControl("MyActiveX.MainControl",
"",
WS_VISIBLE,
rc,
this,
5000,
NULL,
FALSE,
NULL);
When I remove some unused function or move variable (not used outside VB ActiveX), VB6 warns about breaking compatibility. I chose to break compatibility but now the VB6 ActiveX is not shown properly from MFC application.
As I understand, breaking compatibility will create new UUID for the interface and type library. That is fine as long as I can do something to make it work again, and since I am using a string ProgID MyActiveX.MainControl, I think my MFC app shouldn't get affected.
Edit:
As I understand from Resetting project compatibility in vb6, breaking compatibility is okay as long as I rebuilt projects that refer to it. But from MFC, I only refer to the VB project using a string MyActiveX.MainControl so I don't see why I should rebuild my MFC app; and even after rebuilding my C++ MFC app, the VB ActiveX is still not properly shown.
Only two functions in VB6 ActiveX that are actually used from C++ MFC side. That's why I removed/moved some other functions and variables that are only used from within VB6 ActiveX. So I'm not sure why it stopped being displayed properly
No. VB6 is right. The Problem is about the Interface you use, the properties and Events.
It depends on how you integrated the Control into the MFC. As Long as all DispIds (dispatch Ids from the IDispatch Interface) are stable, and as Long as all function you use are still available you don't have a problem.
If DispIDs are changing, function prototypes change, you will get into Problems.
I have created an ActiveX control in VC++ 2012 using ATL. I would like to add a Font property and benefit from the stock property page that displays a font picker.
I have created a new control that has such a stock property using the control wizard. I've modified my code to reflect what I need to do to add the stock property. (I now implement ISpecifyPropertyPages; I have the relevant PROP_ENTRY_TYPE and PROP_PAGE entries in the property map) but when I attempt to display the property editor in the designer I get a 'Not Registered' type error.
I have ATL dynamically linked which, as I understand things, means I shouldn't need to link to any external DLL for ATL. However, where are the stock property pages implemented? Could it be that I don't have them, and need to register them somehow?
The problem you are perhaps facing is that stock property pages are hosted by MSSTKPRP.DLL and this component is not necessarily present/installed in Windows and is readily available. I would suggest not using stock property page and implement your own to avoid the troubling dependency.
See also:
Is there a x64 version of MsStkPrp.dll
Redistributing ATL and OLE DB Templates - at the bottom
Am I missing something or is there no documentation of WPF controls?
When I look at MSDN, it says to reference System.Windows.Controls
(http://msdn.microsoft.com/en-us/library/ms752069.aspx), but this is for winforms?
Where can I find the WPF object model?
Bam!
Documentation for all WPF classes.
The URL you provide in your question (http://msdn.microsoft.com/en-us/library/ms752069.aspx) is, in fact, the documentation path for WPF controls, not for WinForm controls (see http://msdn.microsoft.com/en-us/library/system.windows.forms.aspx for WinForms). To get to the members of Treeview, for example, walkthrough Control Library >> TreeView then again click Treeview in the Reference section. I think a subtle point of confusion to Winform-only developers is to think that System.Windows.Controls is for WinForm, when it is actually for WPF.
The URL Kevin provided (http://msdn.microsoft.com/en-us/library/system.windows.aspx) is also an important one to know: it is the main documentation path for all of WPF.
Finally, if you want to get a sense of the similarities and differences between controls in WinForm and WPF, take a look at my article on Simple-Talk.com
From WinForm to WPF: A Quick Reference Guide.