vb.net: Get to resources of a referenced project - vb.net

I have a project which contains all custom controls and images; we'll call it projectBase. Now I have created a windows forms project (project1) that references projectBase. I need to access the embedded resource (images) of projectBase in project1. Any idea how i can pull this off?

In project properties, under Resources, you have the Access Modifier at the top, which you can set as Public. Now you can access resources from the other project like this:
Dim someResource = MyReferencedProject.My.Resources.SomeResource

One option would be to expose the images as readonly properties of your custom control classes.

Related

Reduce DevExpress theme dll's on deploy folder

Using the
DevExpress Assembly Deployment Tool
helps finding out the needed dll's depending on your references. In my case I have as a reference just DevExpress.Xpf.Charts.v16.1.
The total amount of dll's to deploy from DevExpress is 33. From those, 20 are DevExpress.Xpf.Themes.XXX related.
I understand that depending on the context you can have different themes, like aero, metro, win xp...
Is there any way to reduce the amount of dll's in the deploy folder.
Or
Is there any way to 'fix'/'hardcore' the theme to be used and have just one of them deployed?
Refer this DevExpress Thread - Could not load file or assembly DevExpress.Xpf.Themes...
Starting with version 16.1, the default application theme is "Office2016White". Thus, it is required to add a reference to the DevExpress.Xpf.Themes.Office2016White.v16.1 assembly in your project if it uses the default theme.
In addition, the default theme is now applied to standard WPF controls, not only DevExpress ones.
To switch to another theme, use the ApplicationThemeHelper.ApplicationThemeName property. The DevExpress.Xpf.ThemeManager.ApplicationThemeName property has become obsolete.
To restore the old behavior, set the DevExpress.Xpf.Core.ApplicationThemeHelper.UseLegacyDefaultTheme property to true before the first reference to the DevExpress.Xpf.Core.v16.1 assembly. See the example below:
public partial class App : Application {
public App() {
ApplicationThemeHelper.UseLegacyDefaultTheme = true;
}
}
The value of the static Theme.Default property has been changed to Office2016White.
For the answer of you question, You can just add that theme assembly which your added controls use. If you have changed theme from different control by modifying some properties then you have to be careful about that required assemblies.
Hope this help..

Why can't i reference to a method/property? VB.NET

Please take a look at the 2 photos i attached, i wish to call the methods from one project to another. Both projects are in the same solution. I have already made the reference to the project containing the method in the project i want to call the method.
http://postimg.org/image/m42dlc28r/
http://postimg.org/image/w03gkz80r/
In your main project, go to
Project -> Add Reference
In that window, click browse and find the compiled version of your other project (Probably in the Release or Debug folder)
In your main projects window add this to the very top of your code (even above your class declaration)
Imports SecondProjectRootNamespace
That should give you enough information on how to do what your trying to do, but if anything was unclear, I am going to need all the details to provide a more precise answer.
Also, make sure your methods/functions are NOT declared as private.
Private = Method is only visible from within the same class
Friend = Method is only visible from any class within the same assembly (same .exe or .dll or etc)
Public = Method has no access restrictions
There are a few others but those are the basics
Try to find the dll file of the method that you want, then add it as reference in the properties of your application

Any designer-friendly way to reference static resources inside class libraries without importing in every xaml file?

I am building a universal class library with Xaml Views that need to statically reference custom resources (StaticResource) defined inside the same class library.
How can i do that in a designer friendly way without importing the resource file inside every view?
Using VS2013 Update 3. It seems that the designer works only for views inside the specific universal app projects and when the resources are defined inside App.xaml without merging.

Yii - Using alternate view file in Yii User module

Is it possible to use a custom view file in a module (eg. user) in order to keep the module (3rd party) intact?
Somehow extend the module, with a views folder that holds my custom views.
The path to the module theme views should be
/{{your_app_name}}/themes/{{theme_name}}/views/user/
Copy all of the module views from the folder
/{{your_app_name}}/protected/modules/user/views
to the mentioned above folder and that will do the job. After that you could customize the views as you like.
Copy user module view files to <app>/themes/<current_theme>/views/user/. More general, customize module views using the folowing "formula": <app>/themes/<current_tehem>/views/<modules_name>/<controller_name>/<view_file_to_customize>.php
Use a theme. For a module named "user" and a view path of "profile/edit", create "/themes/flashy/user/views/profile/edit.php". You can also define a new layout in "/themes/flashy/layouts/column2.php". Then add to your configuration file in "protected/config":
return array(
// many settings...
'theme' => 'flashy',
For the module "user" you pointed out, unfortunately its controllers use absolute paths for their layouts (e.g. "//layouts/columns2") so AFAIK you can't define distinct layouts for the application and this module.
See also the official guide chapter on theming with Yii.
I disagree that in many help forums of the Internet, when someone asks abot theming a module, everyone suggests a path alias to the themes folder. I think this is wrong, because it implies modules to be splitted, and modules are supposed to be a black-box that can be used across projects. The advice given in such forums would only be valid if a theme is shared among several modules. If someone wants to "package" a theme inside a module, she can:
-add an init function to the controller of the module
-inside that init, use the class attribute layout and a path alias, like this, supose a module whose id is "Sample":
then you add, to SampleCOntroller.php:
public function init() {
//BELOW: it will use the layouts/main.php inside the module.
$this->layouts = "sample.views.layouts.main";
}

Using ResourceDictionary from a DLL in Windows 8

How can I use the ResourceDictionary resource from the same DLL?
Basically I am trying to create a UI library with all classes derived from Page class. I want to keep all user interface pages in the same DLL.
To see the problem, from VS2012, create a Windows 8 library project, then add the Item Detailed Page. Now, if you open the created page from the editor, you will get some errors like "The resource "LayoutRootStyle" could not be resolved".
This is just a Xaml Designer error, so that will not prevent your project from building or running .
The only thing needed is that all the ResourceDictonary need to be referenced by the main application App.xaml (for example by using <ResourceDictionary Source="/<myLibraryName>/Common/StandardStyles.xaml"/> or by creating calling an Init method in the Library which will dynamically add the Resource dictionary).
A quick workaround for the error in the Xaml Designer is to just copy an App.xaml/App.xaml.cs in your library (but at runtime the main application will still need to have a reference on the needed ResourceDictionary since the App.xaml of the library will not be used).
Another posibility is to just add a refrence on the ResourceDictionary on each page but I believe that will be much more costly since it will create an instance of the dictionary for each page.