controltemplate

UserControl within a ControlTemplate

☆樱花仙子☆ 提交于 2020-01-02 06:46:22
问题 I have a ControlTemplate for a Telerik Tile and I am overriding like below: <ControlTemplate TargetType="{x:Type ctrl:Tile}"> <Border> <local:UserControl> <ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/> </local:UserControl> </Border> </ControlTemplate> My user control looks like: <DockPanel> <!-- some content --> <ContentPresenter/> </DockPanel> The ControlTemplate does not display the content of the UserControl. If I change my

WPF Memory leak with derived TextBoxes

早过忘川 提交于 2020-01-02 05:32:11
问题 In one of the apps of mine I have a performance problem I can’t resolve: The app is built with input controls derived from the TextBox -class, having their own ControlTemplate in Themes\Generic.xaml . My problem is, that these controls will not be released after they are no more used. If I look at them with SciTech MemoryProfiler, I see that they are hold by an instance of System.Windows.Documents.TextEditor and the TextEditor -instance is hold through the finalizer queue. Memory profiler

WPF custom validator with tooltip

那年仲夏 提交于 2020-01-01 10:14:14
问题 I'd like to create a custom validator template for my WPF app. I have a tooltip template: <ControlTemplate x:Key="ToolTipTemplate" TargetType="ToolTip"> <Grid Opacity="0.93" MaxWidth="200"> <Border BorderBrush="Black" BorderThickness="1,1,1,1" CornerRadius="2"> <Border.Background> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#FFF5FAFE" Offset="0"/> <GradientStop Color="#FFE5EFF9" Offset="1"/> </LinearGradientBrush> </Border.Background> <Border.Effect>

Include a Button in a TextBox

不想你离开。 提交于 2020-01-01 03:19:08
问题 I want to add a little Button , which removes all the text in the TextBox . Is it possible to put this "Remove"-Button into the TextBox (like in the iPhone Textboxs )? I hope after your help it looks like that: I played something with the controltemplate but didn't get the wished result. One way to solve this problem could be to use negative margins of the button, but i think that isn't a clean solution. Thank you! 回答1: You can easily derive from textbox and create your own textbox with the

Code generation: Custom controller templates

旧时模样 提交于 2019-12-30 06:14:09
问题 To start off, I'm using Asp.Net MVC 4, and I've modified my solution to contain the CodeTemplates folder by following this tutorial. (I think my issue might be MVC related?) I've replaced the code in the Ajax grid template with a with my own JQgrid-template, which was fine for getting my project started. But I'm having trouble creating completely new controller templates (well the having them show up in the create new controller menu) any ideas? Update I've taken a few stabs at using the

Creating a ControlTemplate for a DataGridRow in WPF

折月煮酒 提交于 2019-12-30 04:41:26
问题 What I am trying to accomplish is customize the DataGrid control so that each row has rounded corners, no gridlines (just the design I'm working with). What I have been trying to do is create a ControlTemplate that modifies the DataGridRow controls so that they have the expected appearance. So far, this is what I am working with: <DataGrid Grid.Row="0" Grid.Column="0" Margin="5,5,5,5" AutoGenerateColumns="False" ItemsSource="{Binding Path=MyData}"> <DataGrid.Resources> <Style x:Key="rowStyle"

Control Styles and Templates for Windows 8 Metro-UI

a 夏天 提交于 2019-12-29 07:11:32
问题 I've met some issue with the visual appearance of my C#/XAML Metro-UI application. I want to customize default template. For another type of applications, I can take default styles and controls from MSDN articles. For example: Control Styles and Templates for WPF Control Styles and Templates for Silverlight Where can I find something similar for Metro-UI default styles and templates? I know that is possible to extract template or style in Expression Blend. But I get the issue with my Blend

WPF: the style of control does not work unless the control template created for style

老子叫甜甜 提交于 2019-12-25 05:22:24
问题 It almost gets me mad in recent days. I have a textbox and the style in xaml file. But the style without a control template cannot take effect on textbox. Whereas, a control template works, but control template seems to overwrite the textbox totally, the default behaviors loses of textbox such as editing, inputing or selecting... Here is content of xaml with the control template: <Style TargetType="{x:Type TextBox}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <Border Name=

Access `DependencyProperty` via XAML and evaluate it?

▼魔方 西西 提交于 2019-12-25 04:18:10
问题 I just created a DependencyProperty for my custom button. The property is called IsChecked . If IsChecked == true my button shall change its background color to something else and keep this color until IsChecked == false . Here is my DependencyProperty : public static readonly DependencyProperty IsCheckedProperty = DependencyProperty.Register("IsChecked", typeof(bool), typeof(MainMenuButton), new PropertyMetadata(false)); public bool IsChecked { get { return (bool)GetValue(IsCheckedProperty);

how to dynamically change rectangle color in Expander?

Deadly 提交于 2019-12-25 03:26:18
问题 I have an Expander in which i have Rectangle with color. i want to change dynamically after some functionality. how to change it on run time ? <Windows.Resources> <ControlTemplate x:Key="SimpleExpanderButtonTemp" TargetType="{x:Type ToggleButton}"> <Border x:Name="ExpanderButtonBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" > <Grid> <Grid.ColumnDefinitions>