Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/317.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# Combobox项使用设置文件中的旧值资源_C#_Wpf_Xaml_Combobox - Fatal编程技术网

C# Combobox项使用设置文件中的旧值资源

C# Combobox项使用设置文件中的旧值资源,c#,wpf,xaml,combobox,C#,Wpf,Xaml,Combobox,我正在尝试创建一个组合框,并使用设置文件填充值。 在第一次尝试中,它可以工作,但当我尝试更改设置文件中的值时,它不会反映在组合框中的项目列表中。 相同的代码段- 组合框xaml代码- <ComboBox Name="vGameMode" ItemsSource="{Binding Source={x:Static p:Settings1.Default}, Path=Modes}"

我正在尝试创建一个组合框,并使用设置文件填充值。 在第一次尝试中,它可以工作,但当我尝试更改设置文件中的值时,它不会反映在组合框中的项目列表中。 相同的代码段-

组合框xaml代码-

                    <ComboBox Name="vGameMode"
                    ItemsSource="{Binding Source={x:Static p:Settings1.Default}, Path=Modes}"
                    SelectedIndex="1">
                    <!-- <ComboBoxItem Content="Personal"/>
                    <ComboBoxItem Content="Corporate"/> -->
                </ComboBox>

设置文件中的值-

<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="ABC" GeneratedClassName="Settings1">
  <Profiles />
  <Settings>
    <Setting Name="Themes" Type="System.Collections.Specialized.StringCollection" Scope="User">
      <Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
  &lt;string&gt;Theme1&lt;/string&gt;
  &lt;string&gt;Theme2&lt;/string&gt;
  &lt;string&gt;Theme3&lt;/string&gt;
&lt;/ArrayOfString&gt;</Value>
    </Setting>
    <Setting Name="DefaultMaxScore" Type="System.Int32" Scope="User">
      <Value Profile="(Default)">1000</Value>
    </Setting>
    <Setting Name="DefaultTimeoutSeconds" Type="System.Int32" Scope="User">
      <Value Profile="(Default)">300</Value>
    </Setting>
    <Setting Name="LeaderboardDays" Type="System.Int32" Scope="User">
      <Value Profile="(Default)">7</Value>
    </Setting>
    <Setting Name="NumberOfTasks" Type="System.Int32" Scope="User">
      <Value Profile="(Default)">3</Value>
    </Setting>
    <Setting Name="CurrentModeIndex" Type="System.Int32" Scope="User">
      <Value Profile="(Default)">0</Value>
    </Setting>
    <Setting Name="DifficultyLevels" Type="System.Collections.Specialized.StringCollection" Scope="User">
      <Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
  &lt;string&gt;Medium&lt;/string&gt;
  &lt;string&gt;Hard&lt;/string&gt;
&lt;/ArrayOfString&gt;</Value>
    </Setting>
    <Setting Name="GameType" Type="System.Collections.Specialized.StringCollection" Scope="User">
      <Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
  &lt;string&gt;Laser Maze&lt;/string&gt;
  &lt;string&gt;Laser Buster&lt;/string&gt;
&lt;/ArrayOfString&gt;</Value>
    </Setting>
  </Settings>
</SettingsFile>

?xml version=“1.0”encoding=“utf-16”?
ArrayOfString xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance“xmlns:xsd=”http://www.w3.org/2001/XMLSchema"
stringTheme1/字符串
stringTheme2/字符串
字符串主题3/字符串
/阵列光纤串
1000
300
7.
3.
0
?xml version=“1.0”encoding=“utf-16”?
ArrayOfString xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance“xmlns:xsd=”http://www.w3.org/2001/XMLSchema"
字符串中/字符串
字符串硬/字符串
/阵列光纤串
?xml version=“1.0”encoding=“utf-16”?
ArrayOfString xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance“xmlns:xsd=”http://www.w3.org/2001/XMLSchema"
串激光迷宫/串
激光扫描器
/阵列光纤串
你知道这里怎么了吗?
我猜它是缓存在某个地方,但不确定在哪里

确保在其中的某个地方调用Settings1.Default.Save()。我一直都忘了这一点。

确保在其中的某个地方调用Settings1.Default.Save()。我一直都忘了这一点。

编辑设置后是否重新编译了项目?请尝试从其他网络运行项目。使用移动热点或其他wifi。您很可能会得到更新后的值。我也有同样的想法issue@michip96-是的。我确实重新编译了多次。我还清理了这个项目并重建了至少三次。@VarunBabuPozhath-改变网络有什么帮助?我正在进行更改,并在本地运行该项目。应用程序中没有任何网络参与。ISP使用代理服务器在服务器级别将数据缓存到其服务器中。使用不同的网络将消除这种情况。是否已为meDid工作编辑设置后是否重新编译项目?请尝试从其他网络运行项目。使用移动热点或其他wifi。您很可能会得到更新后的值。我也有同样的想法issue@michip96-是的。我确实重新编译了多次。我还清理了这个项目并重建了至少三次。@VarunBabuPozhath-改变网络有什么帮助?我正在进行更改,并在本地运行该项目。应用程序中没有任何网络参与。ISP使用代理服务器在服务器级别将数据缓存到其服务器中。使用不同的网络将消除这种情况。对meI有效,但我不会动态更改值。我正在直接修改Settings1.settings文件。我没有动态更改这些值。我正在直接修改Settings1.settings文件。