Search Results

Search found 11 results on 1 pages for 'dthrasher'.

Page 1/1 | 1 

  • Remove SelectedItems from a ListBox via MVVM RelayCommand

    - by dthrasher
    I have a list of items in a WPF ListBox. I want to allow the user to select several of these items and click a Remove button to eliminate these items from the list. Using the MVVM RealyCommand pattern, I've created a command with the following signature: public RelayCommand<IList> RemoveTagsCommand { get; private set; } My ViewModel constructor sets up an instance of the command: RemoveTagsCommand = new RelayCommand<IList>(RemoveTags, CanRemoveTags); My current implementation of RemoveTags feels clunky, with casts and copying. Is there a better way to implement this? public void RemoveTags(IList toRemove) { var collection = toRemove.Cast<Tag>(); List<Tag> copy = new List<Tag>(collection); foreach (Tag tag in copy) { Tags.Remove(tag); } }

    Read the article

  • Visual Studio 2010 error: Type universe cannot resolve assembly

    - by dthrasher
    I've loaded a WPF project initially created in Visual Studio 2008 into Visual Studio 2010. The conversion process goes smoothly, but on certain XAML files the VS2010 designer throws several errors related to project references, including this one: System.Reflection.Adds.UnresolvedAssemblyException Type universe cannot resolve assembly: GalaSoft.MvvmLight, Version=3.0.0.31869, Culture=neutral, PublicKeyToken=3e875cdb3903c512. This assembly reference works just fine in the Expression Blend 4 designer, but not in VS2010. I can build and run the solution successfully. My solution targets the .Net Framework 3.5 SP1.

    Read the article

  • WPF ShowDialog returns immediately

    - by dthrasher
    Sometimes when I call ShowDialog on an OpenFileDialog Window in WPF, the dialog closes immediately with a return value of false. I'm calling ShowDialog in response to a button click event. I can reproduce this problem using the sample code for OpenFileDialog on MSDN: // Configure open file dialog box Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.FileName = "Document"; // Default file name dlg.DefaultExt = ".txt"; // Default file extension dlg.Filter = "Text documents (.txt)|*.txt"; // Filter files by extension // Show open file dialog box Nullable<bool> result = dlg.ShowDialog(); // Process open file dialog box results if (result == true) { // Open document string filename = dlg.FileName; } The problem occurs intermittently when I run my solution in Debug mode from Visual Studio 2008 SP1. It's quite annoying. Is this a known issue? Are there workarounds?

    Read the article

  • How to use a specific PDF IFilter

    - by dthrasher
    I'm trying to extract text from PDF files using an iFilter. The Adobe PDF iFilter that is distributed with Adobe Reader is awful, returning HRESULT E_FAIL messages for many PDF documents. The FoxIt PDF IFilter works beautifully on virtually all of the PDFs I've been using for testing. The problem is that every time the Adobe Updater runs, it replaces the awesome FoxIt IFilter with the crappy Adobe IFilter. I've been using the LoadIFilter method to get the registered IFilter for PDF files. Is there a way to force the Win32 API to load the FoxIt IFilter instead of the Adobe IFilter? NOTE: This question about determining which IFilters are installed asks a related -- but not identical -- question.

    Read the article

  • Can the MVVM-Light ViewModelLocator be used in nested ViewModels?

    - by dthrasher
    The Visual Studio 2008 Designer doesn't seem to like UserControls that reference the MVVM-Light ViewModelLocator. I get an error message like: Could not create an instance of type 'MyUserControl'. For example, the following XAML will cause this behavior if MyUserControl uses the ViewModelLocator to establish its DataContext. <Page x:Class="MyProject.Views.MainView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Views="clr-namespace:MyProject.Views" > <Grid> <Views:MyUserControl/> </Grid> </Page> Is the ViewModelLocator only meant to be used in top-level Views?

    Read the article

  • When should I use a UserControl instead of a Page?

    - by dthrasher
    I notice that many of the WPF MVVM frameworks seem to avoid using the NavigationWindow and Page controls in favor of composing pages using nested UserControls. The NavigationWindow and Page provide easy ways to enable back and forward navigation in the journal as well as providing an easy way to pass data among pages. Most MVVM frameworks I've seen re-implement these features in various ways. Is there a specific reason to avoid using NavigationWindow and Page?

    Read the article

  • Can a DataTemplate be a Page?

    - by dthrasher
    I'm using the MVVM pattern to create a WPF standalone application. My program compiles in Visual Studio 2008, but I frequently get warnings in the editor for my DataTemplates. In my MainWindow.xaml, I've defined the following DataTemplate: <DataTemplate DataType="{x:Type ViewModels:TagViewModel}"> <Views:TagView /> </DataTemplate> Where "TagView" is derived from a Page, rather than an ordinary UserControl. This causes the following message to appear every time I reload the designer in Visual Studio: "Could not create an instance of type 'TagView'. Yet the solution compiles fine and the program seems to work properly. Is this a bug in the Visual Studio 2008 editor? Or am I doing something wrong?

    Read the article

  • Firebird database schema/data difference tool

    - by dthrasher
    RedGate makes a tool for Microsoft SQL Server that allows you to snapshot the difference between two databases. It generates the scripts needed to update the database schema while preserving the data. I need to find a tool like this for the Firebird database. We use Firebird in an embedded fashion, and would like to push out schema updates to remote machines with as little hassle as possible.

    Read the article

  • Can you use data binding with the Content property of a WPF Frame?

    - by dthrasher
    I can use data binding to set the initial Content of a WPF Frame, but subsequent changes to the the bound property (implemented using INotifyPropertyChange) do not seem to change the content. Also, does anyone know if binding directly to the Content property in this way will cause the bound item to appear in the Frame or NavigationWindow's journal? Some context: I realize that I should probably be using the NavigationService to interact with the Frame, but I'm attempting to follow the MVVM pattern. It seems like it would be much simpler to databind to the Content property...

    Read the article

  • Why can't I find DataTemplates in merged resource dictionaries?

    - by dthrasher
    In my MainWindow.xaml, I have the following reference to a ResourceDictionary: <Window.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="MainSkin.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Window.Resources> In MainSkin.xaml, I define a datatemplate: <DataTemplate x:Key="TagTemplate"> ... </DataTemplate> Deeper within my application, I attempt to use this data template: <ContentControl DataContext="{Binding Tag}" ContentTemplate="{StaticResource TagTemplate}"/> The code compiles successfully, but when I attempt to load a Page or UserControl that contains this StaticResource, I get an exception saying that the TagTemplate can't be found. What am I doing wrong?

    Read the article

  • JQuery UI Tabs widget error handling

    - by dthrasher
    When an ajax request fails, the JQuery UI Tabs widget stops responding and the "Loading..." spinner remains on the tab that caused the error. I can get the ajax callback to give me some sort of alert message like so: $('#localtabs > ul').tabs({ ajaxOptions: { success: tabLoadSuccessCallback, error: tabLoadFailureCallback} }); function tabLoadSuccessCallback(XMLHttpRequest, textStatus, errorThrown) { alert("Yay!");} function tabLoadFailureCallback(XMLHttpRequest, textStatus, errorThrown) { alert("Could not get search results.");} But what I'd really like is to be able to display a message within the panel, cancel the spinner, and disable the tab that caused the problem while leaving the rest of the tabs operational. Does anyone have any ideas for how to do this?

    Read the article

1