Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/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
WIX组合框绑定值_Wix_Wix3.5_Wix3_Wix3.6_Wix3.7 - Fatal编程技术网

WIX组合框绑定值

WIX组合框绑定值,wix,wix3.5,wix3,wix3.6,wix3.7,Wix,Wix3.5,Wix3,Wix3.6,Wix3.7,我正在尝试使用自定义操作填充值,并希望将这些值绑定到product.wxs中的combobox中 <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> <MediaTemplate /> <Feature Id="ProductFeature" Title="SetupProjectComboTest"

我正在尝试使用自定义操作填充值,并希望将这些值绑定到product.wxs中的combobox中

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Feature Id="ProductFeature" Title="SetupProjectComboTest" Level="1">
        <ComponentGroupRef Id="ProductComponents" />
    </Feature>
如果我想在组合框中填充国家列表,有人能指导我如何绑定值吗

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Feature Id="ProductFeature" Title="SetupProjectComboTest" Level="1">
        <ComponentGroupRef Id="ProductComponents" />
    </Feature>
我正在努力解决如何传递这个值,以便在执行MSI设置时,这些值将显示在combox中

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Feature Id="ProductFeature" Title="SetupProjectComboTest" Level="1">
        <ComponentGroupRef Id="ProductComponents" />
    </Feature>
下面提供我正在尝试的代码:

    public static ActionResult FillList(Session xiSession)
    {

        Dictionary<string, string> _co = new Dictionary<string, string>();
        _co.Add(String.Empty, String.Empty);
        _co.Add("US", "United States");
        _co.Add("CA", "Canada");
        _co.Add("MX", "Mexico");

        xiSession.Log("Return success");
        return ActionResult.Success;
    }
    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Feature Id="ProductFeature" Title="SetupProjectComboTest" Level="1">
        <ComponentGroupRef Id="ProductComponents" />
    </Feature>
publicstaticactionresult填充列表(会话xiSession)
{
字典_co=新字典();
_co.Add(String.Empty,String.Empty);
_公司添加(“美国”、“美国”);
_公司地址(“CA”、“加拿大”);
_co.Add(“MX”、“墨西哥”);
xiSession.Log(“返回成功”);
返回操作结果。成功;
}

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Feature Id="ProductFeature" Title="SetupProjectComboTest" Level="1">
        <ComponentGroupRef Id="ProductComponents" />
    </Feature>

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Feature Id="ProductFeature" Title="SetupProjectComboTest" Level="1">
        <ComponentGroupRef Id="ProductComponents" />
    </Feature>

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Feature Id="ProductFeature" Title="SetupProjectComboTest" Level="1">
        <ComponentGroupRef Id="ProductComponents" />
    </Feature>

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Feature Id="ProductFeature" Title="SetupProjectComboTest" Level="1">
        <ComponentGroupRef Id="ProductComponents" />
    </Feature>


您需要在组合框表中插入行来绑定列表值。如果在中打开msi,则可以找到msi表和行

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Feature Id="ProductFeature" Title="SetupProjectComboTest" Level="1">
        <ComponentGroupRef Id="ProductComponents" />
    </Feature>
如果在msi中不使用任何其他ComboBox元素,则应该包含元素

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Feature Id="ProductFeature" Title="SetupProjectComboTest" Level="1">
        <ComponentGroupRef Id="ProductComponents" />
    </Feature>
  <EnsureTable Id="ComboBox"/>
在自定义操作中,调用
FillComboBox
方法

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Feature Id="ProductFeature" Title="SetupProjectComboTest" Level="1">
        <ComponentGroupRef Id="ProductComponents" />
    </Feature>
   public static ActionResult FillList(Session xiSession)
    {

        FillComboBox(xiSession, "US", "United States");
        FillComboBox(xiSession, "CA", "Canada");
        FillComboBox(xiSession, "MX", "Mexico");          

        return ActionResult.Success;
    }
在运行该组合框对话框之前,在InstallUIsequence中执行自定义操作

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Feature Id="ProductFeature" Title="SetupProjectComboTest" Level="1">
        <ComponentGroupRef Id="ProductComponents" />
    </Feature>
   <InstallUISequence>
     <Custom Action="INSERT_ROWS" After="AppSearch">Not Installed</Custom>
  </InstallUISequence>

未安装

感谢您的回复。我根据您的示例进行了尝试,现在combobox正在绑定该值。我想知道的一个更清楚的问题是如何在combobox中显示默认值,比如--Select--。您需要将默认值设置为COUNTRIES属性。表格Wix或来自海关行动xiSession[“国家”]=“美国”;谢谢vinoth的快速回复。这对我很有用。再清楚一点,安装程序执行时如何获取文本文件路径,就像再清楚一点,安装程序执行时如何获取文本文件路径,比如[CustomAction]公共静态ActionResult填充列表(会话xiSession){string path=@“E:\Mylocation.txt”;string[]readText=File.ReadAllLines(path);foreach(readText中的字符串s){FillComboBox(xiSession,s,s);}xiSession[“COUNTRIES”]=“--Select Location--”return ActionResult.Success;}//我可以将store mylocation.txt保存到应用程序根目录而不是E Location中吗?如何调用mylocation.txt?作为单独的问题发布。