binding

Binding to multiple sources

心已入冬 提交于 2020-01-07 05:36:29
问题 I'm plotting graphs with D3. At this moment I'm doing it by binding this way: <d3:ChartPlotter x:Name="plotter" ItemsSource="Charts" Margin="20"> And I Add/Remove items to Charts and the plotter updates automatically. Works very well. The problem is that I need to bind from several collections, but obviously I can't set ItemsSource twice. I've read something about CompositeCollections, but almost every article is based on a StaticResource, that is not my case. <d3:ChartPlotter x:Name="plotter

Bind object to ListBox

让人想犯罪 __ 提交于 2020-01-07 05:33:07
问题 I am doing a Windows Form Application and I have the following classes: Person.cs class Person { public string name{ get; set; } public Person(string name) { this.name = name; } } Repository.cs class Repository { private static instance; private Repository() { persons= new List<Person>(); } public static Instance { get { if (instance == null) { instance = new Repository(); } return instance; } } private List<Person> videos; public List<Person> getVideos() { return videos; } } I want to bind a

wpf ItemsControl binding problem

痞子三分冷 提交于 2020-01-07 04:52:07
问题 I bind to a ItemsControl in my codebehind: ColumnVisibilityItems.DataContext = gc.ColumnVisibility; where ColumnVisibility is a ObservableCollection, also tried it with dictionary.. my markup <ItemsControl x:Name="ColumnVisibilityItems"> <Label Content="{Binding Path=Name}" /> </ItemsControl> while stepping through, i see the collection bound having 11 items. but ItemsControl renders only the first item in collection. Is ItemsSource property necessary to be set for this to work? because

Display status bar notification from service in android

北城余情 提交于 2020-01-07 04:27:07
问题 Hi i've got a kind of a dumb problem. Im trying to display a notification from a service. When an activity starts i call the startService like so: Intent myIntent = new Intent(getApplicationContext(),notif_service.class); startService(myIntent); the service calculates something and should display the notification and then stop. the code is as follows: if (limit_time_value == 2 && start >= 6300000 && notif_past) { notif_past=false; showNotification(); stopSelf(); } There are two ways that this

Animating SolidColorBrush in Background

烈酒焚心 提交于 2020-01-07 03:58:08
问题 I am trying to create a simple button style, that will change the opacity of the background from 0.0 to 1.0 on mouse over (and vice versa). I am creating a template for said button and I am binding all the properties in the template. It all works properly except the SolidColorBrush in background, that I can not bind to the template binding. I've seen some mentions of TemplateBinding not being the right one due to contexts, but I am not able to find another solution. I suspect, there might be

Binding A List of Images

穿精又带淫゛_ 提交于 2020-01-07 03:47:39
问题 I was trying to bind a list of images (List) to a StackPanel, I tried to separate those Images by using < Separator > but sadly it's not working. Anyone has a clue why? (i'm kinda rookie on wpf..so sry) My Code: Code Behind: List<Image> v2 = new List<Image>(); for (int i = 0; i < 10; i++) { Image v2image = new Image(); v2image.BeginInit(); v2image.Source = new BitmapImage(new Uri("http://static.lolskill.net/img/champions/64/xayah.png")); v2image.Width = 40; v2image.Height = 40; v2.Add(v2image

UWP - How to bind a ContentPresenter's element to the main ViewModel?

纵然是瞬间 提交于 2020-01-07 02:18:34
问题 I work on an app where the user can edit a "big" form: The form contains a lot of fields: it is displayed in a Pivot , where each PivotItem represents a category of the form. Some categories contain one or more child items: they are displayed through a Master-Detail presentation. To display the items of the Detail part, I use a ContentPresenter that is binded directly to the Model: <ContentPresenter x:Name="DetailContentPresenter" Grid.Column="1" Grid.RowSpan="2" BorderThickness="1,0,0,0"

How to hide and show UserControls based on SelectedItem in ListBox WPF MVVM Model

我怕爱的太早我们不能终老 提交于 2020-01-07 01:52:07
问题 I have 3 UserControls in my MainWindow,In my UserControl1 i have a ListBox with some names.The UserControl2 and 3 are not visible when we start the application. When i select some name in the listbox of usercontrol1 then the usercontrol2 should appear on my mainwindow,when i select other name then usercontrol3 should appear on my mainwindow.Struggling with this please help me,i'm new to this This is my UserControlXaml code <UserControl x:Class="Wpf_MVVM.UserControl1" xmlns="http://schemas

WPF: DataTrigger bound to a ContextMenu MenuItem works only once

此生再无相见时 提交于 2020-01-07 00:03:05
问题 I am trying to hide colummns in a Datagrid (bound to a DataTable ) with DataTrigger . So that the user can choose which columns are displayed. My problem is that this only works once. Normaly I would say that I need the INotifyPropertyChanged , however my ContextMenu is defined in XAML so I am not sure if and how to do that. Here my XAML <ContextMenu > .... <MenuItem Header="Apply" x:Name="ButtonApply" /> </ContextMenu> <DataGrid ItemsSource="{Binding Path=TabDataTable}" AutoGenerateColumns=

Dynamic Binding Java. Does an object have the methods of its declared type, or its actual type? [duplicate]

风格不统一 提交于 2020-01-06 19:06:49
问题 This question already has answers here : Difference between Dynamic and Static type assignments in Java (5 answers) Closed 4 years ago . Say I declare the following: Cat elsa = new Lion(); Lion extends Cat. If I declare it this way, will elsa be a cat having All of the methods of a cat or will it be a Lion, having all of the methods of both lion and cat This exact question is not addressed in other questions that I could find. 回答1: The object you create is of type Lion and has all of the