Search Results

Search found 5 results on 1 pages for 'eponymous23'.

Page 1/1 | 1 

  • INotifyPropertyChange ~ PropertyChanged not firing when property is a collection and a new item is a

    - by eponymous23
    I have a class that implements the INotifyPropertyChanged interface. Some of the properties of the class are of type List. For example: public List<string> Answers { get { return _answers; } set { _answers = value; onPropertyChanged("Answers") } } ... private void onPropertyChanged(string propertyName) { if(this.PropertyChanged != null) this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } If I assign a new List<string> to Answer, then the PropertyChanged event fires as expected; but if I add a string string to the Answer list using the List Add method, then PropertyChanged event doesn't fire. I was considering adding an AddAnswer() method to my class, which would handle calling the lists's Add method and would call onPropertyChanged() from there, but is that the right way to do it? Is there a more elegant way of doing it? Cheers, KT

    Read the article

  • Accessing parent-level controls from inside a ComboBox's child controls

    - by eponymous23
    I have XAML similar to this: <ListBox ItemsSource="{Binding SearchCriteria, Source={StaticResource model}}" SelectionChanged="cboSearchCriterionType_SelectionChanged"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Name="spCriterion" Orientation="Horizontal" Height="20"> <ComboBox Name="cboSearchCriterionType" Width="120" SelectionChanged="cboSearchCriterionType_SelectionChanged"> <ComboBox.Items> <ComboBoxItem IsSelected="True" Content="Anagram Match" /> <ComboBoxItem Content="Pattern Match" /> <ComboBoxItem Content="Subanagram Match" /> <ComboBoxItem Content="Length" /> <ComboBoxItem Content="Number of Vowels" /> <ComboBoxItem Content="Number of Anagrams" /> <ComboBoxItem Content="Number of Unique Letters" /> </ComboBox.Items> </ComboBox> <TextBox x:Name="SearchSpec" Text="{Binding SearchSpec}" /> <TextBox x:Name="MinValue" Text="{Binding MinValue}" Visibility="Collapsed" /> <TextBox x:Name="MaxValue" Text="{Binding MaxValue}" Visibility="Collapsed" /> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> As you can tell from the markup, I have a listbox that is bound to a collection of SearchCriterion objects (collectively contained in a SearchCriteria object). The idea is that the user can add/remove criterion items from the criteria, each criterion is represented by a listbox item. Inside the listbox item I have a combobox and three textboxes. What I'm trying to do is change the visibility of the TextBox controls depending on the item that is selected in the ComboBox. For example, if the user selects "Pattern Match" then I want to show only the first textbox and hide the latter two; conversely, if the user selects "Length" or any of the "Number of..." items, then I want to hide the first TextBox and show the latter two. What is the best way to achieve this? I was hoping to do something simple in the SelectionChanged event handler for the listbox but the textbox controls are presumably out of the SelectionChanged event's scope. Do I have to programmatically traverse the control hierarchy and find the controls?

    Read the article

  • Need help with formulating LINQ query

    - by eponymous23
    I'm building a word anagram program that uses a database which contains one simple table: Words --------------------- varchar(15) alphagram varchar(15) anagram (other fields omitted for brevity) An alphagram is the letters of a word arranged in alphabetical order. For example, the alphagram for OVERFLOW would be EFLOORVW. Every Alphagram in my database has one or more Anagrams. Here's a sample data dump of my table: Alphagram Anagram EINORST NORITES EINORST OESTRIN EINORST ORIENTS EINORST STONIER ADEINRT ANTIRED ADEINRT DETRAIN ADEINRT TRAINED I'm trying to build a LINQ query that would return a list of Alphagrams along with their associated Anagrams. Is this possible?

    Read the article

  • ASP.NET ~ remotely invoking an ASP.NET page

    - by eponymous23
    I have two servers running IIS, say, Server-A and Server-B. Server-A is in the DMZ, visible to all users; Server-B is not in the DMZ. I need to provide a way for users to invoke a page on Server-A which will in turn remotely request a page on Server-B, transparently to the user. In other words, Server-A needs to do this on behalf of the user because the user does not have visibility to Server-B. Is this possible and if so, what is the best method to do this?

    Read the article

  • Silverlight ~ MVVM ~ Dynamic setting of Style property based on model value

    - by eponymous23
    I have a class called Question that represents a question and it's answer. I have an application that renders an ObservableCollection of Question objects. Each Question is rendered as a StackPanel that contains a TextBlock for the question verbiage, and a TextBox for the user to enter in an answer. The questions are rendered using an ItemsControl, and I have initially set the Style of the Questions's StackPanel using a StaticResource key called 'IncorrectQuestion' (defined in UserControl.Resources section of the page). In the UserControl.Resources section, I've also defined a key calld 'CorrectQuestion' which I need to somehow apply to the Question's StackPanel when the user correctly answers the question. My problem is I'm not sure how to dynamically change the Style of the StackPanel, specifically within the constraints of a ViewModel class (i.e. I don't want to put any style selection code in the View's code-behind). My Question class has an IsCorrect property which is accurately being set when the correction is answered. I'd like to somehow reflect the IsCorrect value in the form of a Style selection. How do I do that?

    Read the article

1