Created
April 2, 2013 08:38
-
-
Save kiichi54321/5290813 to your computer and use it in GitHub Desktop.
XAMLでクロス表っぽいものを作る
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
<ScrollViewer Grid.Row="1" Name="scrollViewer1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> | |
<ContentControl Name="ClusterTable"> | |
<StackPanel > | |
<StackPanel Orientation="Horizontal"> | |
<Border Width="50"></Border> | |
<ItemsControl ItemsSource="{Binding Categories}"> | |
<ItemsControl.ItemsPanel> | |
<ItemsPanelTemplate> | |
<StackPanel Orientation="Horizontal"></StackPanel> | |
</ItemsPanelTemplate> | |
</ItemsControl.ItemsPanel> | |
<ItemsControl.ItemTemplate> | |
<DataTemplate> | |
<Border Width="180" Padding="2"> | |
<TextBlock Text="{Binding Name}" ></TextBlock> | |
</Border> | |
</DataTemplate> | |
</ItemsControl.ItemTemplate> | |
</ItemsControl> | |
</StackPanel> | |
<ItemsControl ItemsSource="{Binding LayerGroup}"> | |
<ItemsControl.ItemsPanel> | |
<ItemsPanelTemplate> | |
<StackPanel></StackPanel> | |
</ItemsPanelTemplate> | |
</ItemsControl.ItemsPanel> | |
<ItemsControl.ItemTemplate> | |
<DataTemplate> | |
<StackPanel Orientation="Horizontal"> | |
<Border> | |
<TextBlock Width="50" Text="{Binding Name}"></TextBlock> | |
</Border> | |
<ItemsControl ItemsSource="{Binding Items}"> | |
<ItemsControl.ItemsPanel> | |
<ItemsPanelTemplate> | |
<StackPanel Orientation="Horizontal"></StackPanel> | |
</ItemsPanelTemplate> | |
</ItemsControl.ItemsPanel> | |
<ItemsControl.ItemTemplate> | |
<DataTemplate> | |
<Border Width="180" BorderBrush="Black" BorderThickness="1" Padding="2"> | |
<ItemsControl ItemsSource="{Binding Comunities}"> | |
<ItemsControl.ItemsPanel> | |
<ItemsPanelTemplate> | |
<StackPanel ></StackPanel> | |
</ItemsPanelTemplate> | |
</ItemsControl.ItemsPanel> | |
<ItemsControl.ItemTemplate> | |
<DataTemplate> | |
<Border Background="{Binding Brush}" > | |
<TextBlock Text="{Binding Name}" Tag="{Binding}" MouseLeftButtonDown="TextBlock_MouseLeftButtonDown"></TextBlock> | |
</Border> | |
</DataTemplate> | |
</ItemsControl.ItemTemplate> | |
</ItemsControl> | |
</Border> | |
</DataTemplate> | |
</ItemsControl.ItemTemplate> | |
</ItemsControl> | |
</StackPanel> | |
</DataTemplate> | |
</ItemsControl.ItemTemplate> | |
</ItemsControl> | |
</StackPanel> | |
</ContentControl> | |
</ScrollViewer> |
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
public class ClusterTable | |
{ | |
public List<Category> Categories { get; set; } | |
public List<LayerGroup> LayerGroup { get; set; } | |
} | |
public class Category | |
{ | |
public string Name { get; set; } | |
public string Tag { get; set; } | |
Dictionary<string, Layer> dic = new Dictionary<string, Layer>(); | |
public Dictionary<string, Layer> Layer | |
{ | |
get { return dic; } | |
set { dic = value; } | |
} | |
} | |
public class LayerGroup | |
{ | |
public string Name { get; set; } | |
public List<Layer> Items {get;set;} | |
} | |
public class Layer | |
{ | |
public Category Category { get; set; } | |
public string Name { get; set; } | |
public List<Comunity> Comunities | |
{ | |
get | |
{ | |
return comunities; | |
} | |
} | |
List<Comunity> comunities = new List<Comunity>(); | |
} | |
public class Comunity : INotifyPropertyChanged | |
{ | |
public string Name { get; set; } | |
public int Id { get; set; } | |
public string ImageUrl { get; set; } | |
public string Tag { get; set; } | |
public double Index { get; set; } | |
Brush brush = new SolidColorBrush(Colors.White); | |
Color color = Colors.White; | |
public Color Color | |
{ | |
get { return color; } | |
set { | |
color = value; | |
} | |
} | |
double opacity = 1; | |
public double Opacity | |
{ | |
get {return opacity; } | |
set | |
{ | |
if (opacity != value) | |
{ | |
opacity = value; | |
OnPropertyChanged("Brush"); | |
} | |
} | |
} | |
public Brush Brush | |
{ | |
get | |
{ | |
return brush; | |
} | |
set | |
{ | |
if (brush != value) | |
{ | |
brush = value; | |
OnPropertyChanged("Brush"); | |
} | |
} | |
} | |
#region INotifyPropertyChanged メンバー | |
public event PropertyChangedEventHandler PropertyChanged; | |
protected void OnPropertyChanged(string propertyName) | |
{ | |
if (PropertyChanged != null) | |
{ | |
PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); | |
} | |
} | |
#endregion | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment