multidatatrigger

Efficiency of (multiple) MultiDataTrigger vs. Converter

倾然丶 夕夏残阳落幕 提交于 2019-12-10 14:45:15
问题 I'm currently analyzing some XAML that uses style that make extensive use of MultiDataTriggers (8-10 multi data triggers per style, with 4-6 conditions per trigger). When looking at this I'm considering whether it would be more efficient to use a converter (or multi value converter), especially as MultiDataTriggers cannot be debugged. Can anyone authoritatively state how MultiDataTriggers are compiled? I understand that the Conditions are ANDed together, is this compiled in such a way that

How to access controls parent's property in a style

佐手、 提交于 2019-12-08 02:47:45
问题 My Listview has items datatemplated as a label. I'm designing a style for that label and I don't know how to access the parent's(ListViewItem) IsSelected property. EDIT - tried the suggestions below, but still getting an exception, here's my complete code: <Style x:Key="ListViewItemStyle" TargetType="ListViewItem"> <Setter Property="SnapsToDevicePixels" Value="true"/> <Setter Property="OverridesDefaultStyle" Value="true"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate

Disable/enable button with DataGridTextColumn validation

此生再无相见时 提交于 2019-12-07 07:33:37
问题 I have this DataGrid : <DataGrid ItemsSource="{Binding CustomerXml}" Name="customersDataGrid" AutoGenerateColumns="False" DataContext="{Binding}"> <DataGrid.Columns> <DataGridTextColumn Header="Name"> <DataGridTextColumn.Binding> <Binding Path="Name" ValidatesOnDataErrors="True" UpdateSourceTrigger="PropertyChanged" NotifyOnValidationError="True"> <Binding.ValidationRules> <local:NameValidationRule/> </Binding.ValidationRules> </Binding> </DataGridTextColumn.Binding> </DataGridTextColumn> ...

Usage DataTrigger in WPF

允我心安 提交于 2019-12-07 07:17:24
I have a TextBox control defined in XAML and I want to apply different background colors to the TextBox based on its IsReadOnly or IsEnabled properties. I used dataTriggers to actually switch between the colors as shown below: <Style x:Key="TextBoxStyle" TargetType="TextBox"> <Style.Triggers> <DataTrigger Binding="{Binding IsEnabled}" Value="True"> <Setter Property="TextBox.Background" Value="Yellow"/> </DataTrigger> <DataTrigger Binding="{Binding IsReadOnly}" Value="True"> <Setter Property="TextBox.Background" Value="Red"/> </DataTrigger> <MultiDataTrigger> <MultiDataTrigger.Conditions>

How to access controls parent's property in a style

徘徊边缘 提交于 2019-12-06 04:29:55
My Listview has items datatemplated as a label. I'm designing a style for that label and I don't know how to access the parent's(ListViewItem) IsSelected property. EDIT - tried the suggestions below, but still getting an exception, here's my complete code: <Style x:Key="ListViewItemStyle" TargetType="ListViewItem"> <Setter Property="SnapsToDevicePixels" Value="true"/> <Setter Property="OverridesDefaultStyle" Value="true"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ListViewItem"> <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding

Disable/enable button with DataGridTextColumn validation

淺唱寂寞╮ 提交于 2019-12-05 12:30:24
I have this DataGrid : <DataGrid ItemsSource="{Binding CustomerXml}" Name="customersDataGrid" AutoGenerateColumns="False" DataContext="{Binding}"> <DataGrid.Columns> <DataGridTextColumn Header="Name"> <DataGridTextColumn.Binding> <Binding Path="Name" ValidatesOnDataErrors="True" UpdateSourceTrigger="PropertyChanged" NotifyOnValidationError="True"> <Binding.ValidationRules> <local:NameValidationRule/> </Binding.ValidationRules> </Binding> </DataGridTextColumn.Binding> </DataGridTextColumn> ... </DataGrid.Columns> </DataGrid> and I'm trying disabling and enabling save button by ValidationRule

Is it possible to get a popup to ignore MenuDropAlignment in a WPF / Touch app?

好久不见. 提交于 2019-12-03 08:52:15
问题 As a bit of background - Windows has a facility for Touch/TabletPCs whereby it shifts the position of popups/menus depending on your "handedness" (to prevent the menu appearing under your hand). Essentially what this does is if you are set to "right handed" (which it seems to default to once you've connected a touch device), every popup you open is artificially kicked to the left - this causes massive layout issues where we try and line up a popup with the item it "popped up from" : Tablet PC

Is it possible to get a popup to ignore MenuDropAlignment in a WPF / Touch app?

跟風遠走 提交于 2019-12-02 22:52:04
As a bit of background - Windows has a facility for Touch/TabletPCs whereby it shifts the position of popups/menus depending on your "handedness" (to prevent the menu appearing under your hand). Essentially what this does is if you are set to "right handed" (which it seems to default to once you've connected a touch device), every popup you open is artificially kicked to the left - this causes massive layout issues where we try and line up a popup with the item it "popped up from" : Tablet PC Settings set to Left handed - no artificial correction from Windows Tablet PC Settings set to Right

Validation Rule not updating correctly with 2 validation rules

让人想犯罪 __ 提交于 2019-12-01 08:17:32
问题 I Have looked through some posts regarding Validation Rules but havn't come across the problem I am experiencing. I am using a Validation Rule for a Textbox in a WPF Window. I have two checks, one for empty Textbox, and one for invalid characters using a RegEx match. My problem is such: In my Textbox: Type A - Works, Displays nothings Hit Backspace for empty string - Works, displays validation error message "Please enter a value in all fields" Type ! - Does not work - It should display

HighlightBrushKey settings not working in Windows 7

≡放荡痞女 提交于 2019-11-29 23:02:53
问题 I have the following style defined in my Resource Dictionary: <!-- ListViewItem Styles--> <LinearGradientBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" StartPoint="0,0" EndPoint="0,1"> <LinearGradientBrush.GradientStops> <GradientStopCollection> <GradientStop Color="#F7D073" Offset="0"/> <GradientStop Color="#F1A62F" Offset="1"/> </GradientStopCollection> </LinearGradientBrush.GradientStops> </LinearGradientBrush> <LinearGradientBrush x:Key="{x:Static SystemColors.ControlBrushKey}"