xaml

Trigger based on text property not working

ぐ巨炮叔叔 提交于 2021-02-11 05:16:51
问题 Here is the xaml that I am working on: <TextBlock Text="{Binding Title}" Margin="10,0,0,0" VerticalAlignment="Center"> <TextBlock.Resources> <Style TargetType="{x:Type TextBlock}"> <Style.Triggers> <Trigger Property="Text" Value=""> <Setter Property="Margin" Value="0" /> </Trigger> </Style.Triggers> </Style> </TextBlock.Resources> </TextBlock> When text = "" I want to clear up the margin. But somehow it does not work. 回答1: You must move Margin="10,0,0,0" from TextBlock to setter of Style :

Trigger based on text property not working

江枫思渺然 提交于 2021-02-11 05:08:21
问题 Here is the xaml that I am working on: <TextBlock Text="{Binding Title}" Margin="10,0,0,0" VerticalAlignment="Center"> <TextBlock.Resources> <Style TargetType="{x:Type TextBlock}"> <Style.Triggers> <Trigger Property="Text" Value=""> <Setter Property="Margin" Value="0" /> </Trigger> </Style.Triggers> </Style> </TextBlock.Resources> </TextBlock> When text = "" I want to clear up the margin. But somehow it does not work. 回答1: You must move Margin="10,0,0,0" from TextBlock to setter of Style :

Trigger based on text property not working

好久不见. 提交于 2021-02-11 05:04:43
问题 Here is the xaml that I am working on: <TextBlock Text="{Binding Title}" Margin="10,0,0,0" VerticalAlignment="Center"> <TextBlock.Resources> <Style TargetType="{x:Type TextBlock}"> <Style.Triggers> <Trigger Property="Text" Value=""> <Setter Property="Margin" Value="0" /> </Trigger> </Style.Triggers> </Style> </TextBlock.Resources> </TextBlock> When text = "" I want to clear up the margin. But somehow it does not work. 回答1: You must move Margin="10,0,0,0" from TextBlock to setter of Style :

Xamarin forms Shell Custom icon for selected tab

末鹿安然 提交于 2021-02-10 20:36:33
问题 I'm playing with the COOL xamarin shell, but I didn't found a way to change icon of the selected tab. <TabBar Route="sections"> <Tab Title="home"> <Tab.Icon> <FontImageSource FontFamily="{StaticResource AppIcons}" Glyph="{x:Static framework:Icons.HomePage}" /> </Tab.Icon> <ShellContent ContentTemplate="{DataTemplate home:HomePage}" Route="home" /> </Tab> The goal is to use Icons.HomePageFilled instead of Icons.HomePage for this tab only when it's selected. Same logic should apply to other

Xamarin.Forms can you make type related datatemplates?

随声附和 提交于 2021-02-10 19:52:31
问题 In WPF you can create a DataTemplate, put it in a ResourceDictionary, assign it a Type and then bind data of that type to a ContentControl and the DataTemplate will be used to render. as in this example: How do I use the DataType property on a WPF DataTemplate? the Xamarin.Forms enterprise apps ebook hints at such an ability but does not show any example: https://developer.xamarin.com/guides/xamarin-forms/enterprise-application-patterns/mvvm/#Creating_a_View_Defined_as_a_Data_Template Can

INotifyPropertyChange confusion

烈酒焚心 提交于 2021-02-10 19:38:21
问题 I am converting a VB.NET Winforms project to C# WPF. I have a project with two WPF windows and a ViewModel as a referenced project. public class SheepViewModel : INotifyPropertyChanged { private string _CurrentEventName; public string CurrentEventName { get { return _CurrentEventName; } set { _CurrentEventName = value; OnPropertyChanged("CurrentEventName"); } } static SheepViewModel _details; public static SheepViewModel GetDetails() { if (_details == null) _details = new SheepViewModel();

Xamarin.form using embedded images

拥有回忆 提交于 2021-02-10 18:35:36
问题 I want to use embedded images in my portable code. I am using a markup extension as many different videos and guides have shown. My project compiles and runs but no image is displayed. These guides say to put the images under "references" but I am unable to drag an image there or right click and add one in so they are in a folder called Images. If the problem is that they aren't under references then how do I get them there? Otherwise if anyone can spot the error that would be much

MouseMove performance slow using GetPosition

孤人 提交于 2021-02-10 18:11:03
问题 I have a Canvas control with various elements on, in this particular function I am allowing a user to drag the end point of a line around the canvas. In the MouseMove function I call e.GetPosition() . The function is, according to the VS performance analyzer, close to 30% of total CPU for the app when constantly moving around. Its pretty slow. What can I do to increase this performance? CurrentPoint = e.GetPosition(PointsCanvas); 回答1: I've faced the same problem while using MouseMove on

Why tap gesture recognizer wont work in absolute layout?

南笙酒味 提交于 2021-02-10 16:29:00
问题 Developing a project on Android with Xamarin.Forms.I am trying to create a page with six image buttons to navigate the user through the app. Vertically half page, 3 on right side 3 on the left side. No scroll no other things. When I use absolute layout, only images in the bottom of the screen is working. Other imagebuttons didn't work. If I put only 2 images they work. They were in a grid. I deleted grid to try and nothing is changed. <AbsoluteLayout BackgroundColor="Black" AbsoluteLayout

How to force a Windows 10 uwp webview app to load a url after suspend / resuming & auto reload when timing out

柔情痞子 提交于 2021-02-10 16:18:43
问题 This (simplified) c# / XAML UWP Webview app displays a blank page after the app is resumed after about 90+ sec. when displaying a local security cam video stream webpage. It appears to timeout after about 90 sec while the app is being suspended and then upon resuming the webview page is blank. To give the sample code below something to display, I randomly picked a site from a web search and landed on http://www.porttampawebcam.com/. The few youtube and webcam pages I've tried didn't reproduce