binding

Bind Dependency Property, defined in Code-Behind, through Xaml to a Property in the DataContext of a UserControl

老子叫甜甜 提交于 2020-01-11 12:16:14
问题 I want to use code similar to that found here. The issue I'm having is that I'd like to extend it to allow the value set in the XAML to use {Binding PropertyOfViewModel} like this: <local:TestControl> <local:TestControl.TestObject> {Binding PropertyOfViewModel} </local:TestControl.TestObject> </local:TestControl> The problem, is that it errors with "Cannot Convert "{Binding PropertyOfViewModel}"". The TestObject property is defined as a dependency property in the code-behind of the view. If I

Using boost::bind to bind member-function to boost::bisect?

徘徊边缘 提交于 2020-01-11 12:09:55
问题 I've had problems with this before but now it's somehow working. Now I've following problem. I need to bind values into member-function before I call boost::bisect with the same function. I found pretty good tutorial and I've followed it but it seems that I'm still doing something wrong. At first I created test class where I got following working: std::pair<double, double> result = bisect(&Func, 0.0, 1.0, TerminationCondition()); double root = (result.first + result.second) / 2; After that I

Bind width and height of dynamically loaded fxml

给你一囗甜甜゛ 提交于 2020-01-11 11:39:07
问题 At the moment I have an issue with dynamically loaded FXML files during runtime. Once they are added to a Pane, they do not resize to use the full widht & height of that pane. I use this method to load a FXML in my Pane: public void showContentPane(String sURL){ //1. sURL can be something like "/GUI/home/master/MasterHome.fxml" //2. getContentPane() returns following object: Pane pContent try { URL url = getClass().getResource(sURL); getContentPane().getChildren().clear(); Node n = (Node)

How to add or remove an item from a CollectionViewSource?

故事扮演 提交于 2020-01-11 09:42:12
问题 I want to bind a datagrid.itemsource to a List with anonymous type,so i bind it to a collectionViewSource,but i need to add or remove an item to the list,but i don't know how? 回答1: CollectionView and CollectionViewSource are, as their name suggest, only views . You can only manipulate the original collection. You should use an ObservableCollection if you want the changes to be automatically reflected in your UI. I would advise against using anonymous types for data binding. But if you must -

How to add or remove an item from a CollectionViewSource?

拈花ヽ惹草 提交于 2020-01-11 09:41:08
问题 I want to bind a datagrid.itemsource to a List with anonymous type,so i bind it to a collectionViewSource,but i need to add or remove an item to the list,but i don't know how? 回答1: CollectionView and CollectionViewSource are, as their name suggest, only views . You can only manipulate the original collection. You should use an ObservableCollection if you want the changes to be automatically reflected in your UI. I would advise against using anonymous types for data binding. But if you must -

WPF Binding and Dynamically Assigning StringFormat Property

拟墨画扇 提交于 2020-01-11 04:39:30
问题 I have a form that is generated based on several DataTemplate elements. One of the DataTemplate elements creates a TextBox out of a class that looks like this: public class MyTextBoxClass { public object Value { get;set;} //other properties left out for brevity's sake public string FormatString { get;set;} } I need a way to "bind" the value in the FormatString property to the "StringFormat" property of the binding. So far I have: <DataTemplate DataType="{x:Type vm:MyTextBoxClass}"> <TextBox

When to use StringProperty over String?

谁说我不能喝 提交于 2020-01-11 04:22:05
问题 I am developing an application in JavaFX where I want to represent information of a Person in a single Person class. I came across a tutorial where a Person's name was being represented as a StringProperty instead of String . I have searched for the differences of these and found out this and this but the explanation there is not sufficient for me to grab the concept. Some post on the net said there are advantages of using StringProperty over String but could not mention them. Now my question

how to change button template dynamically WPF

*爱你&永不变心* 提交于 2020-01-11 04:20:08
问题 How can I change a Button template dynamically? I have a ComboBox where by changing his selected value I want to change a Button Template . This is what I have been trying to do: <Window.Resources> <ControlTemplate x:Key="ButtonControlTemplate1" TargetType="{x:Type Button}"> <Grid> <Rectangle Fill="#FF2D2D7A" Margin="7.5,9.5,8.5,11" Stroke="Black" RadiusX="45" RadiusY="45" StrokeThickness="6"/> </Grid> </ControlTemplate> <ControlTemplate x:Key="ButtonControlTemplate2" TargetType="{x:Type

WPF TextBox Binding with Formatting

佐手、 提交于 2020-01-10 18:52:20
问题 I have just upgraded our wpf application from 3.5sp1 to 4.0. The code below we use to bind the textbox to the underlying view model. The textbox is editable. <TextBox HorizontalContentAlignment="Right" Text="{Binding Path=Price, StringFormat={0:#,##0;(#,##0)}, Mode=TwoWay, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True}"/> In 3.5sp1 the formatting would only occur initially. So when the textbox was loaded and bound to value 4000, the formatting

How to do runtime binding based on CPU capabilities on linux

[亡魂溺海] 提交于 2020-01-09 19:16:00
问题 Is it possible to have a linux library (e.g. "libloader.so") load another library to resolve any external symbols? I've got a whole bunch of code that gets conditionally compiled for the SIMD level to be supported ( SSE2, AVX, AVX2 ). This works fine if the build platform is the same as the runtime platform. But it hinders reuse across different processor generations. One thought is to have executable which calls function link to libloader.so that does not directly implement function . Rather