I'm trying to port/adopt my Windows RT app to WIndows10 and I'm trying out the new bindings x:Bind. So far I'm able to bind to my ViewModel properties and other Viewelements. But now I'm trying to bind the text of a TextBox to a SelectedItem of a GridView. In classic binding I'm doing it like that. <TextBox x:Name="tb_textgroup" Grid.Row="
我试图将我的Windows RT应用程序移植到WIndows10,并尝试使用新的绑定x:绑定。 到目前为止,我可以绑定到我的ViewModel属性和其他Viewelements。 但现在我试图将文本框的文本绑定到GridView的SelectedItem。 在经典绑定中,我正在这样做。 <TextBox x:Name="tb_textgroup" Grid.Row="1" PlaceholderText="Change Groupname" T
I have a ViewModel with a complex property type and want to bind my view to a nested property of this object. My ViewModel is implementing INotifyPropertyChanged (or do be extact BaseViewModel is implementing it). The class of the parent property is not implementing INotifyPropertyChanged . When I'm updating the value of the parent property, the nested property is not updating. Can you
我有一个具有复杂属性类型的ViewModel,并希望将我的视图绑定到此对象的嵌套属性。 我的ViewModel正在实现INotifyPropertyChanged (或者需要提取BaseViewModel来实现它)。 父属性的类没有实现INotifyPropertyChanged 。 当我更新父属性的值时,嵌套属性不会更新。 你能告诉我如何实现这个功能? 视图模型 public class ViewModel : BaseViewModel { private Car _myCarProperty; public Car MyCarProperty
I have a kind of annoying scenario here. In my WPF GUI I declared some RadioButtons, I want the right one to be checked when the GUI loads. XAML: <RadioButton Grid.Row="0" Grid.Column="0" Name="RadioButtonShowSettings" GroupName="OnTrayClick" Content="Show settings window" HorizontalAlignment="Left" VerticalAlignment="Center" /> <RadioButton Grid.Row="1" Grid.Column="0" Name="RadioBu
我在这里有一种令人讨厌的情景。 在我的WPF GUI中,我声明了一些RadioButton,我希望在加载GUI时检查正确的一个。 XAML: <RadioButton Grid.Row="0" Grid.Column="0" Name="RadioButtonShowSettings" GroupName="OnTrayClick" Content="Show settings window" HorizontalAlignment="Left" VerticalAlignment="Center" /> <RadioButton Grid.Row="1" Grid.Column="0" Name="RadioButtonOpenFile" GroupName="OnTrayC
I want the background colour of a WPF datagrid cell to change colour when the contents have been modified. Each cell has behind it a ViewModel object which contains the following properties - Value, OriginalValue and Modified. When the user edits the cell contents, this automatically triggers the Amount property via data binding. This property setter then checks it against the original value a
我希望WPF数据网格单元格的背景颜色在内容被修改时改变颜色。 每个单元格后面都有一个ViewModel对象,其中包含以下属性 - 值,原始值和修改。 当用户编辑单元格内容时,这会通过数据绑定自动触发Amount属性。 然后,此属性设置器将其与原始值进行核对,并分别将布尔值Modified属性设置为true或false,通知要更新的属性的绑定。 到目前为止,我已经通过DataGridTextColumn的ElementStyle属性的Style实现了部分结果,如下所示
I'm starting a WPF project, and just finished the base of the UI, it seems very convoluted though, so I'm not sure if I've gone around laying it out in the right way. I don't want to get to start developing the back-end and realise that I've done the front wrong, and make life harder for myself. Coming from a background of <DIV>'s and CSS to style this is a lot di
我开始了一个WPF项目,刚刚完成了UI的基础,但它看起来很复杂,所以我不确定我是否已经以正确的方式进行了布局。 我不想开始开发后端,并意识到我已经犯了错误,让自己的生活变得更加艰难。 从<DIV>的CSS和CSS风格的背景来看,这有很大的不同,并且真的想从一开始就把它做好。 基本上这是一个星期的日历(7天,星期日,星期日,默认为本周)。哪个最终会连接到一个数据库,如果我在这一天有预约的东西,它会在相关日
I have come across a problem with binding to a PasswordBox. It seems it's a security risk but I am using the MVVM pattern so I wish to bypass this. I found some interesting code here (has anyone used this or something similar?) http://www.wpftutorial.net/PasswordBox.html It technically looks great, but I am unsure of how to retrieve the password. I basically have properties in my Logi
我遇到了绑定到密码框的问题。 看起来这是一个安全风险,但我使用MVVM模式,所以我想绕过这个。 我在这里找到了一些有趣的代码(有没有人使用过这个或类似的东西?) http://www.wpftutorial.net/PasswordBox.html 它在技术上看起来不错,但我不确定如何检索密码。 我基本上在我的LoginViewModel Username和Password属性。 Username很好,并且正在工作,因为它是一个TextBox 。 我使用上面的代码,并输入了这个 <P
I have a DataTemplate for a ListView in XAML: <DataTemplate x:Key="ResultItemTemplate"> <Grid Grid.Column="2"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="auto" /> </Grid.ColumnDefinitions> <Grid.RowDef
我在XAML中有一个ListView的DataTemplate: <DataTemplate x:Key="ResultItemTemplate"> <Grid Grid.Column="2"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="auto" /> </Grid.ColumnDefinitions> <Grid.RowDefiniti
I have a View that is basically setup like this: <Grid> <ViewBox> <Grid> <ItemsControl ItemsSource="{Binding MyItems}" ItemTemplate="{Binding Source={StaticResource MyItemsDataTemplate}}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Grid /> </ItemsPan
我有一个基本上这样设置的视图: <Grid> <ViewBox> <Grid> <ItemsControl ItemsSource="{Binding MyItems}" ItemTemplate="{Binding Source={StaticResource MyItemsDataTemplate}}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Grid /> </ItemsPanelTemplate>
I have a custom ItemTemplate for a ListBox and I need to "bind" a TextBlock to some special method / property. My ListBox Source is an ObservableCollection<SearchResultItem> . SearchResultItem containing some properties. The text need to change based on the value of another object. EG if this object equals "foo" I need the text value to call the method GetProperty(
我有一个ListBox的自定义ItemTemplate,我需要将一个TextBlock“绑定”到一些特殊的方法/属性。 我的列表框源是一个ObservableCollection<SearchResultItem> 。 SearchResultItem包含一些属性。 文本需要根据另一个对象的值进行更改。 EG如果这个对象等于“foo”我需要文本值来调用SearchResultItem上的GetProperty("foo")方法来获取正确的值。 这是一个代码示例: <DataTemplate> .. //Here is a Lab
sorry, I am pretty new in WPF and I think it's pretty easy, but I have no idea right now. I have a DataTemplate which I want to use as a TreeViewItem-Header (I've copied the template from somewhere else, so I am not really sure what it does at the TextBlock part): <Window.Resources> <DataTemplate x:Key="WI_Bug"> <DockPanel> <Image Source="im
对不起,我在WPF中很新,我觉得这很容易,但我现在不知道。 我有一个我想用作TreeViewItem-Header的DataTemplate(我从其他地方复制了模板,所以我不太确定它在TextBlock部分的作用): <Window.Resources> <DataTemplate x:Key="WI_Bug"> <DockPanel> <Image Source="imagesbug-icon.png" Height="16" Width="16"/> <TextBlock Text ="{Binding Path=Name}"/