-
-
Save ritalin/2202873 to your computer and use it in GitHub Desktop.
For metro style app, unable to use attachable property defined by other assembly.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
<Page | |
x:Class="APTest.App.BlankPage" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:local="using:APTest.App" | |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
mc:Ignorable="d" | |
xmlns:fw="clr-namespace:AP.Framework;assembly=AP.Framework" | |
> | |
--> | |
<Page | |
x:Class="APTest.App.BlankPage" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:local="using:APTest.App" | |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
mc:Ignorable="d" | |
xmlns:fw="using:AP.Framework" | |
> | |
<Grid Background="{StaticResource ApplicationPageBackgroundBrush}" x:Name="ContentRoot"> | |
<Button x:Name="btn1" Content="ABC" fw:TestBehaviour.Num="200" /> | |
</Grid> | |
</Page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Windows.UI.Xaml; | |
namespace AP.Framework { | |
public static class TestBehaviour { | |
public static readonly DependencyProperty NumProperty = DependencyProperty.RegisterAttached( | |
"Num", | |
typeof(int), | |
typeof(TestBehaviour), | |
new PropertyMetadata(100) | |
); | |
public static int GetNum(UIElement d) { | |
return (int)d.GetValue(NumProperty); | |
} | |
public static void SetNum(UIElement d, int value) { | |
d.SetValue(NumProperty, value); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
modified declalation of external assembly namespace