Skip to content

Combobox SelectionChanged handling using ViewModel #17735

Answered by morning4coffe-dev
ashah7 asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @ashah7,

I think you are mostly on the correct route, I just updated your code a bit to use the TwoWay binding on SelectedValue.

    <ComboBox x:Name="comboEstablishmentSelection"
              Grid.Row="1"
              HorizontalAlignment="Center"
              VerticalAlignment="Center"
              FontSize="14"
              Margin="0,0,0,0"
              ItemsSource="{Binding EstablishmentsOptions}"
              DisplayMemberPath="description"
              SelectedValuePath="establishid"
              SelectedValue="{Binding RequestUserOptions.UserOptions.Establishid, Mode=TwoWay}" />
    private int? establishid;
    public int? Establishid
    {
        get => establishid;

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@ashah7
Comment options

@morning4coffe-dev
Comment options

@ashah7
Comment options

@morning4coffe-dev
Comment options

Answer selected by morning4coffe-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants