// Get a DescriptiveStatistics instance
DescriptiveStatistics stats = new DescriptiveStatistics();
// Add the data from the array
for( int i = 0; i < inputArray.length; i++) {
stats.addValue(inputArray[i]);
}
// Compute some statistics
double mean = stats.getMean();
double std = stats.getStandardDeviation();
double median = stats.getPercentile(50);
Word.Application application = new Word.Application();
Object missing = Type.Missing;
application.Documents.Add(ref missing, ref missing, ref missing, ref missing);
Clipboard.SetImage(pictureBox1.Image);
application.ActiveDocument.Paragraphs[1].Range.Paste();
application.Visible = true;
// image создаю программно, но можно и из x:Name использовать аналогично (без var image = new System.Windows.Controls.Image();)
var image = new System.Windows.Controls.Image();
BitmapImage bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.UriSource = new Uri(path, UriKind.Absolute);
bitmap.EndInit();
Image.Source = bitmap;
[SerializableAttribute]
[ComVisibleAttribute(true)]
public sealed class Bitmap : Image
<Image Width="90" Height="90"
Source="{Binding Path=ImageSource}"
Margin="0,0,0,5" />
public object ImageSource {
get {
BitmapImage image = new BitmapImage();
try {
image.BeginInit();
image.CacheOption = BitmapCacheOption.OnLoad;
image.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
image.UriSource = new Uri( FullPath, UriKind.Absolute );
image.EndInit();
}
catch{
return DependencyProperty.UnsetValue;
}
return image;
}
}
<Image>
<Image.Source>
<BitmapImage UriSource="{Binding Path=ImagePath, Converter=...}" />
</Image.Source>
</Image>
BitmapImage image = new BitmapImage();
image.BeginInit();
image.UriSource = new Uri(value as string);
image.EndInit();
return image;
img.Source = (ImageSource)new ImageSourceConverter().ConvertFromString("/www/image.png");
CollectionViewSource _viewSource = new CollectionViewSource();
_viewSource.Source = _items;
_viewSource.Filter += (s, e) =>
{
SomeItem item = e.Item as SomeItem;
bool accepted;
//проверяем наши условия. true - объект отобразится, false - не отобразится
e.Accepted = accepted;
};
_viewSource.View.Refresh();
public ObservableCollection<Person> FilteredCollection
{
get
{
return new ObservableCollection<Person>(PersonCollection.Where(i => FilteredCheck(i)));
}
}
public bool FilteredCheck(DemandHead item)
{
bool Accept=true;
// организовываем проверку как вашей душе удобно
}
// И дальше при изменении фильтра оповещаем View об изменении данных
public bool IsFilterEnabled
{
get
{
return _IsFilterEnabled;
}
set
{
_IsFilterEnabled = value;
base.OnPropertyChanged("IsFilterEnabled");
base.OnPropertyChanged("FilteredCollection");
}
}
<ContentPresenter ContentTemplate="{...}" Content = "{Binding ....}"/>
xmlns:m="clr-namespace:WpfDependency"
в шапке.... <Page>
<Page.Resources>
<Class1 x:Key="blablabla"></Class1 >
</Page.Resources>
<Grid DataContext="{Binding Source={StaticResource blablabla}}"....
// ваш код xaml после чего у mycontrols ставите атрибуты
</Grid>
</Page>
</Window>