I am trying to build a Business Application using the AccentColor Theme by copy/pasting the styles into the asset folder and adding the Merged Dictionaries in the app.xaml. After getting everything in place, per the instructions, I get 100+ errors about controls that do not exist like the buttonspinner. I currently have the Silverlight 4 toolkit installed. What am I missing?
If the control isn't used in your solution, you'll get errors. You have 2 options:
-Comment out the styles for the controls you're not using.
-Create a page that has all the controls specified in the styles that you think you’ll use, and comment out the styles for the controls you're not using.
Related
We recently updated the styling of our app to use WinUI 2.x and while we generally like the changes we have found areas that look terrible and will require overriding the defaults. I looked for a file that would have the default XAML implementation/definitions associated with the new styles, something similar to what's in the generic.xaml file, but I was not able to find it. I would appreciate someone pointing me to this file, if it exists.
~Rich
The source code for the WinUI 2 controls and the XAML templates are available on GitHub.
For example, DropDownButton.xaml.
Vuetify allows us to change the default themes and presets by using a variables.scss/sass file in our project.
But I am unable to figure out how to change the font-style/font-weight (or any other global properties except the color) for the entire app, dynamically on the fly.
For Example:
We have a vue application running and the global font is currently set to Roboto,
What I want to do is provide a list of available fonts in a v-select and dynamically feed the selected value(suppose Raleway) in the variables.scss file or somehow trigger Vuetify to pick up the updated font-family (even other customizations), and change the default font to Raleway for the entire application.
I don't want to add classes everywhere. It won't be maintainable.
Any ideas on how can this be achieved?
Thanks in advance!
Changing the font app-wide is possible through the variables file as you mention, but this is a build-time decision. If you're wanting the user to swap out the font in the running app, there isn't any mechanism for this as far as I know, because the app is already compiled and running.
Is it possible to have all pages in a different project from where the app.xaml/cs is in?
I tested this by creating a new "Class Library (Universal Windows)" or "Windows Runtime Component" project, then I created the new pages in those projects.
After I add this project as a reference to the main UWP app and call the page(s) in the "rootFrame.Navigate(typeof(MainShellView), e.Arguments)" I get the exception
system.accessviolationexception attempted to read or write protected memory
Is it possible to have the pages, controls in different projects than the UWP main project and use them as references?
You will need to keep an empty/dummy MainPage.xaml page in the main project as there is a hard-coded reference to it in the project system. With that in place you can load all your pages (incl. the initial start page) from other projects that you are referencing in the solution.
I will log a bug on the hard-coded dependency on the existence of "MainPage.xaml". Thanks for reporting!
I'm writing a Windows Store app, and I'd like to know if it's possible to suppress the generation of the "Common" folder, containing the code from Microsoft, which - imho I do not need.
Any ideas?
Cheers
Common contains StandardStyles.xaml which per App.xaml:
<!--
Styles that define common aspects of the platform look and feel
Required by Visual Studio project and item templates
-->
<ResourceDictionary Source="Common/StandardStyles.xaml"/>
and in StandardStyles.xaml:
<!--
This file contains XAML styles that simplify application development.
These are not merely convenient, but are required by most Visual Studio project and item templates.
Removing, renaming, or otherwise modifying the content of these files may result in a project that
does not build, or that will not build once additional pages are added. If variations on these
styles are desired it is recommended that you copy the content under a new name and modify your
private copy.
-->
That said if you've determined it's not something you'll need just delete it, simpler and less fragile than hacking a T4 template (or whatever mechanism is used) for the code generation.
I am creating a number of WPF applications that all relate around one central WPF application and need to share the same styles and resources. In the first place I created a folder in my main project and added some XAML styles which all worked in displaying UI in the styles I wanted.
Later, I created another application but wanted to share the same styles so I moved the styles into a third project, added that project to the main application and added the reference to the styles project.
The problem is that the will not recognise my styles project. I prefixed the style with the project name and that did not work at all.
I have now got to the point where I can enter the entire relative path to the xaml files in the Path section of the ResourceDictionary and that works. However, If I move the project to another folder then that would fail. I suppose you may ask why I would do that and there are reasons, such as simply refactoring my project structure. Therefore, it would be easier to address the resources by reference rather than file.
I know the answer is inches away but I cannot find anything related to styles from another project.
I have had great feedback from this site so far and any help would be greatly appreciated.
OK, I have sussed it! Basically, you add your styles to a set of resource dictionaries in a separate project then you add the project to the solution and make a reference to it in your main project. I got that far but needed to reference the xaml resource files from my resources in my main project.
I tried using the full path name but while that worked, it was not a very good solution because if I move my project and re-link it, the file will because invalid.
The syntax I used that works is as follows:
<ResourceDictionary Source="/StyleResource;component/MSResources/TabControl.xaml" />
Where StyleResources is the name of my project that holds my shared styles, MSResources is the folder in the styles project that holds the xaml file and the file name at the end is obvious.
I have not yet read up about the “component” reference but it works so I will look at it later and update this post.