0

我有这个 XML 文件,我想将 fit-to-largest 的值从 false 更改为 true。像这样:

<Hmi.Screen.TextField Name="Text Field_1" AggregationName="ScreenItems" ID="31">
    <ObjectList>
      <Hmi.Screen.Property Name="Layer" AggregationName="Properties" ID="77">
        <AttributeList>
          <Value>0</Value>
        </AttributeList>
      </Hmi.Screen.Property>
      <Hmi.Screen.Property Name="Left" AggregationName="Properties" ID="78">
        <AttributeList>
          <Value>264</Value>
        </AttributeList>
      </Hmi.Screen.Property>
      <Hmi.Screen.Property Name="Top" AggregationName="Properties" ID="79">
        <AttributeList>
          <Value>48</Value>
        </AttributeList>
      </Hmi.Screen.Property>
      <Hmi.Screen.Property Name="FitToLargest" AggregationName="Properties" ID="84">
        <AttributeList>
          <Value>false</Value>
        </AttributeList>
      </Hmi.Screen.Property>
    </ObjectList>
</Hmi.Screen.TextField>

从此代码中,我想将此部分更改为:

<Hmi.Screen.Property Name="FitToLargest" AggregationName="Properties" ID="84">
    <AttributeList>
      <Value>false</Value>
    </AttributeList>
</Hmi.Screen.Property>

对此:

<Hmi.Screen.Property Name="FitToLargest" AggregationName="Properties" ID="84">
    <AttributeList>
      <Value>true</Value>
    </AttributeList>
</Hmi.Screen.Property>

(假变成真)

我想通过加载 XML 文件(我知道如何)来更改它,然后找到并将 false 替换为 true。

这部分代码在每个文本字段中都可以找到,但属性 ID 的值不同。我想为每个文本字段更改它。

4

0 回答 0