controltemplate

WPF: Binding to ObservableCollection in ControlTemplate is not updated

徘徊边缘 提交于 2019-12-11 06:06:58
问题 I created a ControlTemplate for my custom control MyControl . MyControl derives from System.Windows.Controls.Control and defines the following property public ObservableCollection<MyControl> Children{ get; protected set; } . To display the nested child controls I am using an ItemsControl ( StackPanel ) which is surrounded by a GroupBox . If there are no child controls, I want to hide the GroupBox . Everything works fine on application startup: The group box and child controls are shown if the

How to apply CueBanner for a TextBox in xaml

核能气质少年 提交于 2019-12-11 05:46:58
问题 I want to have a TextBox with CueBanner but it still does not work. What have I made wrong? I think the problem is that I am using {RelativeSource TemplatedParent} in Resources. How can I do that without putting in Resources? My xaml code: <Style TargetType="{x:Type TextBox}"> <Setter Property="SnapsToDevicePixels" Value="True" /> <Setter Property="OverridesDefaultStyle" Value="True" /> <Setter Property="KeyboardNavigation.TabNavigation" Value="None" /> <Setter Property="FocusVisualStyle"

WPF - Is there a way to target an element type in a ControlTemplate's trigger?

╄→гoц情女王★ 提交于 2019-12-11 03:39:21
问题 I have the following ControlTemplate defined: <ControlTemplate x:Key="buttonTemplate" TargetType="{x:Type Button}"> <Border x:Name="buttonBorder"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> <TextBlock x:Name="txtLabel" Grid.Column="0"> <ContentPresenter/> </TextBlock> <Canvas x:Name="reschedule" Grid.Column="1"> <Path x:Name="path1" ... /> <Path x:Name="path2" ... /> <Path x:Name="path3" ... /> <Path x:Name=

Wpf: Apply custom style of ToolTip at multiple controls

不想你离开。 提交于 2019-12-11 03:24:56
问题 I am working with WPF application. I have created a custom control library where I have customized all controls, meaning added some functionality and restyled them. Same way I have restyled the ToolTip as well. I am using this custom library in other projects. Everything is working fine except ToolTip. ToolTip style is not getting applied. Any Help plz. Edit: I have created a custom class named ToolTip that derives from System.Windows.Controls.ToolTip, I have declared style for my custom

Validation Tooltip on TextBox becomes orphaned when changing tabs

核能气质少年 提交于 2019-12-11 02:53:48
问题 I have a TextBox on a TabItem inside of a TabControl. Using INotifyDataError changed based validation, when there is an error in the TextBox and you focus on the TextBox a validation tooltip displays. If I navigate to a different tab, the Tooltip stays where it was even though I am on the new tab. Essentially creating an orphaned ToolTip. When I go back to the original tab with my textbox that has the validation error, I can create as many new orphaned validation tooltips by focusing on the

ListBox Selected Item Style for Windows Phone 8.1

不问归期 提交于 2019-12-11 00:41:01
问题 I have a simple listbox and I would like to change the Style so that when an item is selected, the border of the item changes colour. Currently my ListBox and style is defined as: <ListBox x:Name="DaysList" HorizontalContentAlignment="Stretch" Background="Transparent" Height="300" Grid.Row="1" > <ListBox.ItemContainerStyle> <Style TargetType="ListBoxItem"> <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter> <Setter Property="FontSize" Value="30" /> <Setter Property=

What's wrong with my datatrigger binding?

北城余情 提交于 2019-12-10 23:23:10
问题 I have created an attached property to extend a Button class with additional state: <Button v:ExtensionHelper.OperationMode="{Binding MyObject.OperationMode}" Command="{Binding MyObject.Select}" Style="{StaticResource operationModeControlTemplateStyle}" /> Then I want to access this value in the ControlTemplate using DataTrigger like this: <Style x:Key="operationModeControlTemplateStyle" TargetType="Button"> <Setter Property="IsHitTestVisible" Value="true" /> <Setter Property="Template">

WP7 Mango: Retemplating PhoneApplicationFrame created “Unspecified Error” exception

时光总嘲笑我的痴心妄想 提交于 2019-12-10 17:50:50
问题 The following used to work in WP 7.0: I'm attempting to re-template the root PhoneApplicationFrame in my Mango beta 2 refresh (7712) project with the following Xaml: <Style TargetType="phone:PhoneApplicationFrame" x:Key="FrameStyle"> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <Border x:Name="ClientArea" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}" Background="{TemplateBinding Background}" BorderBrush="

Prefix 'xcdg' does not map to a namespace

自古美人都是妖i 提交于 2019-12-10 17:17:57
问题 I recently started playing with DataGridControl from Extended WPF Toolkit <Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResource SampleDataSource}}"> <xcdg:DataGridControl ItemsSource="{Binding Orders}" SelectionMode="Single" > <xcdg:DataGridControl.View> <xcdg:TableflowView FixedColumnCount="1" UseDefaultHeadersFooters="True" ShowRowSelectorPane="False" VerticalGridLineBrush="Green" VerticalGridLineThickness="2" HorizontalGridLineBrush="Purple" HorizontalGridLineThickness="2"

Styling DataGridCell correctly

自闭症网瘾萝莉.ら 提交于 2019-12-10 16:58:12
问题 This is a question following my previous problem, you can find it right there So. Now I defined a DataGrid with a specific ElementStyle for each column (which just defines the TextBlock s inside in bold & white -- will come over this problem later) So now I have two questions First question (solved) When I happen to set a background to my cell, it overrides the default style, and the background stays the same when the cell is highlighted. One example of a style: <!-- Green template for market