w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to bind caliburn.micro view model to WP8 LongListSelector control?
If i understand your question correctly, then you want normal Caliburn.Micro conventions to be applied to the LongListSelector control. I don't work with Windows Phone development but i think it can be done by calling the following line of code in the Configure() method of the bootstrapper. ConventionManager.AddElementConvention<LongListSelector>(LongListSelector.ItemsSourceProperty, "SelectedItem", "SelectionChanged"); This code tells Caliburn.Micro to use the ItemsSource property whenever it a finds a named (e.g. x:Name="myList") LongListSelector and to use the SelectedItem whenever a LongListSelector element is passed in the parameter list of an action message, and finally it uses the SelectionChanged event to fire action messages by default.

Categories : Windows Phone 8

Caliburn.micro design time data for WinRT - object reference not set to an instance of an object
First off, make sure you have got the namespaces configured correctly (this gives me a headache many times). Now with that out of our way, i can tell you to try too things: Try to add these to your namespace declarations mc:Ignorable="d" and xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006". If this alone didn't work then try to replace Type=vm:SampleNewsViewModel with Type={x:Type vm:SampleNewsViewModel and see if it works.

Categories : Xaml

WPF MVVM Bind User Control to Main Window View Model
try this : CustomerId="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.YourSelectedItem.TheProperty}" I am not sure how to manage your seleted item in window, so please change yourSelectedItem.TheProperty accordingly. Thaks

Categories : Wpf

Difference between window.title and document.title
The window object doesn't have a title property. http://www.w3schools.com/jsref/obj_window.asp Hope this helps! Cheers, LC

Categories : Javascript

Caliburn.Micro locking the main view
I've done this in the past... In your main/shell view - <ContentControl IsEnabled="{Binding UILocked, Converter={StaticResource BooleanInverter}}"> <SomeOtherControls..... blah blah /> </ContentControl> In the main/shell viewmodel - public bool UILocked { get { // getter } set { // prop changed code/setter etc... } } Upon setting UILocked to true the whole UI should be disabled. ContentControl will disable all child elements and IsEnabled bindings for its children will be ignored You can ensure that the main view subscribes to the event aggregator too: public class MainViewModel : IHandle<ChangeUIStateMessage> { public bool UILocked { get { // getter } set { // prop changed code/setter etc... } } public MainViewModel(IEventAggregator aggregator

Categories : C#

Caliburn.Micro can't match View and ViewModel from different assemblies
Check that you have selected your assembly for CM by overriding SelectAssemblies in your bootstrapper. The documentation here has an example: http://caliburnmicro.codeplex.com/wikipage?title=Customizing%20The%20Bootstrapper protected override IEnumerable<Assembly> SelectAssemblies() { return new[] { Assembly.GetExecutingAssembly() }; } Edit: Ok not only do you need to select assemblies to tell CM where to look - it sounds like in your case your VMs and your Views may be in different namespaces since you have them in separate libraries. You can use the same root namespace in both libraries and the standard view resolution should work fine - however, you need to make sure you have selected the assembly in the bootstrapper in order to tell CM what assemblies to try

Categories : C#

Caliburn Micro event on view/viewmodel closing
First: Quartz.NET runs inside your process, so it will be stopped anyway when your process ends Second: You can make your ViewModel implement IClose and put your code inside TryClose or derive from Screen and override OnDeactivate and put the code there.

Categories : C#

View Pager Title Strip to show one title Only
get pagerTitleStripe (pagerTitleStripe=(PagerTitleStrip) findViewById(R.id.pager_title_strip);) set alpha to 0 in secondary views (pagerTitleStripe.setNonPrimaryAlpha(0);) y listo!

Categories : Android

Null reference error "Object reference not set to an instance of an object" accessing Model while loading a view
You need to initialize the Model I suppose, just like we do in C#: Suppose we have a class, then we initialize the same like: Model m1= new Model(); Make sure you check the null also for all items you are passing.

Categories : Asp Net Mvc

