Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 选项卡控件保存状态_C#_Wpf_Mvvm_Command - Fatal编程技术网

C# 选项卡控件保存状态

C# 选项卡控件保存状态,c#,wpf,mvvm,command,C#,Wpf,Mvvm,Command,如何使选项卡控件保存对此选项卡内容所做的修改 例如,我有一个带有一些组合框的网格,我可以使用它们。如果我切换选项卡,ComboBox不会保存我应用的更改 <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Grid.Column="0" Grid.Row="1"> <Label Width="70"

如何使选项卡控件保存对此选项卡内容所做的修改

例如,我有一个带有一些组合框的网格,我可以使用它们。如果我切换选项卡,ComboBox不会保存我应用的更改


<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Grid.Column="0" Grid.Row="1">
   <Label Width="70" Margin="5" >Vertical</Label>
   <ComboBox Width="130" Margin="5" 
             Height="26" ItemsSource="{Binding Options}" SelectedValue="{Binding SelectedVertical}" 
             SelectionChanged="ComboBox_SelectionChanged"/>
</StackPanel>

    #region Options property
    private List<string> options;
    public List<string> Options
    {
        get { return options; }
        set
        {
            options = value;
            OnPropertyChanged(nameof(Options));
        }
    }
    #endregion

    #region SelectedVertical property
    private string selectedVertical;
    public string SelectedVertical
    {
        get { return selectedVertical; }
        set
        {
            selectedVertical = value;
            SetCategoryVerticalHorizontalFilteredOrdersAsync();
            OnPropertyChanged(nameof(SelectedVertical));
            OnPropertyChanged(nameof(DataTable));
        }
    }
    #endregion
垂直的 #区域选项属性 私人名单选择; 公共列表选项 { 获取{返回选项;} 设置 { 选项=价值; OnPropertyChanged(期权名称); } } #端区 #区域选择垂直属性 私有字符串selectedVertical; 公共字符串SelectedVertical { 获取{return selectedVertical;} 设置 { 选择垂直=数值; SetCategoryVerticalHorizontalFilteredOrdersAsync(); OnPropertyChanged(名称(SelectedVertical)); OnPropertyChanged(名称(数据表)); } } #端区
您可能需要“选项卡”的实际上下文,您是否使用了任何组合框绑定?是的,所有组合框都有自己的绑定。如果您能给出一个代码示例,将更容易帮助您。Xaml和.cs都有