binding

How to get a parent value in multibinding

寵の児 提交于 2019-12-21 07:15:35
问题 I'm using dataTemplate . This is the template: <ItemsControl ItemsSource="{Binding RAM.Partitions}"> <ItemsControl.ItemTemplate> <DataTemplate> <Grid> <TextBlock Text="{Binding Position, StringFormat={}{0}k}"/> <Grid Grid.Column="1"> <Border> <Border.Height> <MultiBinding Converter="{StaticResource MultiplyConverter}"> <Binding ElementName="LayoutRoot" Path="ActualHeight"/> <Binding Path="Size" /> <Binding Path="RAM.Size" /> </MultiBinding> </Border.Height> </Border> </Grid> </Grid> <

JavaFX 2: resizable rectangle containing text

筅森魡賤 提交于 2019-12-21 06:57:12
问题 I want to display a rectangle that contains a text/label. For this purpose I created a stackpane and added a rectangle and a label to it. However the text/label is not centered correctly. It is placed outside of the rectangle (to the left). This is the code I am currently using: createRectangle(String name) { pane = new StackPane(); text = new Label(name); rect = new Rectangle(); // bind rectangle width to text width and add 10 rect.widthProperty().bind(text.widthProperty().add(10)); rect

Default value at design time XAML

回眸只為那壹抹淺笑 提交于 2019-12-21 06:55:36
问题 I have a binded TextBlock , XAML: <TextBlock Text="{Binding MyText}"/> I know the FallbackValue can be used if the Binding isn't available, but this happens at run time ? Is there any way to show a default value at design time ? It would make things easier if I could see a value when designing my windows instead of an empty TextBlock . Thanks 回答1: If you would prefer a less verbose version of Ian Bamforth's answer, you can just do <TextBlock Text="{Binding MyText, FallbackValue=None}"/> 回答2:

Default value at design time XAML

冷暖自知 提交于 2019-12-21 06:55:14
问题 I have a binded TextBlock , XAML: <TextBlock Text="{Binding MyText}"/> I know the FallbackValue can be used if the Binding isn't available, but this happens at run time ? Is there any way to show a default value at design time ? It would make things easier if I could see a value when designing my windows instead of an empty TextBlock . Thanks 回答1: If you would prefer a less verbose version of Ian Bamforth's answer, you can just do <TextBlock Text="{Binding MyText, FallbackValue=None}"/> 回答2:

How to call an async method from a property setter

谁说我不能喝 提交于 2019-12-21 06:42:42
问题 Here is my problem: I have a WPF TextBox binded on the property Filter. It works as a filter: each time the TextBox.Text changes, the Filter property is set. <TextBox Text="{Binding Filter, UpdateSourceTrigger=PropertyChanged, Mode=OneWayToSource}" /> Now on the ViewModel there is my Filter property: each time the filter changes I update my values. private string _filter; public string Filter { get { return _filter; } set { _filter = value; // call to an async WEB API to get values from the

WPF Bind List to Multi-Column ListBox

末鹿安然 提交于 2019-12-21 06:28:23
问题 Since starting in WPF I am still struggling to understand the data binding functionality. I am trying to use a multi column list box and my XAMl looks like this: <ListBox Name="RecordList"> <ListView Name="RecordListView"> <ListView.View> <GridView> <GridView.Columns> <GridViewColumn Header="1" Width="Auto" DisplayMemberBinding="{Binding Path=Field1}" /> <GridViewColumn Header="2" Width="50" DisplayMemberBinding="{Binding Path=Field2}" /> <GridViewColumn Header="3" Width="100"

WPF binding to XPath-reachable value of an element property

时光总嘲笑我的痴心妄想 提交于 2019-12-21 05:49:14
问题 I'd like to bind to a value reachable only with XPath from the property of an element. The element is a ComboBox populated from some XML, and its property is SelectedItem. SelectedItem points to an XML element, and I'd like to bind to a child element's value within that, which can be reached with an XPath. The XAML looks like this, so far: <StackPanel Orientation="Vertical" Margin="10,10"> <StackPanel Orientation="Horizontal"> <Label>Partner</Label> <ComboBox Name="Partner" Margin="10,0"

WCF: Having trouble with one-way callbacks

偶尔善良 提交于 2019-12-21 05:02:50
问题 I keep getting this puzzling error upon invocation of a one-way callback to a WPF client from a WCF service. The message could not be transferred within the allotted timeout of 00:01:00. There was no space available in the reliable channel's transfer window. The time allotted to this operation may have been a portion of a longer timeout. It isn't sending too much data, just a list of strings that only has one single, short string within. My server has the following config: <xml version="1.0"?

Ninject conditional binding based on parameter type

风格不统一 提交于 2019-12-21 04:14:41
问题 I'm using a factory to return a datasender: Bind<IDataSenderFactory>() .ToFactory(); public interface IDataSenderFactory { IDataSender CreateDataSender(Connection connection); } I have two different implementations of datasender (WCF and remoting) which take different types: public abstract class Connection { public string ServerName { get; set; } } public class WcfConnection : Connection { // specificProperties etc. } public class RemotingConnection : Connection { // specificProperties etc.

WPF - Binding to current item from within group header style

风格不统一 提交于 2019-12-21 04:09:16
问题 I'm something of a WPF noob so please take it easy on me ;-) I am trying to create a grouped DataGrid (WPF toolkit version). I have successfully created the data source, the DataGrid itself, the required CollectionViewSource and the Style for the group header (which uses an expander). I want to group by a property called 'Assign_To' and have the relevant value (the value that the grouped items share) show up in the header. However, I cannot work out how to bind to the current group/item in