In my project I added an XAML View, which doesn't have class behind, now I want to use this view for example on the page or some other class, but I don't know how?
You can add a code-behind file if you like. Make sure:
The XAML page has a x:Class attribute set to the name
Add a CS file in the same folder with the name [viewname].xaml.cs (where viewname must be replace with the name of the view)
Make the class public and partial
Once you've done that, it has a type that you can use to navigate to.
Related
I am using localization for view as given below.
<p>#Localizer["Use this area to provide additional information."]</p
I need to create a global resource file from where I can localize the string of view without using ViewModels folder in resource folder.
Resources/ViewModels/Account/RegisterViewModel.fr.resx
Is there any way to use localization of view without using IViewLocalizer or without using #Localizer in view?
here is how to do it :
on your resx file properties, add "PublicResXFileCodeGenerator" for Custom tool.
It will generate the "designer file".
You need to do it only for main language file.
After that, on your view in cshtml, you can use it like this :
//my resource file is named Welcome.resx
<h1>#Welcome.Title</h1>
I have an scenario like, define a template for footer of my website in partial view. I have written the footer template in partial view. This partial view is placed in folder name "Common" in Views.
Now i want to use this footer partial view in another mvc application, because used the same footer template.
How can i refer the partial views in multiple applications, like having the partial views in class library?
Please guide me to go right way.
Regards,
Karthik.
for example, I hava a partial template named _header.php, I want to use it in both Post, Forum module, How can i write renderPartial(), to load this template.
placed your partial view to app layouts dir.
<?php
$this->renderPartial('//_header.php');
?>
absolute view within a module:
the view name starts with a single slash '/'. In this case, the view will be searched for under the currently active module's view path. If there is no active module, the view will be searched for under the application's view path.
absolute view within the application:
the view name starts with double slashes '//'. In this case, the view will be searched for under the application's view path. This syntax has been available since version 1.1.3.
reference getViewFile()
I am developing my web application in the Yii framework . I do not have enough experience in the Yii framework. I want to make the view for the index post page. The Yii provide the CListView for this, but I want to make some customization on that.
You can extend a widget with the following steps:
Copy CListView.php from /(yii root)/framework/zii/widgets to /(application root)/protected/widgets
Rename the file BineshListView.php
Open BineshListView.php. Add this before the class declaration
Yii::import("zii.widgets.CListView");
Change the first line of the class declaration to:
class BineshListView extends CListView { ...
Now, you have your own BineshListView class you can customize. To use it in a view, you can call it like you would CListView
$this->widget('application.widgets.BineshListView', array( 'data'=>$model, etc... ) );
Let me add that BineshListView will inherit all the properties and methods of CListView. Therefore, if you do not need to customize a property or method and want to use the original behavior of CListView, you can delete the property or method from BineshListView.
you no need to customize the ClistView . just simply make changes in the partial view file . which is called by the ClistView.
<?php
$this->widget('zii.widgets.ClistView',arrray(
'dataprovider'=>$your-data-provider,
'view-file'=>'custom-view-file'
));
?>
make changes in custom-view-file.
make sure the custom-view-file in same views folder for the controller.
I've got a MainPage.xaml page a Detail.xaml page.
I've passed variables to the Detail.xaml from MainPage.xaml by using a static variable and referencing it in Detail.xaml (the detail page is acting like a dialog). However once I've updated the content of another object, I want to call a method in MainPage.xaml to refresh the content of that page using the updated object from the Detail.xaml page.
I assume I am not using the correct paradigm for this and should probably be using MVVM or something but I'm not familiar with the implementation and was hoping there was a simple way to do this?
Can you load the content from the static into your control in the OnNavigatedTo?
You can make a method in your main page to do that job and call that.