I have ItemsControl with DataTemplateSelector, with buttons like:
<DataTemplate x:Key="buttonTemplate">
<Button>
<Button.Content>
<Image Source="sample.png" Height="{Binding height}" Width="{Binding width}" Stretch="Fill" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Button.Content>
<Button.RenderTransform>
<RotateTransform Angle="{Binding angle}" />
</Button.RenderTransform>
</Button>
</DataTemplate>
I'm filling my ItemsControl with storedprocedure, so elements are from my ObservableCollection.
public class rObject
{
public int elementID { get; set; }
public string elementType { get; set; }
public string elementName { get; set; }
public Thickness thick { get; set; }
public int width { get; set; }
public int height { get; set; }
public int angle { get; set; }
}
Buttons have methods to move them (which change thick), resize, rotate etc. So for example there is button with properties:
1*) angle = 0, thick = 0,0,0,0, width = 50, height = 50, elemetID = 1 etc.
Now i move button little bit and resize, so thick would be for example 10,10,10 10 and height=width = 100.
What I'd like to do now is press save button, which will save new data to database. Problem is that, in my ObservableCollection my button still have properties like in 1*.
So is there any way to get element which is Button, not rObject from my ItemsControl?
Thanks in advance!