contentpresenter

Xamarin forms contentpresenter goes in wrong row and empty on phone

五迷三道 提交于 2019-12-13 18:01:23
问题 I'm having a go at Xamarin Forms trying to create my custom 'GroupBox' control which is a just a grid with two rows. The first row should just show a box with a header . The header has a background rectangle with a label. The second row shows the content via ContentPresenter the content goes below in the second row. I believe I've done the XAML correctly, this is how I'd do it in WPF , it shows in the GroupBox.xaml Forms Previewer fine, but when I add it into the main page, the content of the

How do you navigate a complex Visual Tree in order to re-bind an existing element?

时光毁灭记忆、已成空白 提交于 2019-12-11 11:08:32
问题 In the above image, child is a ContentPresenter. Its Content is a ViewModel. However, its ContentTemplate is null. In my XAML, I have a TabControl with the following structure: <local:SuperTabControlEx DataContext="{Binding WorkSpaceListViewModel}" x:Name="superTabControl1" CloseButtonVisibility="Visible" TabStyle="OneNote2007" ClipToBounds="False" ContentInnerBorderBrush="Red" FontSize="24" > <local:SuperTabControlEx.ItemsSource> <Binding Path="WorkSpaceViewModels" /> </local

How can I make a Button with multiple content values?

依然范特西╮ 提交于 2019-12-11 07:49:09
问题 My goal is to make a Button that has two Content values. Imagine a Scrabble tile as a button: it has the large letter in the center and a small number in the lower right. This is the effect I am going for. I made a button that has two ContentPresenter objects in it, and I have given each of the ContentPresenters a different style. However, I have not found a way to give each of the presenters a separate value (ie, if I set the Content of the button to "X" then both ContentPresenters show "X",

WPF button focus style being overriden when placed in content presenter

十年热恋 提交于 2019-12-11 04:15:55
问题 The Setup I have the following style that I apply to most of the windows in my application: <ResourceDictionary x:Class="MyNamespace.ChromeWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Style x:Key="CustomChromeTest" TargetType="{x:Type Window}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Window}"> <Grid x:Name="GridMain" Background="{StaticResource MainFormColor}">

WPF: ContentPresenter changing Foreground unexpectedly depending on where styles are located

梦想与她 提交于 2019-12-10 20:58:29
问题 I'm having an issue with the ContentPresenter behaving unexpectedly based on whether the styles are located in the Window. Resources or in a ResourceDictionary. Specifically, I'm setting the Foreground of the default TextBlock to Black, then setting the Foreground value in my default button style to White. If the styles exists on the page like this, they work fine: <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

How do I load a UserControl into a ContentPresenter within a (WPF) Window?

别等时光非礼了梦想. 提交于 2019-12-09 02:43:29
I have a window that contains a Viewbox. In that Viewbox, I would like to have one of several views which I have already created as UserControls. I am using the MVVM (Model View View-Model) design pattern. I have searched for about an hour online, and I cannot find any examples or tutorials that explain how to display a UserControl using a ContentPresenter . Depends. I think your main issue is that a ContentPresenter is only used within a control template. You can't just stick it in a Window and expect it to show the content of the window. I believe what you really need to do is to use a

How do I load a UserControl into a ContentPresenter within a (WPF) Window?

99封情书 提交于 2019-12-08 04:56:53
问题 I have a window that contains a Viewbox. In that Viewbox, I would like to have one of several views which I have already created as UserControls. I am using the MVVM (Model View View-Model) design pattern. I have searched for about an hour online, and I cannot find any examples or tutorials that explain how to display a UserControl using a ContentPresenter . 回答1: Depends. I think your main issue is that a ContentPresenter is only used within a control template. You can't just stick it in a

Does anyone have a simple example of a UserControl with a single ContentPresenter?

耗尽温柔 提交于 2019-12-07 04:07:14
问题 So far, I have this: <UserControl x:Class="MyConcept.ExpanderPanel" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Grid> <Border Style="{StaticResource Border_PanelStyle}" CornerRadius="3" /> <ContentPresenter /> </Grid> </UserControl> Sample usage of this UserControl: <nc:ExpanderPanel Grid.Row="0"> <Expander IsExpanded="True" Header="NMT Users"> <StackPanel> ... </StackPanel> </Expander> </nc:ExpanderPanel>

How to bundle View, ViewModel and DataTemplate in a WPF application for easy reuse?

时间秒杀一切 提交于 2019-12-06 03:19:54
问题 Situation: I'd like to create a flexible application which is ViewModel driven. The basic flow is like this: Design the main ViewModel Create a UserControl as View and a DataTemplate for the main ViewModel to select this View If there are sub components, the are modelled by sub ViewModels Create a UserControl as View and a DataTemplate for the sub ViewModel to select this View If a sub view model needs to be presented, it is done via a DataTemplate. This approach can also be seen here (option

ContentPresenter Visibility binding inside Grid not working?

≡放荡痞女 提交于 2019-12-05 12:49:38
I have a following grid: <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> ... <ContentPresenter Grid.Row="1" Content="{Binding Path=PredictiveWorkspace}" Visibility="{Binding Path=ShowPredictiveWorkspace, Converter={StaticResource boolToVisibility}}"/> <ContentPresenter Grid.Row="1" Content="{Binding Path=M2Workspace}" Visibility="{Binding Path=ShowStandardWorkspace, Converter={StaticResource boolToVisibility}}"/> ... </Grid> Those two ContentPresenters has the same Grid.Row definded because only one