Select ComboBoxItem automatically based on different selected ComboBoxItem value











up vote
0
down vote

favorite












I have a form with some fields and two combo boxes. My view model contains some instances of User class, which contains name and profile attributes.



ViewModel



    public class UserViewModel: INotifyPropertyChanged
{
private ObservableCollection<User> usersList = new ObservableCollection<User>();
private User selectedUser = new User();
private User newUser = new User();

public UserViewModel()
{
}

public ObservableCollection<User> UsersList
{
get
{
return this.usersList;
}

set
{
this.usersList = value;
this.OnPropertyChanged();
}
}

public User SelectedUser
{
get
{
return this.selectedUser;
}

set
{
this.selectedUser = value;
this.OnPropertyChanged();
}
}

public User NewUser
{
get
{
return this.newUser;
}

set
{
this.newUser = value;
this.OnPropertyChanged();
}
}

private void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
if (this.PropertyChanged != null)
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}

public event PropertyChangedEventHandler PropertyChanged;
}
}


Code-behind



this.userViewModel = new UserViewModel();
this.DataContext = this.userViewModel;


XAML



<-- The DataContext for this ComboBox is the entire UserViewModel -->
<ComboBox
Height="Auto"
Width="Auto"
IsEditable="True"
IsTextSearchCaseSensitive="False"
SelectedItem="SelectedUser">
<ComboBoxItem Content="Mary" IsSelected="True"></ComboBoxItem>
<ComboBoxItem Content="John"></ComboBoxItem>
</ComboBox>


If I select an user from the first combobox, all form fields get filled with the existing data. Whatever user I select, it's going to be saved in SelectedUser through SelectedItem property.



<Grid>
<Grid.DataContext>
<PriorityBinding>
<Binding Path="SelectedUser" Converter="{StaticResource NullToDependencyPropertyUnsetConverter}" />
<Binding Path="NewUser" />
</PriorityBinding>
</Grid.DataContext>
[...]
<-- The DataContext for this ComboBox will be SelectedUser or NewUser, depending on the case -->
<ComboBox
Name="profileComboBox"
Height="Auto"
Width="Auto"
IsEditable="True"
IsTextSearchCaseSensitive="False"
SelectedItem="Profile">
<ComboBoxItem Content="User" IsSelected="True"></ComboBoxItem>
<ComboBoxItem Content="Admin"></ComboBoxItem>
</ComboBox>
[...]
</Grid>


The ComboBox will have SelectedUser or NewUser as DataContext depending on whether SelectedUser is null or not. Then, whatever profile I select, it's going to be saved in Profile attribute of the previously selected user through SelectedItem property.



My problem is that the second combobox should select automatically the corresponding profile ("User" or "Admin") of the user just selected in the first combobox. Could this be achieved only using XAML?










share|improve this question
























  • This might helps stackoverflow.com/a/34129469/2946329
    – S.Akbari
    Nov 8 at 13:38










  • @S.Akbari yeah, I tried that in the meanwhile, but no effect. I think it's something related to the DataContext, but not sure. Just in case you can come up with some idea, I edited my question.
    – chick3n0x07CC
    Nov 8 at 14:16















up vote
0
down vote

favorite












I have a form with some fields and two combo boxes. My view model contains some instances of User class, which contains name and profile attributes.



ViewModel



    public class UserViewModel: INotifyPropertyChanged
{
private ObservableCollection<User> usersList = new ObservableCollection<User>();
private User selectedUser = new User();
private User newUser = new User();

public UserViewModel()
{
}

public ObservableCollection<User> UsersList
{
get
{
return this.usersList;
}

set
{
this.usersList = value;
this.OnPropertyChanged();
}
}

public User SelectedUser
{
get
{
return this.selectedUser;
}

set
{
this.selectedUser = value;
this.OnPropertyChanged();
}
}

public User NewUser
{
get
{
return this.newUser;
}

set
{
this.newUser = value;
this.OnPropertyChanged();
}
}

private void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
if (this.PropertyChanged != null)
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}

