Click here to Skip to main content
15,892,059 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Another MVVM questionn regarding updating info on other controls? Pin
Mycroft Holmes21-Jul-12 13:52
professionalMycroft Holmes21-Jul-12 13:52 
GeneralRe: Another MVVM questionn regarding updating info on other controls? Pin
Alisaunder21-Jul-12 14:59
Alisaunder21-Jul-12 14:59 
GeneralRe: Another MVVM questionn regarding updating info on other controls? Pin
Mycroft Holmes21-Jul-12 16:14
professionalMycroft Holmes21-Jul-12 16:14 
GeneralRe: Another MVVM questionn regarding updating info on other controls? Pin
Pete O'Hanlon22-Jul-12 21:52
mvePete O'Hanlon22-Jul-12 21:52 
QuestionAdding datagrid cell images at runtime doesn't appear in cell Pin
alleyes20-Jul-12 8:40
professionalalleyes20-Jul-12 8:40 
GeneralRe: Adding datagrid cell images at runtime doesn't appear in cell Pin
Christian Amado21-Jul-12 12:03
professionalChristian Amado21-Jul-12 12:03 
GeneralRe: Adding datagrid cell images at runtime doesn't appear in cell Pin
alleyes22-Jul-12 17:07
professionalalleyes22-Jul-12 17:07 
GeneralUnintended Save Issue WPF Pin
eddieangel20-Jul-12 7:20
eddieangel20-Jul-12 7:20 
The subject is somewhat of a misnomer, I have a category combobox that governs what defects are available, but that is it. The category information should not be saved. Easier to show than say:

Here is the relevant ViewModel:

public Category SelectedCategory
{
    get { return _selectedCategory; }
    set
    {
        if (value == null) return;

        _selectedCategory = value;
        OnPropertyChanged("SelectedCategory");
        LoadDefects(_selectedCategory.id);
    }
}


And the View:
<ComboBox
                Grid.Row="2"
                Grid.Column="1"
                ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}},Path=DataContext.AllCategories}"
                DisplayMemberPath="name"
                SelectedValuePath="id"
                SelectedValue="{Binding SelectedItem.Defect.categoryId}"
                SelectedItem="{Binding SelectedCategory}" />

<ComboBox
                Grid.Row="3"
                Grid.Column="1"
                ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}},Path=DataContext.AllDefects}"
                DisplayMemberPath="name"
                SelectedValuePath="id"
                SelectedValue="{Binding SelectedItem.defectId}"/>


What is happening is that instead of just saving the SelectedItem (Observation class not shown) it is changing SelectedItem.Defect.CategoryId, which I don't want. I only want SelectedItem to be saved. Save routine is pretty simple:

ViewModel:

private void Save()
     
{
   _con.SaveChanges();
}


Thoughts?

Cheers, --EA
GeneralRe: Unintended Save Issue WPF Pin
Ian Shlasko20-Jul-12 7:31
Ian Shlasko20-Jul-12 7:31 
GeneralRe: Unintended Save Issue WPF Pin
eddieangel20-Jul-12 7:37
eddieangel20-Jul-12 7:37 
GeneralRe: Unintended Save Issue WPF Pin
Ian Shlasko20-Jul-12 7:45
Ian Shlasko20-Jul-12 7:45 
GeneralRe: Unintended Save Issue WPF Pin
eddieangel20-Jul-12 7:49
eddieangel20-Jul-12 7:49 
GeneralRe: Unintended Save Issue WPF Pin
Ian Shlasko20-Jul-12 8:16
Ian Shlasko20-Jul-12 8:16 
QuestionButton Style Question Pin
Kevin Marois19-Jul-12 9:21
professionalKevin Marois19-Jul-12 9:21 
AnswerRe: Button Style Question Pin
Wayne Gaylard19-Jul-12 20:15
professionalWayne Gaylard19-Jul-12 20:15 
Questiontip for scrollviewer Pin
caradri18-Jul-12 23:10
caradri18-Jul-12 23:10 
GeneralRe: tip for scrollviewer Pin
Wayne Gaylard18-Jul-12 23:38
professionalWayne Gaylard18-Jul-12 23:38 
GeneralRe: tip for scrollviewer Pin
caradri19-Jul-12 1:16
caradri19-Jul-12 1:16 
GeneralRe: tip for scrollviewer Pin
Mycroft Holmes19-Jul-12 12:48
professionalMycroft Holmes19-Jul-12 12:48 
GeneralRe: tip for scrollviewer Pin
Christian Amado19-Jul-12 17:43
professionalChristian Amado19-Jul-12 17:43 
GeneralRe: tip for scrollviewer Pin
Pete O'Hanlon19-Jul-12 20:20
mvePete O'Hanlon19-Jul-12 20:20 
GeneralRe: tip for scrollviewer Pin
Mycroft Holmes19-Jul-12 23:19
professionalMycroft Holmes19-Jul-12 23:19 
GeneralRe: tip for scrollviewer Pin
Pete O'Hanlon19-Jul-12 23:27
mvePete O'Hanlon19-Jul-12 23:27 
AnswerRe: tip for scrollviewer Pin
Christian Amado20-Jul-12 0:56
professionalChristian Amado20-Jul-12 0:56 
GeneralRe: tip for scrollviewer Pin
Pete O'Hanlon20-Jul-12 1:32
mvePete O'Hanlon20-Jul-12 1:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.