1
VS Outlook Addin을 (를) 제작 중입니다.VSTO 리본 콤보 상자 텍스트가 변경됨 이벤트 콜백
콤보 상자의 텍스트 변경 이벤트를 얻는 방법. 나는 사용자가 내가 돌아의 OnChange 전화로 시도 콤보 상자
<comboBox id="cmbUsers" label="Users" showImage="false"
getItemCount="OnGetItemCount"
getItemLabel="OnGetItemLabel"
onChange="OnChange"
getText="GetText"
getKeytip="GetKeytip"/>
에 텍스트를 입력하는 동안 데이터를 검색하기 위해 내 API를 호출 할,하지만 작동하지 않습니다. 하지만 리본 디자이너에서 TextChange 이벤트를 볼 수 있습니다.
어떻게 지금은 전화를받을해야public void OnChange(Office.IRibbonControl control, string text)
에
public void OnChange(Office.IRibbonControl control)
에서
[ComVisible(true)]
public class Ribbon : Office.IRibbonExtensibility
{
private Office.IRibbonUI ribbon;
public Ribbon()
{
}
#region IRibbonExtensibility Members
public string GetCustomUI(string ribbonID)
{
return GetResourceText("UserOutlookAddin.Ribbon.xml");
}
#endregion
#region Ribbon Callbacks
//Create callback methods here. For more information about adding callback methods, select the Ribbon XML item in Solution Explorer and then press F1
public void Ribbon_Load(Office.IRibbonUI ribbonUI)
{
this.ribbon = ribbonUI;
}
public void OnActionCallback(Office.IRibbonControl control)
{
if (control.Id == "checkBox1")
{
MessageBox.Show("You clicked " + control.Id);
}
else
{
MessageBox.Show("You clicked a different control.");
}
}
public void OnGetItemCount(Office.IRibbonControl control)
{
Debug.WriteLine("##### Am OnGetItemCount");
}
public void OnGetItemLabel(Office.IRibbonControl control)
{
Debug.WriteLine("##### Am OnGetItemLabel");
}
public void OnChange(Office.IRibbonControl control)
{
Debug.WriteLine("##### Am OnChange");
}
public void GetText(Office.IRibbonControl control)
{
Debug.WriteLine("##### Am GetText");
}
public void GetKeytip(Office.IRibbonControl control)
{
Debug.WriteLine("##### Am GetKeytip");
}
#endregion
#region Helpers
private static string GetResourceText(string resourceName)
{
Assembly asm = Assembly.GetExecutingAssembly();
string[] resourceNames = asm.GetManifestResourceNames();
for (int i = 0; i < resourceNames.Length; ++i)
{
if (string.Compare(resourceName, resourceNames[i], StringComparison.OrdinalIgnoreCase) == 0)
{
using (StreamReader resourceReader = new StreamReader(asm.GetManifestResourceStream(resourceNames[i])))
{
if (resourceReader != null)
{
return resourceReader.ReadToEnd();
}
}
}
}
return null;
}
#endregion
}
당신이 OnChange''에 관한 C# 코드를 게시 할 수에
에서
getItemCount
,getItemLabel
,getText
및getKeytip
의 서명을 변경해야합니까? – haindl@haindl 예, 지금 업데이트되었습니다. –