none
OneWayToSource binding loosing after seting the property in code or with click with mouse RRS feed

  • Question

  • I have two radio buttons which have the IsChecked property bind to a property in OneWayToSource mode like in code bellow. The problem is if I check with the mouse the checkboxes or I set this IsChecked property in code the checkboxes lose the binding.

    <UserControl x:Class="Audicon.Magellan.Client.Controls.Views.UICultureView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ctlVMs="clr-namespace:Audicon.Magellan.Client.Controls.ViewModels"
        xmlns:convertors="clr-namespace:Audicon.Magellan.Client.Controls.Converters"
        xmlns:res ="clr-namespace:Audicon.Magellan.Client.Resources;assembly=Audicon.Magellan.Client.Resources">   
        <StackPanel>
            <StackPanel.Resources>
                <convertors:IsNotNullConverter x:Key="IsObjectNotNull"/>
            </StackPanel.Resources>
            <RadioButton    x:Name="optUseUserCulture"
                            Margin="0,0,0,7"
                            GroupName="UICulture"
                            Content="{Binding Path=UserUICultureDisplayString,Mode=OneTime}"
                            IsChecked="{Binding Path=UseUserUICulture, Mode=OneWayToSource}"
                            Checked="optUseUserCulture_Checked">          
            </RadioButton>
            <StackPanel Orientation="Horizontal">
                <RadioButton  x:Name="optUseCulture"
                              VerticalAlignment="Center"
                              GroupName="UICulture"
                              IsChecked="{Binding Path=UseUICulture, Mode=OneWayToSource}"
                              Content="{x:Static res:Messages.CTL_TXT_USE_CULTURE}"></RadioButton>
                <ComboBox Width="200"
                    ItemsSource="{x:Static ctlVMs:UICultureViewModel.SupportedCultures}"
                    Margin="7,0,0,0"
                    IsEnabled="{Binding ElementName=optUseCulture, Path=IsChecked}"
                    SelectedItem="{Binding Path=UICulture, Mode=OneWayToSource}"
                    IsEditable="True"
                    IsReadOnly="True"
                    DisplayMemberPath="DisplayName"
                    Text="{Binding Path=UICulture.DisplayName,Mode=OneTime}">           
                </ComboBox>
            </StackPanel>
        </StackPanel>
    </UserControl>


    Thanks for your help.

     

    Tuesday, May 26, 2009 9:44 AM

Answers