xaml

Changing WPF TreeView SelectedItem in SelectedItemChanged event

早过忘川 提交于 2021-02-08 05:10:00
问题 I currently have a WPF Treeview with a structure of: --> Group 1 (Hierarchical Group) ---> Group 2 (Hierarchical Group) ---> Item 1 ---> Item 2 ---> Item 3 I currently have a SelectedItemChanged event handler hooked up to this treeview like so private void TreeViewControl_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e) { if (e.NewValue is Item) { Item item = e.NewValue as Item; if (Item != SelectedItem) { //keep SelectedItem in sync with Treeview.SelectedItem

Changing WPF TreeView SelectedItem in SelectedItemChanged event

柔情痞子 提交于 2021-02-08 05:07:31
问题 I currently have a WPF Treeview with a structure of: --> Group 1 (Hierarchical Group) ---> Group 2 (Hierarchical Group) ---> Item 1 ---> Item 2 ---> Item 3 I currently have a SelectedItemChanged event handler hooked up to this treeview like so private void TreeViewControl_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e) { if (e.NewValue is Item) { Item item = e.NewValue as Item; if (Item != SelectedItem) { //keep SelectedItem in sync with Treeview.SelectedItem

WPF FlowDocument Binding

末鹿安然 提交于 2021-02-08 04:11:47
问题 I am using Microsoft's XAML/HTML converter to convert HTML from a database into a XAML string. The Microsoft converter seems to be formatting the text correctly, but I'm having trouble binding the output to a XAML object. For example, using the following HTML: <span style="font-weight: bold; font-family: Georgia; color: rgb(0, 96, 144); text-decoration: underline;">Hello world.</span> I will get the XAML output: <Section xml:space="preserve" xmlns="http://schemas.microsoft.com/winfx/2006/xaml

WPF FlowDocument Binding

浪子不回头ぞ 提交于 2021-02-08 04:10:09
问题 I am using Microsoft's XAML/HTML converter to convert HTML from a database into a XAML string. The Microsoft converter seems to be formatting the text correctly, but I'm having trouble binding the output to a XAML object. For example, using the following HTML: <span style="font-weight: bold; font-family: Georgia; color: rgb(0, 96, 144); text-decoration: underline;">Hello world.</span> I will get the XAML output: <Section xml:space="preserve" xmlns="http://schemas.microsoft.com/winfx/2006/xaml

WPF DataGrid: How do I access a ComboBox in a specific row of a DataGridTemplateColumn?

℡╲_俬逩灬. 提交于 2021-02-08 03:42:25
问题 My app correctly populates a DataGrid column with ComboBoxes, using the following XAML code: <DataGridTemplateColumn Header="Thickness"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <ComboBox ItemsSource="{Binding SteelThickness, RelativeSource={RelativeSource AncestorType=Window}}" SelectedItem="{Binding BottomPlateThickness, UpdateSourceTrigger=PropertyChanged}" SelectionChanged="ComboBox_SelectionChanged" /> </DataTemplate> </DataGridTemplateColumn.CellTemplate> <

xamarin forms xaml OnPlatform not working on bindings

安稳与你 提交于 2021-02-07 21:54:22
问题 <cv:BindableComboBox ItemsSource="{Binding Themes}" SelectedValue="{Binding SelectedTheme}"> <cv:BindableComboBox.Title> <OnPlatform x:TypeArguments="x:String" iOS="{Binding ThemePickerTitle}" Android="{Binding ThemePickerTitle}"/> </cv:BindableComboBox.Title> </cv:BindableComboBox> so I have picker and I want to bind its Title to ThemePickerTitle property. It works well if I write it as inline attrubute. But I dont want to have title on windows. So I write OnPlatform to have it only on Ios

xamarin forms xaml OnPlatform not working on bindings

时光怂恿深爱的人放手 提交于 2021-02-07 21:52:59
问题 <cv:BindableComboBox ItemsSource="{Binding Themes}" SelectedValue="{Binding SelectedTheme}"> <cv:BindableComboBox.Title> <OnPlatform x:TypeArguments="x:String" iOS="{Binding ThemePickerTitle}" Android="{Binding ThemePickerTitle}"/> </cv:BindableComboBox.Title> </cv:BindableComboBox> so I have picker and I want to bind its Title to ThemePickerTitle property. It works well if I write it as inline attrubute. But I dont want to have title on windows. So I write OnPlatform to have it only on Ios

WPF TextBox EventTrigger sequence of events

拜拜、爱过 提交于 2021-02-07 21:45:54
问题 I have a dynamic WPF input form, whereby a list of input text boxes is displayed based on the contents of a collection of data. The text of each text box is bound to a Value field in the data, when any of these fields changes I am using firing a Command which then executes a calculation in a script (also dynamically provided) using the values of the input field. My question is how I can get the Command to execute after the field value has changed. At the moment I am firing the Command based

Page with type parameter

北战南征 提交于 2021-02-07 19:27:46
问题 I would like to use new feature of UWP -> x:Bind. In order to that, all my pages need to have ViewModel property (as described in tutorials). To avoid code duplicity, I have established base class as follows: public abstract class BasePage<TBaseVM> : Page, where TBaseVM : BaseVM { public TBaseVM VM { get; private set; } protected BasePage() { DataContextChanged += (s, e) => VM = e.NewValue as TBaseVM; } } As you can see this BasePage class contains property called "VM" and property is of type

Get thumb position of slider from XAML / Slider Template

眉间皱痕 提交于 2021-02-07 18:11:16
问题 How to get the slider's thumb position within the Style? I want to show the actual value at the position of the thumb. This would be possible by changing the width of the following textblock accordingly to the value. But how to get the position of the thumb? <TextBlock Grid.Column="0" Width="THUMB POSITION" HorizontalAlignment="Right" Grid.Row="0" Text="{Binding Path=Value, RelativeSource={RelativeSource TemplatedParent}}"></TextBlock> The full style is shown here: <Style x:Key=