xaml

UWP resources not found

心已入冬 提交于 2020-01-30 11:52:27
问题 I have an UWP application which is working fine on various machines but on one particular machine, it is crashing silently. When I debugged the installed app through visual studio I figured out that it is not getting the resources on the XAML file e.g {ThemeResource ComboBoxDropdownContentMargin} {Binding TemplateSettings.DropDownContentMinWidth, RelativeSource={RelativeSource Mode=TemplatedParent}} The Output window is showing the following exception Exception thrown at 0x751641E8

Bind static data as dictionary key

自古美人都是妖i 提交于 2020-01-30 11:32:22
问题 How to bind dictionary static data as dictionary key? My XAML code: <TextBlock x:Name="AxisXTextBlock" Width="37" Height="18" Margin="106,19,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" FontFamily="Source Code Pro" Text="{Binding DataStructure.DictionaryOfValuesReadOnly[AXIS_X].IntValue, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap" /> Class of static data for keys of dictionaries: public static class DataNames { public static string SomeDataName { get; } =

Bind static data as dictionary key

筅森魡賤 提交于 2020-01-30 11:31:08
问题 How to bind dictionary static data as dictionary key? My XAML code: <TextBlock x:Name="AxisXTextBlock" Width="37" Height="18" Margin="106,19,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" FontFamily="Source Code Pro" Text="{Binding DataStructure.DictionaryOfValuesReadOnly[AXIS_X].IntValue, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap" /> Class of static data for keys of dictionaries: public static class DataNames { public static string SomeDataName { get; } =

WPF XAML Change Style Template Property for Some Elements

旧街凉风 提交于 2020-01-30 11:27:26
问题 In a WPF application I have a style used for buttons: <Style TargetType="Button" x:Key="ButtonEllipse"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <StackPanel Orientation="Vertical"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 0 0 10"/> <Image x:Name="ButtonImage" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="None" Source="/MyProject;component/Images/ButtonEllipse.png"/> </StackPanel> <

WPF XAML Change Style Template Property for Some Elements

£可爱£侵袭症+ 提交于 2020-01-30 11:27:26
问题 In a WPF application I have a style used for buttons: <Style TargetType="Button" x:Key="ButtonEllipse"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <StackPanel Orientation="Vertical"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 0 0 10"/> <Image x:Name="ButtonImage" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="None" Source="/MyProject;component/Images/ButtonEllipse.png"/> </StackPanel> <

XAML Itemscontrol binding to property outside of the control

折月煮酒 提交于 2020-01-30 11:24:51
问题 I have a list of transactions that I am loading into an ItemsControl but I want to show the UserId from my viewmodel in each row/transaction. The userId is not in the transaction list, it's a property in the viewmodel I am trying to access but it seems everything I've tried doesn't work and I don't know why. All I get is a blank column value. (yes, I did confirm the property is not empty. even hardcoded a value and got nothing). My understanding is I should be able to use the RelativeSource

XAML Itemscontrol binding to property outside of the control

喜你入骨 提交于 2020-01-30 11:24:46
问题 I have a list of transactions that I am loading into an ItemsControl but I want to show the UserId from my viewmodel in each row/transaction. The userId is not in the transaction list, it's a property in the viewmodel I am trying to access but it seems everything I've tried doesn't work and I don't know why. All I get is a blank column value. (yes, I did confirm the property is not empty. even hardcoded a value and got nothing). My understanding is I should be able to use the RelativeSource

Center text in XAML Column and ListViewItem

纵然是瞬间 提交于 2020-01-30 11:00:48
问题 I want to be able to center the text in the column and the cell for one column. This is the XAML that I have so far. I cannot figure out how to do it for one item opposed to all of them. <ListView Grid.Column="0" Margin="3,3,0,3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Visible" SelectionMode="Single"> <ListView.View> <GridView AllowsColumnReorder="False"> <GridView.Columns>

How to fire a textbox command upon losing focus in WPF?

无人久伴 提交于 2020-01-30 10:45:13
问题 The following template works fine if the user presses Enter , although I want the command to fire when the TextBox loses focus as well. How can I do this? The following is my TextBox template <DataTemplate x:Key="PhantomNameEditTemplate"> <TextBox Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}"> <TextBox.InputBindings> <KeyBinding Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=DataGrid}, Path=DataContext.RenameCommand}" CommandParameter="{Binding}" Key=

How to fire a textbox command upon losing focus in WPF?

孤街醉人 提交于 2020-01-30 10:43:44
问题 The following template works fine if the user presses Enter , although I want the command to fire when the TextBox loses focus as well. How can I do this? The following is my TextBox template <DataTemplate x:Key="PhantomNameEditTemplate"> <TextBox Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}"> <TextBox.InputBindings> <KeyBinding Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=DataGrid}, Path=DataContext.RenameCommand}" CommandParameter="{Binding}" Key=