Bind complex object model to view
There is no way to change that if you want MVC to do the automated binding. You could of course provide your own name if you wanted. However, a more recommended approach would be to build a ViewModel like this: public class SearchViewModel { public int AccountId { get; set; } public string AccountName { get; set; } ... } that flattened the complex model. The reason this is the recommended approach is because a View isn't really a complex model, it's simply a view of a more complex underlying model. You could then use an auto mapper to very easily map the flattened ViewModel back into the complex model at the very top of your controller method.

Categories : C#

how to pass composite object to view model
<TextBox Height="23" TextWrapping="Wrap" Text="TextBox" Name="textbox1" Tag="{Binding Person}"/> <Button Command="{Binding ShowMessage}" Content="Click Me" CommandParameter="{Binding ElementName=textbox1, Path=Tag}" /> you can make use of Tag Property of TextBox but I think there is something wrong with your MVVM implementation,It is the ViewModel that holds the data for your view. But here you sending it from View to VM . I mean Person should be automatically there in your VM instead of sending it from View.

Categories : Wpf

How to include more than 1 model object in a strongly typed view?
It`s not possible. You should create another Model to wrap this two models. Example: //Model public class FooModel1 { public string Property {get;set;} } public class FooModel2 { public string Property {get;set;} } public class FooModel { public FooModel1 One {get;set;} public FooModel2 Two {get;set;} } //Controller: public ActionResult Index() { var model = new FooModel() { One = new FooModel1 (), Two = new FooModel2 ()}; return View(model); } //View @model FooModel @Html.TextBoxFor(m=>m.One.Property) @Html.TextBoxFor(m=>m.Two.Property)

Categories : Asp Net Mvc

How to modify a shared object with Caliburn.Micro for Windows Phone
Actual Answer: In thinking about this, it will never work, the reason is you have your local variable which takes the container instance. you are not resting this instance in your second ViewModel you are actually overriding the local instance so that the container instance is not reference any more. So my final suggestion is to do as above and swap out a property value if you want to keep the code similar to your original implementation. You are sort of on the correct path, the Instance will return the same "Instance" to you each time it is requested, because you set this as a new instance it will override your set each time it is requested. Instead register as a Singleton. container.Singleton<MyObject>(); This will let you modify the instance. The other option if you need t

Categories : C#

Javascript: Object context overwritten?
By declaring all the variables at the top of the scope I wanted them to be defined in, and by rearranging the returned JSON data in a more structured way (cf. paste below), I was able correct the issue. For reference, here's the JSON data. {"items":[{"TLM_NO":"0000000","TLM_NAME":"NSS-14 Tlm Rel 19"}],"valid":true} Here's the updated update method. this.update = function(dbi) { var modelObj = this/* This is used to have a reference to 'this' Model while in other contexts. */; var allBindings = {} /* Used to relate binding to their values */; console.log('Updating model ' + this.name + '.'); if (this.columns.length == 0) { /* Let's build all the columns */ $("[id^='" + this.ref + "-']").each(function() { var colName = $(this).attr('id').split('-')[1]; if (modelObj.colum

Categories : Javascript

ASP.NET MVC 4 JSON Binding to the View Model - Nested object error
The problem is from your action method parameter: [HttpPost] public ActionResult SaveAddress(AddressViewModel addressViewModel) As you use JSON.stringify(), you send a string to your controller, not an object! So, you need to do some works to achive your goal: 1) Change your action method parametter: [HttpPost] public ActionResult SaveAddress(string addressViewModel) 2) Deserialize that string to an object - that is AddressViewModel: IList<AddressViewModel> modelObj = new JavaScriptSerializer().Deserialize<IList<AddressViewModel>>(addressViewModel); So, your final action method should be like the following: [HttpPost] public ActionResult SaveAddress(string addressViewModel) { IList<AddressViewModel> modelObj = new JavaScriptSerializer().Deserial

Categories : Json

Render Partial View with Object Model using jquery / Ajax
How I do it is an ajax call passing the id: $.ajax({ url: "@(Url.Action("Action", "Controller", new { id = "----" }))/".replace("----", id), type: "POST", cache: false, async: true, success: function (result) { $(".Class").html(result); } }); and then in your controller have the action set up like public PartialViewResult Action(string id) { //Build your model return PartialView("_PartialName", model); } if you do need to pass a model to the controller through ajax, if you create a jquery object that has the same fields as the model and stringify and pass it, it will come through correctly. var toSend = {}; toSend.ID = id; toSend.Name = name; etc, then in the ajax call data: JSON.stringify(toSend),

Categories : C#

Can you return the parsed JSONProvider result as a Model object to use in the view for MVC?
Sadly, this is not supported at the moment. The JSON type provider uses erased types which means that the parsed document is represented as a value of type JsonDocument that does not actually have any of the members that you can see in F#. The F# compiler understands this, but they are not present in compiled code and other languages do not support type providers at the moment. There is a number of ways to fix this and it is certainly on the TODO list. (It is a bit tricky, implementing ICustomTypeDescriptor would work in some scenarios, but not here. Generating actual types might be a way forward. For more information, see this bug at F# Data GitHub page.) For now, you might be able to use the dynamic access operations that the JSON library provides. See the JSON Parser and Reader page f

Categories : F#

Editing the model object with update view django by excluding fields
Define a BookForm that excludes the field, class BookForm(forms.ModelForm): class Meta: model = Book exclude = ('author',) then use this form in your view class BookEditView(generic.UpdateView): model = Book form_class = BookForm ...

Categories : Python

How to create a view model object that gets information from multiple database tables
If you have created an entity framework model from your database schema you should have: An AccountDefinition class with an AccountDefinition.SDOrganization reference navigation property because the relationship between the two is apparently one-to-one A SDOrganization.AaaPostAddresses collection navigation property because the relationship is many-to-many. The SDOrgPostalAddr table should not appear as model entity because it is only the many-to-many link table With this model and changing your view model to... public class CustomerDetails { public AccountDefinition AccountDefinition {get; set;} public SDOrganization SDOrganization {get; set;} public ICollection<AaaPostalAddress> AaaPostalAddresses { get; set; } } ...you should be able to get the result using: v

Categories : C#

slidify layouts: title-only, title-and-body, title-and-two-cols, title caption, and blank
Slide layouts are mustache templates that can make use of objects returned by the parser. You can find a list of objects returned by the parser here. Coming to the question raised, here is how one would go about building the layouts for the slides. Title Only <slide class="segue nobackground {{ slide.class }}" id="{{ slide.id }}"> <hgroup> {{{ slide.header }}} </hgroup> </slide> The two column layout inherits from the parent layout, and the column widths are configurable. Two Columns --- layout: slide replace: slide.content --- {{{ slide.content }}} <div class='left' style='float:left;width:{{{ slide.left.w }}}'> {{{ slide.left.html }}} </div> <div class='right' style='float:right;width:{{{ slide.right.w }}}'> {{{ slide.right

Categories : R

Referencing a model's Show View form another model's Index view
color.color_name is giving you error because you don't have color object on Product Index View. Try <td><%= link_to product.color_name, product.color_name, color_path(product.color) %></td> if there is one-to-one relationship Try <td><%= link_to product.color_name, product.color_name, color_path(product.colors.first) %></td> if there is one-to-many relationship

Categories : Ruby On Rails

Property accessor 'Title' on object x threw the following exception:'Object reference not set to an instance of an object
public partial class Products : System.Web.UI.Page { public class Products2 { public string ItemNumber { get; set; } public string ItemDescription { get; set; } public string PrePrice { get; set; } public string Size { get; set; } } //.... Then: List<Products2> list = new List<Products2>(); foreach (DataRow dr in table.Rows) { Products2 products = new Products2(); products.ItemNumber = dr["Item #"].ToString(); products.ItemDescription = dr["Item Description"].ToString(); products.PrePrice = dr["Pre Price"].ToString(); products.Size = dr["Size"].ToString(); list.Add(products); }

Categories : Asp Net

How to capture a property changed even of one view model in another view model
In my BaseCollection class which extends ObservableCollection<T>, I have a created a CollectionItemPropertyChanged delegate that I can attach a handler to, so I can be notified when property values have changed in any item in the collection: public delegate void ItemPropertyChanged(T item, string propertyName); Then I add a getter and setter of the type of the delegate: public virtual ItemPropertyChanged CurrentItemPropertyChanged { get; set; } To achieve this, I have to attach a handler to each item's PropertyChanged event: public BaseCollection(IEnumerable<T> collection) { foreach (T item in collection) Add(item); } public new void Add(T item) { item.PropertyChanged += Item_PropertyChanged; base.Add(item); } I also need to remove the handlers when objec

Categories : Wpf

How to pass my view model to a user to main view model?
Try using the Name property of the class Type: private void ShowExecuted(DataTemplate s) { var typeName = s.DataType as Type; if (typeName == null) return; var className = typeName.Name; // className will be EmployerSetupVM or VendorSetupVM ... } I'd still say passing the DataTemplate to the VM just seems strange. I'd just have two commands and switch the command used in the Button.Style according to the conditions you got. If you "have" to use a single RelayCommand or the world might end, I'd tend to use a static enum that you can reference from xaml for CommandParameter than pass the whole DataTemplate object.

Categories : Wpf

Default login credentials for Virtuoso Conductor
According to their documentation, you can log in initially as: username: dba password: dba Edit: i also found that there are two different default users setup: There are two system users of immediate importance: dba -- the relational data administrative account dav --the WebDAV adminstrative account. By default each of these accounts has its password set the same as its username. It is strongly advised that you change these as soon as possible for obvious security reasons. http://ods.openlinksw.com/wiki/main/Main/VOSUbuntuNotes#Using%20Virtuoso

Categories : Misc

How to add a button to a window title?
Probably these links will help you: Remove close button: How to hide close button in wpf window? Remove min/max buttons How do I remove minimize and maximize from a resizable window in WPF? To add a button to the window title you can use WPF customizable window control: http://wpfwindow.codeplex.com/ Hope it will help you!

Categories : Wpf

Menu on WPF Window title bar
<Window x:Class="WpfApplication11.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/core" xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars" WindowStyle="None" Title="MainWindow" Height="350" Width="525"> <Grid> <dxb:BarManager CreateStandardLayout="True"> <dxb:BarManager.Items> <dxb:BarButtonItem x:Name="barButtonItem1" Content="test"/> <dxb:BarButtonItem x:Name="barButtonItem2" Content="test2"/> </dxb:BarManager.Items> <dxb:BarManager.Bars&g

Categories : Wpf

Getting the window title from a process name
It seems that (WPARAM)sizeof(CHAR)/sizeof(MAX_PATH) would return you zero, because sizeof(char) will be defenetly smaller then the max path, so you say to WinAPI that your variable has zero length, that's why it returns empty string to you. Specify there MAX_PATH value instead.

Categories : C++

How to get window title from it's process path
Assuming there is only 1 window in the process, and assuming there is only one copy of the executable running at a time, then you can use EnumWindows() to enumerate top-level windows, calling GetWindowThreadProcessId(), OpenProcess() and GetModuleFileNameEx() on each window to get its owning process's path, and if you find a matching path then you can use GetWindowText() to get that window's title and stop the enumeration.

Categories : C++

Tmux window title keeps renaming
Check whether your PS1 (plus PS2, PS3 or PS4 if those are set) is changing the title: printf %q "$PS1" | grep -F '\033'

Categories : Bash

WPF window's title bar is cramped on Windows 7
If you are talking about the text shown in the screen shot, then no, there is no styling that can be applied to it except typeface (Font) adjustments. As you can see from the image, the icon does not line up quite right with the text, but this is normal. You cannot add Padding or Margin to this text. It is set using the Window.Title property.

Categories : C#

Create a web page without window title bar
There is a specific fullscreen API in HTML5, look at HTML5 FullScreen API toggle with JavaScript and this tutorial.

Categories : Javascript

Displaying FPS in GLFW window title?
There's always the istringstream trick: template< typename T > std::string ToString( const T& val ) { std::istringstream iss; iss << val; return iss.str(); } Or boost.lexical_cast. You can use std::string::c_str() to get a null-terminated string to pass in to glfwSetWindowTitle().

Categories : C++

why windows title not set on jQuery ui window?
Check the DOC: $( ".selector" ).dialog({ title: "Dialog Title" }); OR: $( ".selector" ).dialog( "option", "title", "Dialog Title" ); So here, you could use: $("#clientdetailmodal").html(result).dialog({ autoOpen: true, width: 400, modal: true, show: { effect: "blind", duration: 1000 },title: '321 file' });

Categories : Jquery

Changing the title bar on a Python window
You should use the setWindowTitle(title) method on the main window. Also, and unless the title changes dynamically in your app, it's probably better to change it in your interface file (if you made one, using QtDesigner for instance)

Categories : Python

How do I Update Window Title text in VB.NET
You set the Form.Text, using the current instance (which you access using Me): Dim SomeVariable As String SomeVariable = "Site 1 - My Application" Me.Text = SomeVariable For future reference, you can figure a lot of this out by clicking on the object you want to change things on in the Designer and then looking at the Properties window. In this case, you'd click on your main window and then looking at Properties, where you'd find the "Text" property. Changing it in the Properties window would change it in the Designer immediately when you type new text and hit the Enter key or move to another property.

Categories : Vb.Net

Should the view model match closer to view or model?
Leave the bool value in the ViewModel and use a BoolToVisibilityConverter in the View. Reason: ViewModel should be View-agnostic, and UI-Framework-agnostic. That is, you should be able to copy your ViewModel into a console application and hit F5. Make sure you leverage MarkupExtension to simplify converter usage

Categories : C#

WPF Bind Window Title to ViewModel Property
You can try to set the DataContext using property element syntax: <Window x:Class="MyProject.View.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="clr-namespace:MyProject.ViewModel;assembly=MyProject.ViewModel" Title="{Binding Path=Title}" Height="350" Width="525"> <Window.Resources> <vm:MainWindow x:Key="mainWindowViewModel"/> </Window.Resources> <Window.DataContext> <StaticResourceExtension ResourceKey="mainWindowViewModel"/> </Window.DataContext> That should work as the xaml parser will execute StaticResourceExtension after the resources dictionary is set. But i think maybe even better would be to set the DataContext directly,

Categories : C#

Prevent other scripts from setting window.title?
See the answer to how to listen for changes to the title element?. Notably: function titleModified() { window.alert("Title modifed"); } window.onload = function() { var titleEl = document.getElementsByTagName("title")[0]; var docEl = document.documentElement; if (docEl && docEl.addEventListener) { docEl.addEventListener("DOMSubtreeModified", function(evt) { var t = evt.target; if (t === titleEl || (t.parentNode && t.parentNode === titleEl)) { titleModified(); } }, false); } else { document.onpropertychange = function() { if (window.event.propertyName == "title") { titleModified(); } }; } };

Categories : Javascript

How to dynamically modify the title of the window about wx.FileDropTarget
You can pass the parent window class to FileDrop as self.parent, and use self.parent.SetTitle to set the title. Here's your modified code. I commented my changes. import wx import os # added this class FileDrop(wx.FileDropTarget): def __init__(self, window, parent): # added parent attribute wx.FileDropTarget.__init__(self) self.window = window self.parent = parent # self.parent makes it available to the whole class def OnDropFiles(self, x, y, filenames): for name in filenames: try: file = open(name, 'r') text = file.read() self.window.WriteText(text) self.parent.SetTitle(os.path.basename(name)) # magic happens here file.close() except IOError,

Categories : Python



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.