public event PropertyChangedEventHandler PropertyChanged;
}
}


Code-behind



this.userViewModel = new UserViewModel();
this.DataContext = this.userViewModel;


XAML



<-- The DataContext for this ComboBox is the entire UserViewModel -->
<ComboBox
Height="Auto"
Width="Auto"
IsEditable="True"
IsTextSearchCaseSensitive="False"
SelectedItem="SelectedUser">
<ComboBoxItem Content="Mary" IsSelected="True"></ComboBoxItem>
<ComboBoxItem Content="John"></ComboBoxItem>
</ComboBox>


If I select an user from the first combobox, all form fields get filled with the existing data. Whatever user I select, it's going to be saved in SelectedUser through SelectedItem property.



<Grid>
<Grid.DataContext>
<PriorityBinding>
<Binding Path="SelectedUser" Converter="{StaticResource NullToDependencyPropertyUnsetConverter}" />
<Binding Path="NewUser" />
</PriorityBinding>
</Grid.DataContext>
[...]
<-- The DataContext for this ComboBox will be SelectedUser or NewUser, depending on the case -->
<ComboBox
Name="profileComboBox"
Height="Auto"
Width="Auto"
IsEditable="True"
IsTextSearchCaseSensitive="False"
SelectedItem="Profile">
<ComboBoxItem Content="User" IsSelected="True"></ComboBoxItem>
<ComboBoxItem Content="Admin"></ComboBoxItem>
</ComboBox>
[...]
</Grid>


The ComboBox will have SelectedUser or NewUser as DataContext depending on whether SelectedUser is null or not. Then, whatever profile I select, it's going to be saved in Profile attribute of the previously selected user through SelectedItem property.



My problem is that the second combobox should select automatically the corresponding profile ("User" or "Admin") of the user just selected in the first combobox. Could this be achieved only using XAML?










share|improve this question
























  • This might helps stackoverflow.com/a/34129469/2946329
    – S.Akbari
    Nov 8 at 13:38










  • @S.Akbari yeah, I tried that in the meanwhile, but no effect. I think it's something related to the DataContext, but not sure. Just in case you can come up with some idea, I edited my question.
    – chick3n0x07CC
    Nov 8 at 14:16













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a form with some fields and two combo boxes. My view model contains some instances of User class, which contains name and profile attributes.



ViewModel



    public class UserViewModel: INotifyPropertyChanged
{
private ObservableCollection<User> usersList = new ObservableCollection<User>();
private User selectedUser = new User();
private User newUser = new User();

public UserViewModel()
{
}

public ObservableCollection<User> UsersList
{
get
{
return this.usersList;
}

set
{
this.usersList = value;
this.OnPropertyChanged();
}
}

public User SelectedUser
{
get
{
return this.selectedUser;
}

set
{
this.selectedUser = value;
this.OnPropertyChanged();
}
}

public User NewUser
{
get
{
return this.newUser;
}

set
{
this.newUser = value;
this.OnPropertyChanged();
}
}

private void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
if (this.PropertyChanged != null)
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}

public event PropertyChangedEventHandler PropertyChanged;
}
}


Code-behind



this.userViewModel = new UserViewModel();
this.DataContext = this.userViewModel;


XAML



<-- The DataContext for this ComboBox is the entire UserViewModel -->
<ComboBox
Height="Auto"
Width="Auto"
IsEditable="True"
IsTextSearchCaseSensitive="False"
SelectedItem="SelectedUser">
<ComboBoxItem Content="Mary" IsSelected="True"></ComboBoxItem>
<ComboBoxItem Content="John"></ComboBoxItem>
</ComboBox>


If I select an user from the first combobox, all form fields get filled with the existing data. Whatever user I select, it's going to be saved in SelectedUser through SelectedItem property.



