contentcontrol

Different Datacontext for Command and CommandParameter

爱⌒轻易说出口 提交于 2019-12-11 03:09:30
问题 Is it possible to have a different Datacontext for a WPF Command and a CommandParameter ? <UserControl> <UserControl.Resources> <viewmodels:ListViewGridBaseViewModel x:Key="vm" /> </UserControl.Resources> <Grid> <ContentControl x:Name="currentContent" Content="{Binding Path=ListGrid}" > <ContentControl.ContextMenu> <ContextMenu > <MenuItem Command="{Binding Path=Save}" CommandParameter="{Binding ElementName=currentContent}" DataContext="{StaticResource ResourceKey=vm}" Header="Save">

How can I find a style trigger-embedded element by name in WPF?

依然范特西╮ 提交于 2019-12-11 03:04:34
问题 First, the heart of the question: If an element is assigned as the Content of a ContentControl via a style trigger, I can't seem to find it by name. Now, for more detail: I have a panel that varies greatly in its layout and functionality based on its data context, which is a bug from a bug depot. When that bug is null, it is a search form, when it is non-null, it is a simple viewer for properties of that bug. The XAML then look something like: <ContentControl DataContext="...">

WPF ContentControl Styling

痴心易碎 提交于 2019-12-11 01:05:54
问题 How can I apply a style to the content of a contentcontrol. For example: <Window.Resources> <Controls:DataGrid x:Key="PersonDataGrid" AutoGenerateColumns="False" ItemsSource="{Binding .}" x:Shared="False"> <Controls:DataGrid.Columns> <Controls:DataGridTextColumn Header="First Name" Binding="{Binding Path=FirstName}" IsReadOnly="True"/> <Controls:DataGridTextColumn Header="Last Name" Binding="{Binding Path=LastName}" IsReadOnly="True"/> </Controls:DataGrid.Columns> </Controls:DataGrid> <

Loading Views into ContentControl and changing their properties by clicking buttons

爷,独闯天下 提交于 2019-12-11 00:21:33
问题 I have a mvvm(model view viewmodel) silverlight application that has several views that need to be loaded into ContentControls (i made it all in expression blend). What i dont know how to do is, for example, to load one view (user control) in one content control by clicking a button from another view that is in another content control. To make it easier to understand the problem, i need to do something similar to this: http://www.codeproject.com/KB/silverlight/BlendableVMCom.aspx with that

Get ContentControl Control's Template Children?

落花浮王杯 提交于 2019-12-10 17:26:15
问题 We're working on a Silverlight application that uses a generic custom ContentControl. This ContentControl has a Control Template specified in a Generic.xaml. The inherited ContentControl's Template... <Style TargetType="local:ExtContentControl"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="local:ExtContentControl"> <Border x:Name="content" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding

Why would I want IsTabStop set to true on a ContentControl?

雨燕双飞 提交于 2019-12-10 14:52:11
问题 Given the following: setting IsTabStop to false on a ContentControl will not prevent its content from acting as a tab-stop setting IsTabStop to true will result in an invisible tab-stop, which does nothing, in your application I have the following two questions: Why is IsTabStop true by default for the ContentControl Why would I ever want the ControlControl to act as a tab-stop? 回答1: Douglas is correct ContentControl simply inherits the default value of IsTabStop from Control . Also there is

multiple binding to IsEnable

大憨熊 提交于 2019-12-09 15:50:35
问题 I need to bind a TextBox that meets two criteria: IsEnabled if Text.Length > 0 IsEnabled if user.IsEnabled Where user.IsEnabled is pulled from a data source. I was wondering if anyone had a easy method for doing this. Here is the XAML: <ContentControl IsEnabled="{Binding Path=Enabled, Source={StaticResource UserInfo}}"> <TextBox DataContext="{DynamicResource UserInfo}" Text="{Binding FirstName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding Path=Text, RelativeSource=

Using a resource and DataTemplateSelector from a different assembly

微笑、不失礼 提交于 2019-12-08 13:05:43
问题 I have a control in a base assembly with Content that I would like to set based on the current DataContext. To do so, I am trying to use a resource and subclassed DataTemplateSelector in the calling assembly as shown below. My initial hope was that the sub classed DataTemplateSelector would be called, but it isn't. Then I tried adding an entry in the Resource Dictionary of the calling assembly with the same key but the sub classed selector, but that doesn't get it done either. Is there a way

WPF - Border template with content

强颜欢笑 提交于 2019-12-05 20:08:29
Let's assume I have the following control template: <ControlTemplate x:Key="Test"> <Grid> <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" Width="33" Height="33" CornerRadius="3"/> <ContentControl Content="{TemplateBinding Property=ContentControl.Content}" VerticalAlignment="Center" HorizontalAlignment="Center"/> </Grid> </ControlTemplate> How can I change content of the control in wpf? I've tried something like <Control Template="{StaticResource Test}" BorderBrush="Black" Content="aa"></Control> But when I do so I it says me that the property content is not recognized

ContentControl + RenderTargetBitmap + empty image

倖福魔咒の 提交于 2019-12-04 11:43:30
问题 Im trying to create some chart images without ever displaying those charts on the screen. I'v been at this for quite a while and tried a lot of different things but nothing seems to work. The code works perfectly if I display the chart in a window first, but if I don't display it in a window, the bitmap is just white with a black border (no idea why). I have tried adding the chart to a border before rendering and giving the border a green borderBrush. In the bitmap, I see the green