binding

ProgressBar not updating on change to Maximum through binding

♀尐吖头ヾ 提交于 2019-12-20 02:56:53
问题 <ProgressBar Foreground="Red" Background="Transparent" Value="{Binding NumFailed, Mode=OneWay}" Minimum="0" Maximum="{Binding NumTubes, Mode=OneWay, Converter={x:Static wpftools:DebuggingConverter.Instance}, ConverterParameter=Failedprogressbar}" FlowDirection="RightToLeft" Style="{DynamicResource {x:Static wpftools:CustomResources.StyleProgressBarVistaKey}}" /> This is what my progressbar looks like at the moment. The style came from http://mattserbinski.com/blog/look-and-feel-progressbar

How to use Binding like proxy?

懵懂的女人 提交于 2019-12-20 02:54:07
问题 <Setter Property="IsChecked"> <Setter.Value> <MultiBinding> <!-- Get value for property --> <Binding Path="IsPressed" RelativeSource="{RelativeSource Self}" Mode="OneWay"/> <!-- Set value to ViewModel's property --> <Binding Path="Shift" Mode="OneWayToSource"/> </MultiBinding> </Setter.Value> </Setter> I need to use 2 bindings for property: one to get value for property and one to set value to ViewModel's property. How I can realize this scenario? 回答1: You can create a couple of attached

UWP BitmapImage SetSource from MemoryStream hangs

六眼飞鱼酱① 提交于 2019-12-20 02:44:18
问题 In my UWP app i store images in an SQLite db in form of byte[]. Then as i retrieve my objects from the db i bind them to a GridView data template which has an Image control. As i cant bind the Image's Source directly to the array, so i have created a BitmapImage property in my object's class to bind the Image control to: public BitmapImage Icon { get { using (var stream = new MemoryStream(icon)) { stream.Seek(0, SeekOrigin.Begin); var img = new BitmapImage(); img.SetSource(stream

Binding issue with WPF user control

回眸只為那壹抹淺笑 提交于 2019-12-20 02:08:28
问题 Here's what I essentially want. A UserControl with a TextBlock whose Text property is binded to the Prop property of the UserControl . (This is just a representation of my actual problem) Below is a part of my UserControl ( ClientDetailsControl.xaml ) <TextBlock Text="{Binding Prop}" /> Next is the ClientDetailsControl.xaml.cs public partial class ClientDetailsControl : UserControl { public static DependencyProperty PropProperty = DependencyProperty.Register("Prop", typeof(String), typeof

Bindings inside CompositeCollection

▼魔方 西西 提交于 2019-12-19 21:19:34
问题 I want to create a TabControl with a number of "static" TabItems (explicitly typed in XAML) and a number of dynamically added TabItems. To achieve this I tried to use a CompositeCollection as the TabControl.ItemSource. Sample code: <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525" xmlns:sys="clr-namespace:System;assembly=mscorlib" >

How to bind a (static) Dictionary to Labels?

邮差的信 提交于 2019-12-19 20:23:33
问题 I have a static Dictionary class X { static Dictionary<string,string> MyDict {get { ... }} } This Dictionary contains Data i want to show in a Grid-Control: <Grid> <!-- Row and Column-Definitions here --> <Label Grid.Row="0" Grid.Column="0" Content="{Binding MyDict.Key=="foo" }" ToolTip="foo" /> <!-- some more labels --> </Grid> 1.) i dont know how to get access (in xaml) to the dictionary 2.) i want to bind the Value of a specified key to the Content-Property of the Label. how to do this?

Simple ListView data binding

倖福魔咒の 提交于 2019-12-19 19:53:25
问题 I'm trying to display data in a ListView with WPF and C#, and I'm confused by the different examples and methods I have seen. I'm looking for a fully working example similar to my program, or a list of pre-requisites to make it work. I'll be happy if I manage to display just 1 row of data from my collection. Currently, the list view displays nothing. C#: public partial class MainWindow : Window { public ObservableCollection<Row> Rows { get; set; } public MainWindow() { InitializeComponent();

Binding the Enabled property of a Android button with the MvvmCross

别说谁变了你拦得住时间么 提交于 2019-12-19 18:20:18
问题 I have a problem when I try to bind the "Enabled" property of my Android Button to a Boolean of my ViewModel using the MvvmCross framework and I really don't know the origin of it. So I have a ViewModel which contains the two following properties : private ProjectDetailDTO _projectDetail; public ProjectDetailDTO ProjectDetail { get { return this._projectDetail; } set { _projectDetail = value; RaisePropertyChanged(() => ProjectDetail); RaisePropertyChanged(() => HasPicture); } } private bool

How can I bind an ItemsControl.ItemsSource with a property in XAML?

一世执手 提交于 2019-12-19 16:15:47
问题 I have a simple window : <Window x:Class="WinActivityManager" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Grid> <ListView x:Name="lvItems" /> </Grid> </Window> And the associated code behind : public partial class WinActivityManager : Window { private ObservableCollection<Activity> Activities { get; set; } public WinActivityManager() { Activities = new ObservableCollection<Activity>(); InitializeComponent(); } //

Data Binding : Resources$NotFoundException when attribute of object is int

纵然是瞬间 提交于 2019-12-19 12:54:32
问题 I am trying to use Data binding. It is work properly if I use object that has attribute of string, but in this case I use int and it doesn't work. I have object User: public class User extends BaseObservable{ public int age; ...... public User() {} public int getAge() { return age; } public void setAge(int age) { this.age = age; } ... } here is my layout <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android"> <data> <variable name="user" type