<Grid>
<Grid.DataContext>
<PriorityBinding>
<Binding Path="SelectedUser" Converter="{StaticResource NullToDependencyPropertyUnsetConverter}" />
<Binding Path="NewUser" />
</PriorityBinding>
</Grid.DataContext>
[...]
<-- The DataContext for this ComboBox will be SelectedUser or NewUser, depending on the case -->
<ComboBox
Name="profileComboBox"
Height="Auto"
Width="Auto"
IsEditable="True"
IsTextSearchCaseSensitive="False"
SelectedItem="Profile">
<ComboBoxItem Content="User" IsSelected="True"></ComboBoxItem>
<ComboBoxItem Content="Admin"></ComboBoxItem>
</ComboBox>
[...]
</Grid>


The ComboBox will have SelectedUser or NewUser as DataContext depending on whether SelectedUser is null or not. Then, whatever profile I select, it's going to be saved in Profile attribute of the previously selected user through SelectedItem property.



My problem is that the second combobox should select automatically the corresponding profile ("User" or "Admin") of the user just selected in the first combobox. Could this be achieved only using XAML?










share|improve this question















I have a form with some fields and two combo boxes. My view model contains some instances of User class, which contains name and profile attributes.



ViewModel



    public class UserViewModel: INotifyPropertyChanged
{
private ObservableCollection<User> usersList = new ObservableCollection<User>();
private User selectedUser = new User();
private User newUser = new User();

public UserViewModel()
{
}

public ObservableCollection<User> UsersList
{
get
{
return this.usersList;
}

set
{
this.usersList = value;
this.OnPropertyChanged();
}
}

public User SelectedUser
{
get
{
return this.selectedUser;
}

set
{
this.selectedUser = value;
this.OnPropertyChanged();
}
}

public User NewUser
{
get
{
return this.newUser;
}

set
{
this.newUser = value;
this.OnPropertyChanged();
}
}

private void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
if (this.PropertyChanged != null)
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}

public event PropertyChangedEventHandler PropertyChanged;
}
}


Code-behind



this.userViewModel = new UserViewModel();
this.DataContext = this.userViewModel;


XAML



<-- The DataContext for this ComboBox is the entire UserViewModel -->
<ComboBox
Height="Auto"
Width="Auto"
IsEditable="True"
IsTextSearchCaseSensitive="False"
SelectedItem="SelectedUser">
<ComboBoxItem Content="Mary" IsSelected="True"></ComboBoxItem>
<ComboBoxItem Content="John"></ComboBoxItem>
</ComboBox>


If I select an user from the first combobox, all form fields get filled with the existing data. Whatever user I select, it's going to be saved in SelectedUser through SelectedItem property.



<Grid>
<Grid.DataContext>
<PriorityBinding>
<Binding Path="SelectedUser" Converter="{StaticResource NullToDependencyPropertyUnsetConverter}" />
<Binding Path="NewUser" />
</PriorityBinding>
</Grid.DataContext>
[...]
<-- The DataContext for this ComboBox will be SelectedUser or NewUser, depending on the case -->
<ComboBox
Name="profileComboBox"
Height="Auto"
Width="Auto"
IsEditable="True"
IsTextSearchCaseSensitive="False"
SelectedItem="Profile">
<ComboBoxItem Content="User" IsSelected="True"></ComboBoxItem>
<ComboBoxItem Content="Admin"></ComboBoxItem>
</ComboBox>
[...]
</Grid>


The ComboBox will have SelectedUser or NewUser as DataContext depending on whether SelectedUser is null or not. Then, whatever profile I select, it's going to be saved in Profile attribute of the previously selected user through SelectedItem property.



My problem is that the second combobox should select automatically the corresponding profile ("User" or "Admin") of the user just selected in the first combobox. Could this be achieved only using XAML?







c# wpf xaml






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 8 at 14:33

























asked Nov 8 at 13:34









chick3n0x07CC

8311




8311












  • This might helps stackoverflow.com/a/34129469/2946329
    – S.Akbari
    Nov 8 at 13:38










  • @S.Akbari yeah, I tried that in the meanwhile, but no effect. I think it's something related to the DataContext, but not sure. Just in case you can come up with some idea, I edited my question.
    – chick3n0x07CC
    Nov 8 at 14:16


















  • This might helps stackoverflow.com/a/34129469/2946329
    – S.Akbari
    Nov 8 at 13:38










  • @S.Akbari yeah, I tried that in the meanwhile, but no effect. I think it's something related to the DataContext, but not sure. Just in case you can come up with some idea, I edited my question.
    – chick3n0x07CC
    Nov 8 at 14:16
















