本文整理汇总了C#中System.Windows.Controls.Image.SetBinding方法的典型用法代码示例。如果您正苦于以下问题:C# Image.SetBinding方法的具体用法?C# Image.SetBinding怎么用?C# Image.SetBinding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.Image
的用法示例。
在下文中一共展示了Image.SetBinding方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetGeneratedContent
/// <summary>
/// Generate content for cell by column binding
/// </summary>
/// <returns>Image element</returns>
internal override FrameworkElement GetGeneratedContent()
{
Image result = new Image();
if (this.Binding != null)
{
result.SetBinding(Image.SourceProperty, this.Binding);
}
result.SetBinding(Image.WidthProperty, new Binding("ImageWidth") { Source = this });
result.SetBinding(Image.HeightProperty, new Binding("ImageHeight") { Source = this });
return result;
}
示例2: ImageButton
/// <summary>
/// Initializes a new instance of the <see cref="ImageButton"/> class.
/// </summary>
public ImageButton()
{
SetResourceReference(HeightProperty, "DefaultControlHeight");
var panel = new StackPanel {Orientation = Orientation.Horizontal};
_icon = new Image {Margin = new Thickness(0, 0, 6, 0)};
var imageBinding = new Binding("Icon")
{
Source = this,
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
};
_icon.SetBinding(Image.SourceProperty, imageBinding);
panel.Children.Add(_icon);
_textBlock = new TextBlock();
var textBinding = new Binding("Content")
{
Source = this,
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
};
_textBlock.SetBinding(TextBlock.TextProperty, textBinding);
panel.Children.Add(_textBlock);
base.Content = panel;
SetResourceReference(StyleProperty, typeof (Button));
}
示例3: BindMenuIcon
private void BindMenuIcon(MenuItem menuItem, DependencyProperty property)
{
var image = new Image { Width = 16, Height = 16 };
var binding = new Binding { Source = this, Path = new PropertyPath(property) };
image.SetBinding(Image.SourceProperty, binding);
menuItem.Icon = image;
}
示例4: LoadNewDataSet
public void LoadNewDataSet(DataSource ds)
{
bool bo = false; //These two lines for testing refresh on new row addition. Remove them later.
if(bo) closeTab();
if (!DataSourceExists(ds))
{
///DocumentPanel panel = new DocumentPanel();
//C1DockControlPanel c1panel = new C1DockControlPanel();//Anil
StackPanel sp = new StackPanel(); //sp.Background = Brushes.Red;
sp.Orientation = Orientation.Horizontal;
sp.HorizontalAlignment = HorizontalAlignment.Center;
sp.VerticalAlignment = VerticalAlignment.Center;
//sp.Margin = new Thickness(1, 1, 1, 1);
string sheetname=string.Empty;//29Apr2015
if (ds.SheetName != null && ds.SheetName.Trim().Length > 0)
sheetname = "{" + ds.SheetName + "}";
Label lb = new Label(); lb.FontWeight = FontWeights.DemiBold;
var tabtextcolor = new SolidColorBrush(Color.FromArgb(255, (byte)48, (byte)88, (byte)144));//Foreground="#FF1579DA"
lb.Foreground = tabtextcolor;
lb.Content = Path.GetFileName(ds.FileName) + sheetname + " (" + ds.Name + ")";//06Aug2012
lb.ToolTip = ds.FileName+sheetname;
lb.Margin = new Thickness(1, 1, 1, 1);
//Button b = new Button(); b.Content="x";
Image b = new Image(); b.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(b_MouseLeftButtonUp);
b.ToolTip = "Close this dataset"; b.Height = 16.0; b.Width = 22.0;
string packUri = "pack://application:,,,/BlueSky;component/Images/closetab.png";
b.Source = new ImageSourceConverter().ConvertFromString(packUri) as ImageSource;
sp.Children.Add(lb);
sp.Children.Add(b); //sp.Children.Add(b);
TabItem panel = new TabItem();
//panel.Margin = new Thickness(1, 1, 1, 1);
b.Tag = panel;//for remove
///////triggers///08Feb2013
Binding bind = new Binding();//for close image to hide for inactive tabs
bind.Source = panel;
bind.Path = new PropertyPath("IsSelected");
bind.Converter = new BooleanToVisibilityConverter();
b.SetBinding(Image.VisibilityProperty, bind);
Style st = new Style(typeof(TabItem));
var brush1 = new SolidColorBrush(Color.FromArgb(255, (byte)212, (byte)227, (byte)242));//#FFD4E3F2
st.Setters.Add(new Setter() { Property = TabItem.BackgroundProperty, Value = brush1 });
Trigger tg = new Trigger { Property = TabItem.IsSelectedProperty, Value = true };
var brush2 = new SolidColorBrush(Color.FromArgb(255, (byte)234, (byte)239, (byte)245));//#FFEAEFF5
tg.Setters.Add(new Setter() { Property = TabItem.BackgroundProperty, Value = brush2 });
st.Triggers.Add(tg);
panel.Style = st;
///triggers///
DataPanel datapanel = new DataPanel();
datapanel.sortcolnames = sortcolnames;//11Apr2014
datapanel.sortorder = sortorder; //14Apr2014
VirtualListDynamic vld = new VirtualListDynamic(_analyticsService, ds);
vld.DataF = _analyticsService.GetDataFrame(ds);
if (vld.DataF == null) return; //03Aug2015 When SaveAs fails and tries to load the dataset closing the current one.
IList list = vld;
panel.Tag = ds; //panel.Tag = ds;
datapanel.DS = ds; //sending reference
datapanel.Data = list;
datapanel.Variables = ds.Variables;
datapanel.statusbar.Text = "";// "No Split";//03Dec2013 Status bar
panel.Header = sp;///Path.GetFileName(ds.FileName);
panel.Content = datapanel;
docGroup.Items.Add(panel);//panel
//panel.IsSelected = true;
docGroup.SelectedItem = panel;
//docGroup.SelectedIndex = docGroup.Items.Count - 1;
//docGroup.Background = Brushes.Red; /color around open dataset
///layoutManager.Activate(panel);
}
}