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.
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.
I have created dll out of a c# project say "a.dll", this project has some UIs with Charm Flyouts.
now i am adding this dll into another C# project say "b",so that i can see the Charm Flyouts
in the "b" project. but i am not able to see the Flyouts , I don't know what exactly the problem is. For sake i changed the Page name as i thought there may be some conflict between
page name as both the projects have same page name as MainPage.
Please help me to do this,thanks.
Not sure if this is it, but I've ran into a somewhat similar problem with images from ProjectA, where I want them to be shown in ProjectB. This however is not possible in Store Projects, the image should be in the same project and cannot be referenced from ProjectB to ProjectA (without returning any error).
A workaround (if possible) would be to put the two projects in the same solution and add the charm flyouts (if they are images) as linked items in ProjectB...
Hope this gets you towards a solution.
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.
From this page,
http://www.yiiframework.com/wiki/23/how-to-create-a-breadcrumb-widget/
It seems it suggests that we should put the files in the component folder. But if my widget contains javascript and css files, where should these files be placed?
By the way, is this a good idea that I create it as an extension? If I go this way, all widget files are more self-contained in a folder inside the extension folder. But since the widget I am going to work on is very customized, it's unlikely that it will be useful to other people or my other projects. Making it an extension seems a little bit strange.
I understand that it does not really matter where I put these files as long as the paths I am using in the codes are correct but I would like to know the common practice.
I think the common practice is to put the widget in extensions folder with js & css files in an folder named asset. In the php class file, you do initialization first by publishing the asset with yii asset manager.
The file structure may be like
extensions/
widget_name/
widget.class.php
assets/
plugin.js
style.css
I would join the recommendation to put the widget under /protected/extensions.
I put the assets in a slightly more detailed manner: /protected/extensions/WidgetClassName/assets/ and the widget view files in /protected/extensions/WidgetClassName/views/...
Don't forget to edit your /protected/config/main.php and add a row in the 'import' section (for autoloading of the widget): 'ext.WidgetClassName.WidgetClassName.*'
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.