This might helps stackoverflow.com/a/34129469/2946329
– S.Akbari
Nov 8 at 13:38




This might helps stackoverflow.com/a/34129469/2946329
– S.Akbari
Nov 8 at 13:38












@S.Akbari yeah, I tried that in the meanwhile, but no effect. I think it's something related to the DataContext, but not sure. Just in case you can come up with some idea, I edited my question.
– chick3n0x07CC
Nov 8 at 14:16




@S.Akbari yeah, I tried that in the meanwhile, but no effect. I think it's something related to the DataContext, but not sure. Just in case you can come up with some idea, I edited my question.
– chick3n0x07CC
Nov 8 at 14:16












1 Answer
1






active

oldest

votes

















up vote
0
down vote













Bind the SelectedItem of the second ComboBox to the Profile property of the currently selected User:



SelectedItem="{Binding SelectedUser.Profile}"


or



SelectedItem="{Binding SelectedItem.Profile, ElementName=userComboBox}"


Also remove the items from ComboBox and set the DisplayMemberPath property to the name of a property of the Profile type:



<ComboBox
Name = "profileComboBox"
IsEditable="True"
IsTextSearchCaseSensitive="False"
DisplayMemberPath="Name"
SelectedItem="{Binding SelectedUser.Profile}">
</ComboBox>





