This is part of an UWP project for a multiple save/open dialog with GoogleDrive/OneDrive/DropBox features I'm creating based on my GOD library.
Try putting this to a cpp file:
std::wstring OpenFileX = LR"(<StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Orientation="Vertical">
<StackPanel Orientation="Vertical" x:Name="run" Visibility="Collapsed">
<ProgressRing x:Name="runProgress" IsActive="true" Margin="10" />
<ProgressBar x:Name="runBar" Value="0" Maximum="100" Margin="10"/>
<Button x:Name="runCancel" Margin="10">Cancel</Button>
</StackPanel>
<Pivot x:Name="pi">
<PivotItem Header="Local">
<StackPanel Orientation="Vertical" Margin="30">
<StackPanel Orientation="Horizontal">
<TextBox x:Name="localFile"
PlaceholderText="Filename"
Width="300" HorizontalAlignment="Left"/>
<Button x:Name="localPick" Margin="10,0,0,0" Width="50">...</Button>
</StackPanel>
<Button x:Name="localSave" Margin="0,20,0,0">Open</Button>
</StackPanel>
</PivotItem>
<PivotItem Header="Google Drive" x:Name="name_google">
<StackPanel Orientation="Vertical" Margin="30">
<ProgressRing x:Name="googleProgress" IsActive="true" />
<StackPanel Orientation="Horizontal" Visibility="Collapsed" x:Name="sp1">
<TextBox x:Name="googleFile"
PlaceholderText="Filename"
Width="300" HorizontalAlignment="Left"/>
<Button x:Name="googleSave" Margin="10,0,0,0" >Open</Button>
<Button x:Name="googleTop" Margin="10,0,0,0" >Top</Button>
</StackPanel>
<Grid Margin="0,20,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" x:Name="ColDef1" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" x:Name="RowDef1" />
</Grid.RowDefinitions>
<ListView Grid.Row="0" Grid.Column="0" CanDragItems="True" x:Name="googleList" SelectionMode="Extended" ScrollViewer.VerticalScrollBarVisibility="Visible" />
</Grid>
</StackPanel>
</PivotItem>
<PivotItem Header="OneDrive" x:Name="name_one">
<StackPanel Orientation="Vertical" Margin="30">
<ProgressRing x:Name="oneProgress" IsActive="true" />
<StackPanel Orientation="Horizontal" Visibility="Collapsed" x:Name="sp2">
<TextBox x:Name="oneFile"
PlaceholderText="Filename"
Width="300" HorizontalAlignment="Left"/>
<Button x:Name="oneSave" Margin="10,0,0,0" >Open</Button>
<Button x:Name="oneTop" Margin="10,0,0,0" >Top</Button>
</StackPanel>
<Grid Margin="0,20,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" x:Name="ColDef2" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" x:Name="RowDef2" />
</Grid.RowDefinitions>
<ListView Grid.Row="0" Grid.Column="0" CanDragItems="True" x:Name="oneList" SelectionMode="Extended" ScrollViewer.VerticalScrollBarVisibility="Visible" />
</Grid>
</StackPanel>
</PivotItem>
<PivotItem Header="DropBox" x:Name="name_db">
</PivotItem>
</Pivot>
</StackPanel>
)";
Then Vs is totally confused on the lines. Pressing F10 to start with WinMain shows code about 10 lines before WinMain.
Is this a known Visual Studio bug? Tried with VS 2019.
Related
I want to create a Template Selector in WinUI 3 using c++/WinRT.
For example, if the type of a person is "Employee" i want to show his name in Red and if is "Unemployee", in Blue.
I recreate the example from Microsoft but i got
this error
The code is here . All VisualStudio components are up to date.
XAML code:
<StackPanel>
<Page>
<Page.Resources>
<DataTemplate x:Key="template1" x:DataType="x:Int32">
<Button HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{ThemeResource SystemChromeLowColor}">
<TextBlock Text="{x:Bind}" />
</Button>
</DataTemplate>
<DataTemplate x:Key="template2" x:DataType="x:Int32">
<Button HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{ThemeResource SystemAccentColor}">
<TextBlock Text="{x:Bind}" />
</Button>
</DataTemplate>
<local:Selector x:Key="mySelector"
firstTemplate="{StaticResource template1}"
secondTemplate="{StaticResource template2}"/>
</Page.Resources>
</Page>
<ListView
ItemTemplateSelector = "{StaticResource mySelector}">
</ListView>
</StackPanel>
Thanks!
I have an UWP C++ app for getting some information which takes a long time to load .While startup,its taking time to get the information and update the UI.So I thought of putting a progress ring while the UI is getting data. I need the progress ring to show on the UI during the loading time in MainPage.xaml thereby making the existing controls invisible.But it is not coming on top of UI.After getting data to UI,progress ring should disappear and all the controls should be visible.
<Page
x:Class="Ft_Information.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Ft_Information"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" Loaded="MainWindow_Loaded" BorderThickness="10" IsTabStop="True">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid x:Name="ftnfoGrid" Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="25*" />
<RowDefinition Height="500*" />
<RowDefinition Height="100*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50*" />
<ColumnDefinition Width="500*" />
<ColumnDefinition Width="800*" />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" Grid.Row="1" Grid.Column="1">
<TextBox x:Name="ProductNameText" x:Uid="ProductName" TextWrapping="Wrap" BorderThickness="0" IsTabStop="False" FontSize="13" IsReadOnly="True" />
<StackPanel Grid.Row="2" RenderTransformOrigin="0.5,0.5" Grid.ColumnSpan="1" HorizontalAlignment="Stretch" Margin="55,5.333,0.333,-5" VerticalAlignment="Stretch">
<ProgressRing Name="ProgressRingLbl" Height="120" Width="109" HorizontalAlignment="Left"
Foreground="Blue" IsActive="True" Visibility="Visible" VerticalAlignment="Center" Margin="0,0,0,0"/>
</StackPanel>
</Grid>
</Grid>
</Page>
MainPage::MainPage()
{
ProductNameText->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
ProgressRingLbl->IsActive = true;
ProgressRingLbl->Visibility = Windows::UI::Xaml::Visibility::Visible;
}
MainPage::FuntouploadUI()
{
.............
//after getting data
ProgressRingLbl->IsActive = false;
ProgressRingLbl->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
ProductNameText->Visibility = Windows::UI::Xaml::Visibility::Visible;
}
Still the progress bar is not showing anywhere in the UI.
I write a simple demo below.You can use this code in your application to test if the progress ring can show in the UI.
<Page ...>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<StackPanel Background="AliceBlue">
<TextBlock x:Name="MyTextBlock" Height="50" FontSize="16" Margin="0,20,0,20">Hello,world</TextBlock>
<Button x:Name="MyButton" Click="Button_Click">click me</Button>
<ProgressRing x:Name="MyProgressRing" Height="120" Width="109" Foreground="Blue" IsActive="True" Visibility="Visible" HorizontalAlignment="Center" VerticalAlignment="Center"></ProgressRing>
</StackPanel>
</Grid>
</Page>
MainPage::MainPage()
{
InitializeComponent();
MyTextBlock->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
MyButton->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
MyProgressRing->IsActive = true;
MyProgressRing->Visibility = Windows::UI::Xaml::Visibility::Visible;
}
The reason why progress ring not working was we are using another view to show the mainpage.xaml as a child to its root grid.When I moved the progress ring part to that xaml ,it is working fine. Since progress ring is working as a seperate UI thread it is not called by the mainpage.
I am getting an error while using ReorderHandle in reorderMode="Drag" in RadListView component of nativescript-ui-listview/vue like
[Vue warn]: Unknown custom element: <ReorderHandle> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
How can I use ReorderHandle in Nativescript-vue according to this doc link?
Any help on this functionality will be appreciated.
Here are my codes
main.js
import Vue from 'nativescript-vue'
import RadListView from 'nativescript-ui-listview/vue';
Vue.use(RadListView);
My Vue Component
<RadListView ref="listView" for="(manager, index) in managers" :itemReorder="true" reorderMode="Drag">
<v-template>
<Label>{{ manager.name }}</Label>
<ReorderHandle col="1" verticalAlignment="center">
<Image android:src="res://reorder_icon" ios:src="res://reorder-icon" stretch="none" verticalAlignment="stretch" margin="16" />
</ReorderHandle>
</v-template>
</RadListView>
There is an Vue example of that.
Like you can see in the code you don't need to add <ReorderHandle>
Example:
<template>
<RadListView ref="listView"
for="item in items"
pullToRefresh="true"
itemReorder="true"
swipeActions="true"
#itemTap="onItemTap"
#pullToRefreshInitiated="onPullToRefreshInitiated"
#itemReordered="onItemReordered"
#itemSwipeProgressStarted="onSwipeStarted">
<v-template>
<GridLayout columns="50, *" rows="*" class="item">
<Image :src="item.image" col="0" class="thumbnail" />
<StackLayout col="1">
<label :text="item.name" class="h2" col="1"/>
<label :text="item.description" class="p" col="1"/>
</StackLayout>
</GridLayout>
</v-template>
<v-template name="itemswipe">
<GridLayout columns="auto, *, auto" backgroundColor="White">
<StackLayout id="mark-view" col="0" class="swipe-item left"
orientation="horizontal" #tap="onLeftSwipeClick">
<Label text="mark" verticalAlignment="center" horizontalAlignment="center"/>
</StackLayout>
<StackLayout id="delete-view" col="2" class="swipe-item right"
orientation="horizontal" #tap="onRightSwipeClick">
<Label text="delete" verticalAlignment="center" horizontalAlignment="center" />
</StackLayout>
</GridLayout>
</v-template>
</RadListView>
</template>
More details can be found here.
I'm developing UWP app and want to set 2 columns for GridView or ListView by code.
Code:
GridView ^gView = ref new GridView();
ListView ^lView = ref new ListView();
I can't find any code or documentation how to do it programmatically. Thanks.
Yes I want 2 columns for the Grid. For example first column is property, second - data. How to achieve it by code.
I could not understand why you want to do it programmatically. In general, customizing its DataTemplate on XAML page directly is easy. For example:
<GridView ItemsSource="{Binding xx}">
<GridView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding property}"></TextBlock>
<TextBlock Grid.Column="1" Text="{Binding data}"></TextBlock>
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
If you have to specify the DataTemplate programmatically, you could do like the following:
<Page.Resources>
<DataTemplate x:Key="datatemplate">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding property}"></TextBlock>
<TextBlock Grid.Column="1" Text="{Binding data}"></TextBlock>
</Grid>
</DataTemplate>
</Page.Resources>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<GridView x:Name="gd" ItemsSource="{Binding}">
</GridView>
</Grid>
public MainPage()
{
this.InitializeComponent();
gd.ItemTemplate = this.Resources["datatemplate"] as DataTemplate;
}
It's C# code, you would need to convert it to C++.
I'm having trouble selecting the correct template to manage the content of an expander control.
I'd like the content of an expander -- regardless of the type of control that is the content -- to be indented.
For example, an expander might have an expander as content, then the child expander might have a listbox, or a collection of textblocks.
Any help would be appreciated....
UPDATE:
Experimenting with a DataTemplate like this:
<DataTemplate x:Key="DataTemplate1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ContentPresenter Grid.Row="1" /> <!-- With this in place, content doesn't show at all -->
</Grid>
</DataTemplate>
And using it like this:
<controls2:Expander Header="Two" ContentTemplate="{StaticResource DataTemplate1}">
So far, any attempts to deal with the content crashes the app when the Expander is expanded.
I Think This Code Should Help You
<toolkit:Accordion x:Name="SearchAcco" Grid.Row="0" Margin="3" ExpandDirection="Down" HorizontalAlignment="Stretch" SelectionMode="ZeroOrOne">
<toolkit:AccordionItem Header="Advance Search" Style="{StaticResource AccordianPanalStyle}" HorizontalContentAlignment="Left">
<--Add Content Here-->
</toolkit:AccordionItem>
</toolkit:Accordion>