我需要从导航堆栈中删除选择性页面(winRT-C#)
我检查了:
但无法弄清楚如何操纵导航堆栈.是否可以操纵此导航堆栈?
我有一个带有依赖项属性的usercontrol.
public sealed partial class PenMenu : UserControl, INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
public bool ExpandCollapse
{
get
{
return false;
}
set
{
//code
}
}
public static readonly DependencyProperty ExpandCollapseProperty = DependencyProperty.Register("ExpandCollapse", typeof(bool), typeof(PenMenu), null);
//some more code
}
Run Code Online (Sandbox Code Playgroud)
我在XAML页面中赋值为:
<Controls:PenMenu x:Name="penMenu" Opened="Menu_Opened"
ExpandCollapse="{Binding PenMenuVisible}" />
Run Code Online (Sandbox Code Playgroud)
但它没有在usercontrol中击中ExpandCollapse属性的GET-SET部分.所以我添加bool到bool转换器只是为了检查带有绑定的值是什么:
<Controls:PenMenu x:Name="penMenu" Opened="Menu_Opened"
ExpandCollapse="{Binding PenMenuVisible, Converter={StaticResource booleanToBooleanConverter}}" />
Run Code Online (Sandbox Code Playgroud)
在转换器中使用断点,我看到传递的值是正确的.它没有分配给依赖属性的可能原因是什么?
如果我说:在XAML页面中:
<Controls:PenMenu x:Name="penMenu" Opened="Menu_Opened"
ExpandCollapse="true"/>
Run Code Online (Sandbox Code Playgroud)
然后它命中usercontrol中的ExpandCollapse属性的GET-SET部分.我被卡住了.这很奇怪.请帮忙.
c# dependency-properties winrt-xaml windows-store-apps windows-8.1
我需要在网格的第二行添加一个矩形.我需要矩形的宽度与网格的宽度相同.
但问题是,网格的宽度是在运行时决定的.如果我尝试访问Width或ActualWidth在后面的代码,我得到NaN或0.0分别.
ColumnSpan并且Stretch也没有工作.这是代码:
<Grid x:Name="downloadPdfGrid">
<Grid.RowDefinitions>
<RowDefinition Height="20"/>
<RowDefinition Height ="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button x:Name="btn" Content="{Binding Button}" Visibility="Collapsed" Click="OnButtonClick" Grid.Row="0"/>
<Rectangle x:Name="underlineRect" Stretch="UniformToFill" Height="2" Fill="White" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="1"/>
</Grid>
Run Code Online (Sandbox Code Playgroud) 我们可以使用用户定义的类型转换对象,就像我们对普通数据类型一样吗?比如说我们为int类型转换为:
int variable_one =(int)variable_name;
所以我们可以这样做:(复杂)object_name; 复杂是我为使用operator +重载添加复数而编写的类.
有可能以这种正常方式吗?或者在调用此声明之前我们是否需要编写一些函数?或者根本不可能像这样输入?
非常感谢:)问候,Ashish
c# ×3
winrt-xaml ×2
c++ ×1
casting ×1
java ×1
navigation ×1
windows-8 ×1
windows-8.1 ×1
xaml ×1