share|improve this answer























  • Yeah, in the meanwhile I have been trying with that, but with no effect (also, I had to use DisplayMemberPath because DisplayMemberName property didn't exist). I think it's something related to DataContext, but not sure. I edited my question adding more code about this.
    – chick3n0x07CC
    Nov 8 at 14:12










  • Yes, sorry, it should be DisplayMemberPath. Do you have a SelectedUser property that gets set?
    – mm8
    Nov 8 at 14:19












  • Yes, in my view model, which implements INotifyPropertyChanged interface. The same with NewUser.
    – chick3n0x07CC
    Nov 8 at 14:23












  • Do both ComboBoxes have the same DataContext? And what's the ItemsSource of the second ComboBox? It needs to be an IEnumerable<Profile> where all profiles are included.
    – mm8
    Nov 8 at 14:25










  • In theory, they have different DataContext's. About the ItemsSource: I thought that since I put the ComboBoxItems's "manually" within the ComboBox syntax, ItemsSource wasn't needed. But maybe I wasn't right. I edited my question again with more details.
    – chick3n0x07CC
    Nov 8 at 14:36













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53208826%2fselect-comboboxitem-automatically-based-on-different-selected-comboboxitem-value%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













Bind the SelectedItem of the second ComboBox to the Profile property of the currently selected User:



SelectedItem="{Binding SelectedUser.Profile}"


or



SelectedItem="{Binding SelectedItem.Profile, ElementName=userComboBox}"


Also remove the items from ComboBox and set the DisplayMemberPath property to the name of a property of the Profile type:



<ComboBox
Name = "profileComboBox"
IsEditable="True"
IsTextSearchCaseSensitive="False"
DisplayMemberPath="Name"
SelectedItem="{Binding SelectedUser.Profile}">
</ComboBox>





share|improve this answer























  • Yeah, in the meanwhile I have been trying with that, but with no effect (also, I had to use DisplayMemberPath because DisplayMemberName property didn't exist). I think it's something related to DataContext, but not sure. I edited my question adding more code about this.
    – chick3n0x07CC
    Nov 8 at 14:12










  • Yes, sorry, it should be DisplayMemberPath. Do you have a SelectedUser property that gets set?
    – mm8
    Nov 8 at 14:19












  • Yes, in my view model, which implements INotifyPropertyChanged interface. The same with NewUser.
    – chick3n0x07CC
    Nov 8 at 14:23












  • Do both ComboBoxes have the same DataContext? And what's the ItemsSource of the second ComboBox? It needs to be an IEnumerable<Profile> where all profiles are included.
    – mm8
    Nov 8 at 14:25










  • In theory, they have different DataContext's. About the ItemsSource: I thought that since I put the ComboBoxItems's "manually" within the ComboBox syntax, ItemsSource wasn't needed. But maybe I wasn't right. I edited my question again with more details.
    – chick3n0x07CC
    Nov 8 at 14:36

















up vote
0
down vote













Bind the SelectedItem of the second ComboBox to the Profile property of the currently selected User:



SelectedItem="{Binding SelectedUser.Profile}"


or



SelectedItem="{Binding SelectedItem.Profile, ElementName=userComboBox}"


Also remove the items from ComboBox and set the DisplayMemberPath property to the name of a property of the Profile type:



<ComboBox
Name = "profileComboBox"
IsEditable="True"
IsTextSearchCaseSensitive="False"
DisplayMemberPath="Name"
SelectedItem="{Binding SelectedUser.Profile}">
</ComboBox>





share|improve this answer























  • Yeah, in the meanwhile I have been trying with that, but with no effect (also, I had to use DisplayMemberPath because DisplayMemberName property didn't exist). I think it's something related to DataContext, but not sure. I edited my question adding more code about this.
    – chick3n0x07CC
    Nov 8 at 14:12










  • Yes, sorry, it should be DisplayMemberPath. Do you have a SelectedUser property that gets set?
    – mm8
    Nov 8 at 14:19












  • Yes, in my view model, which implements INotifyPropertyChanged interface. The same with NewUser.
    – chick3n0x07CC
    Nov 8 at 14:23












  • Do both ComboBoxes have the same DataContext? And what's the ItemsSource of the second ComboBox? It needs to be an IEnumerable<Profile> where all profiles are included.
    – mm8
    Nov 8 at 14:25










  • In theory, they have different DataContext's. About the ItemsSource: I thought that since I put the ComboBoxItems's "manually" within the ComboBox syntax, ItemsSource wasn't needed. But maybe I wasn't right. I edited my question again with more details.
    – chick3n0x07CC
    Nov 8 at 14:36















up vote
0
down vote










up vote
0
down vote









Bind the SelectedItem of the second ComboBox to the Profile property of the currently selected User:



SelectedItem="{Binding SelectedUser.Profile}"


or



SelectedItem="{Binding SelectedItem.Profile, ElementName=userComboBox}"


Also remove the items from ComboBox and set the DisplayMemberPath property to the name of a property of the Profile type:



<ComboBox
Name = "profileComboBox"
IsEditable="True"
IsTextSearchCaseSensitive="False"
DisplayMemberPath="Name"
SelectedItem="{Binding SelectedUser.Profile}">
</ComboBox>





share|improve this answer














Bind the SelectedItem of the second ComboBox to the Profile property of the currently selected User:



SelectedItem="{Binding SelectedUser.Profile}"


or



SelectedItem="{Binding SelectedItem.Profile, ElementName=userComboBox}"


Also remove the items from ComboBox and set the DisplayMemberPath property to the name of a property of the Profile type:



<ComboBox
Name = "profileComboBox"
IsEditable="True"
IsTextSearchCaseSensitive="False"
DisplayMemberPath="Name"
SelectedItem="{Binding SelectedUser.Profile}">
</ComboBox>






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 8 at 14:18

























answered Nov 8 at 13:39









mm8

79.3k81731




79.3k81731












  • Yeah, in the meanwhile I have been trying with that, but with no effect (also, I had to use DisplayMemberPath because DisplayMemberName property didn't exist). I think it's something related to DataContext, but not sure. I edited my question adding more code about this.
    – chick3n0x07CC
    Nov 8 at 14:12










  • Yes, sorry, it should be DisplayMemberPath. Do you have a SelectedUser property that gets set?
    – mm8
    Nov 8 at 14:19












  • Yes, in my view model, which implements INotifyPropertyChanged interface. The same with NewUser.
    – chick3n0x07CC
    Nov 8 at 14:23












  • Do both ComboBoxes have the same DataContext? And what's the ItemsSource of the second ComboBox? It needs to be an IEnumerable<Profile> where all profiles are included.
    – mm8
    Nov 8 at 14:25










  • In theory, they have different DataContext's. About the ItemsSource: I thought that since I put the ComboBoxItems's "manually" within the ComboBox syntax, ItemsSource wasn't needed. But maybe I wasn't right. I edited my question again with more details.
    – chick3n0x07CC
    Nov 8 at 14:36




















  • Yeah, in the meanwhile I have been trying with that, but with no effect (also, I had to use DisplayMemberPath because DisplayMemberName property didn't exist). I think it's something related to DataContext, but not sure. I edited my question adding more code about this.
    – chick3n0x07CC
    Nov 8 at 14:12










  • Yes, sorry, it should be DisplayMemberPath. Do you have a SelectedUser property that gets set?
    – mm8
    Nov 8 at 14:19












  • Yes, in my view model, which implements INotifyPropertyChanged interface. The same with NewUser.
    – chick3n0x07CC
    Nov 8 at 14:23












  • Do both ComboBoxes have the same DataContext? And what's the ItemsSource of the second ComboBox? It needs to be an IEnumerable<Profile> where all profiles are included.
    – mm8
    Nov 8 at 14:25










  • In theory, they have different DataContext's. About the ItemsSource: I thought that since I put the ComboBoxItems's "manually" within the ComboBox syntax, ItemsSource wasn't needed. But maybe I wasn't right. I edited my question again with more details.
    – chick3n0x07CC
    Nov 8 at 14:36


















Yeah, in the meanwhile I have been trying with that, but with no effect (also, I had to use DisplayMemberPath because DisplayMemberName property didn't exist). I think it's something related to DataContext, but not sure. I edited my question adding more code about this.
– chick3n0x07CC
Nov 8 at 14:12




Yeah, in the meanwhile I have been trying with that, but with no effect (also, I had to use DisplayMemberPath because DisplayMemberName property didn't exist). I think it's something related to DataContext, but not sure. I edited my question adding more code about this.
– chick3n0x07CC
Nov 8 at 14:12












Yes, sorry, it should be DisplayMemberPath. Do you have a SelectedUser property that gets set?
– mm8
Nov 8 at 14:19






Yes, sorry, it should be DisplayMemberPath. Do you have a SelectedUser property that gets set?
– mm8
Nov 8 at 14:19














Yes, in my view model, which implements INotifyPropertyChanged interface. The same with NewUser.
– chick3n0x07CC
Nov 8 at 14:23






Yes, in my view model, which implements INotifyPropertyChanged interface. The same with NewUser.
– chick3n0x07CC
Nov 8 at 14:23














Do both ComboBoxes have the same DataContext? And what's the ItemsSource of the second ComboBox? It needs to be an IEnumerable<Profile> where all profiles are included.
– mm8
Nov 8 at 14:25




Do both ComboBoxes have the same DataContext? And what's the ItemsSource of the second ComboBox? It needs to be an IEnumerable<Profile> where all profiles are included.
– mm8
Nov 8 at 14:25












In theory, they have different DataContext's. About the ItemsSource: I thought that since I put the ComboBoxItems's "manually" within the ComboBox syntax, ItemsSource wasn't needed. But maybe I wasn't right. I edited my question again with more details.
– chick3n0x07CC
Nov 8 at 14:36






In theory, they have different DataContext's. About the ItemsSource: I thought that since I put the ComboBoxItems's "manually" within the ComboBox syntax, ItemsSource wasn't needed. But maybe I wasn't right. I edited my question again with more details.
– chick3n0x07CC
Nov 8 at 14:36




















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53208826%2fselect-comboboxitem-automatically-based-on-different-selected-comboboxitem-value%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Schultheiß

Liste der Kulturdenkmale in Wilsdruff

Android Play Services Check