xaml

XAML binding against Auto-Implemented properties?

我只是一个虾纸丫 提交于 2021-02-04 20:59:02
问题 Is it possible to using XAML data binding to a model with Auto-Implemented properties? class ClassA { // pseudo code. int Width { get; set{ NotifyPropertyChange("Width");} } } //XAML <textBox width="{Binding Path=Width,Mode=OneWay}"/> 回答1: Auto-properties don't have a half auto mode. It needs to either be an auto-property with nothing extra: int Width { get; set; } or a fully expanded property with a backing store that can have additional code added to it, like change notification: int _width

Visual Studio 2012 XAML Designer - Cannot add more than one item

烂漫一生 提交于 2021-02-04 18:41:06
问题 I'm new to VS 2012, and I have this issue every time I use the XAML Designer . Every time I add an item (e.g. a RadioButton, and Image, a Label) to my window, it deletes the previous one. As a result, I can have only one item in my window, I know it is absurd, what am I missing? Here is the xaml of the window <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:WpfViewers="clr-namespace:Microsoft.Samples.Kinect

WPF Image control not disposing source

核能气质少年 提交于 2021-02-04 18:30:09
问题 I've read multiple threads about this, but still cannot find anything that works. I'm writing program for basically browsing database of images. I have a ListView with DataTemplate: <DataTemplate> <Grid Width="Auto" Height="Auto" > <Image VerticalAlignment="Center" Source="{Binding IsAsync=True, Converter={StaticResource Converter}, ConverterParameter={x:Static viewModel:SearchViewModel.MiniaturesHeight}}" Grid.RowSpan="2" Stretch="None" Margin="5" Height="{Binding Source={StaticResource

Checkbox with RightToLeft flow direction in Windows 8.1

∥☆過路亽.° 提交于 2021-02-04 16:46:35
问题 Why checkbox checked mark appears with mirrored image in windows 8.1, when applying FlowDirection as RightToLeft. it is normally in other windows os. <CheckBox HorizontalAlignment="Center" VerticalAlignment="Center" IsChecked="True" FlowDirection="RightToLeft"> 回答1: if you want this as same in other OS, edit the template and hard code as left to right for the Tick. 回答2: I found this answer on another search.. You could set your own style to the checkbox: <Window x:Class="WpfApplication21

Wpf Panel Background problem

狂风中的少年 提交于 2021-02-04 16:11:11
问题 When i don't set background of my panel i can not get mouse events on that. why this behaviour? I am able to get mouse events on panel by setting Background to Transparent which is null by default. Whats the difference between Background null and Transparent? 回答1: When Background=null it doesn't issue any drawing command to MILCore when rendering, and it doesn't count the control's entire area in hit testing. When Background=Transparent , it issues an ordinary drawing command to MILCore when

Wpf Panel Background problem

大憨熊 提交于 2021-02-04 16:11:08
问题 When i don't set background of my panel i can not get mouse events on that. why this behaviour? I am able to get mouse events on panel by setting Background to Transparent which is null by default. Whats the difference between Background null and Transparent? 回答1: When Background=null it doesn't issue any drawing command to MILCore when rendering, and it doesn't count the control's entire area in hit testing. When Background=Transparent , it issues an ordinary drawing command to MILCore when

Cannot find resource named 'X', why not?

一曲冷凌霜 提交于 2021-02-04 14:43:37
问题 I want to create a wizard UI for inventories management. The relevant line in the xaml is: <ContentPresenter Content="{Binding Current}" ContentTemplateSelector="{StaticResource inventorySelector}"/> "Current" is the currently active view model, one of AvailableInventoriesViewModel, GroupsViewModel, NewArticlesViewModel, ResultViewModel. The DataTemplateSelector I have defined as such: using System.Diagnostics; using System.Windows; using System.Windows.Controls; using Centron.WPF

How can I get a list of built-in routed events in WPF

亡梦爱人 提交于 2021-02-04 11:38:05
问题 I'm just starting out with WPF and need some help with routed events. I have added a datagrid with some animation, but i can't seem to find anywhere that shows me a list of routed events to use on the datagrid, or any other control for that matter. Seems to be a guessing game so far. I thought the datagrid standard events, such as CellEditEnding, was it but they are not as it says "Invalid event name". The example I copied used a MouseEnter routed event, but i don't know what else there is

How can I get a list of built-in routed events in WPF

风格不统一 提交于 2021-02-04 11:37:18
问题 I'm just starting out with WPF and need some help with routed events. I have added a datagrid with some animation, but i can't seem to find anywhere that shows me a list of routed events to use on the datagrid, or any other control for that matter. Seems to be a guessing game so far. I thought the datagrid standard events, such as CellEditEnding, was it but they are not as it says "Invalid event name". The example I copied used a MouseEnter routed event, but i don't know what else there is

Get clicked object from ItemsControl and populate Popup with its properties

有些话、适合烂在心里 提交于 2021-02-02 09:57:25
问题 I've got an ItemsControl which displays objects from a list from my viewmodel. I also have code to display a Popup when the user click on an item in the ItemsControl. However I don't know how to get the actual object from the clicked item to read its properties and display them in the Popup . I've got a Click event handler for the Button (which is used to display my items in the ItemsControl ) and I tried to see in the debugger if the button contains the desired object but apparently it doesn