我想列出所有可用的行业(如:http://biz.yahoo.com/p/)并显示所有相应的股票.到目前为止,我正在使用YAHOO.Finance.SymbolSuggest.ssCallback作为符号建议,并使用http://finance.yahoo.com/d/quotes.csv?s= ...来获取股票的数据.
有谁知道如何获得所有行业和相应的股票?还有另一个隐藏的Yahoo API吗?
我在设置WPF中HighlightBrushKey的a SelectedItem时遇到了问题Listbox.我的目的是根据给定的布尔值设置Item的颜色,位于代码中.
我试过以下步骤:
实现转换器,检查布尔值并返回正确的颜色.
例:
<ribbon:RibbonWindow.Resources>
<l:WindowControl x:Key="ListBoxItemBackgroundConverter" />
<Style x:Key="listBoxStyle" TargetType="{x:Type ListBoxItem}">
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="{Binding Source={x:Static SystemColors.HighlightBrushKey}, Converter={StaticResource ListBoxItemBackgroundConverter}}"/>
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="{Binding Source={x:Static SystemColors.ControlBrushKey}, Converter={StaticResource ListBoxItemBackgroundConverter}}"/>
</Style.Resources>
</Style>
</ribbon:RibbonWindow.Resources>
Run Code Online (Sandbox Code Playgroud)
这里的问题是Convert方法只被调用一次,但我每次选择一个项目并检查布尔值时都需要调用Converter.像触发器一样,但带有" HighlightBrushKey".
转换器:
public object Convert(object value, Type targetType,
object parameter, CultureInfo culture)
{
if(currentField == null)
return Brushes.Yellow;
if (currentField.Save)
return Brushes.LightGreen;
else
return Brushes.Yellow;
}
Run Code Online (Sandbox Code Playgroud)我的下一个想法是将" HighlightBrushKey" 设置为" Transparent"并item.Background在代码中手动更改.这里的问题是我的物品变白了,无法看到背景颜色
例:
<ListBox.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" …Run Code Online (Sandbox Code Playgroud)我将Control转换为System.Windows.Forms.Textbox时得到一个InvalidArgumentException:
无法将类型为"System.Windows.Forms.Control"的对象强制转换为"System.Windows.Forms.TextBox".
System.Windows.Forms.Control control = new System.Windows.Forms.Control();
control.Width = currentField.Width;
//here comes the error
((System.Windows.Forms.TextBox)control).Text = currentField.Name;
Run Code Online (Sandbox Code Playgroud)
我这样做,因为我有不同的控件(Textbox,MaskedTextbox,Datetimepicker ...),它将动态添加到面板并具有相同的基本属性(大小,位置... - >控制)
为什么演员不可能?
c# ×1
casting ×1
controls ×1
finance ×1
listboxitem ×1
textbox ×1
web-services ×1
winforms ×1
wpf ×1