I have app with only one button in grid. If I launch mi app and my button has focus my code works pretty much fine except I can’t detect when space is pressed. If I don’t select button first, nothing happens. How can I get pressed key regardless which element on my form has focus? I will later have multiple pages and should be able to catch any pressed key regardless of which page I’m on. Here is my code: using System; using Windows.UI.Popups; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Input; namespace KeyUpEventApp { public sealed partial class MainPage : Page { public …

Member Avatar
+0 forum 0

Hello everyone, I need help with VisualState.StateTriggers. The message I’m getting in my xaml code is: The member “State Triggers” is not recognised or is not accessible. I have try to use Blend to generate xaml code for triggers but the small button for that doesn’t exists. My project is set to universal app. I’m using windows 10 with Visual Studio Community 2015. Anyone knows what could be a problem?

Member Avatar
Member Avatar
+0 forum 2

Hello Daniweb Community, I'm wanting to slice a square image into 9 pieces like below ![Image_Grid_Expected.png](/attachments/small/3/92037daf6101645e42f7718c3f4ccf65.png "align-center") the code I'm currently using is this Private Function CropBitmap(ByRef bmp As Bitmap, ByVal cropX As Integer, ByVal cropY As Integer, ByVal cropWidth As Integer, ByVal cropHeight As Integer) As Bitmap Dim rect As New Rectangle(cropX, cropY, cropWidth, cropHeight) Dim cropped As Bitmap = bmp.Clone(rect, bmp.PixelFormat) Return cropped End Function Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click PictureBox1.Image = CropBitmap(New Bitmap(PictureBox2.Image), 0, 0, 21, 21) PictureBox3.Image = CropBitmap(New Bitmap(PictureBox2.Image), 0, 21, 21, 22) PictureBox4.Image = CropBitmap(New Bitmap(PictureBox2.Image), 0, 43, 21, …

Member Avatar
Member Avatar
+0 forum 24

I have a silverlight app that uses TextBox XAML controls. In the c++ code-behind, IXRTextBoxPtr types are associated with these textboxes using "FindName" like this: FindName(L"ColNum3", &m_pColNum3); (where ColNum3 corresponds with the XAML CODE like this: ) Then, the code assigns the pointer like this: std::wstring wsTransfer; // gets the wstring from imput const WCHAR * wpszInput; wpszInput = wsTransfer.c_str(); m_pColNum3->SetText(wpszInput); but the display does not show the text data. What am I missing? What steps am I missing to have this text modification display on the screen?

Member Avatar
Member Avatar
+0 forum 2

Hi all, I have a problem i have binding validation in WPF, aplication, but now because some rules some textboxes get disambled, and the validation shows same way, is there a way to disamble the validation when they are disabled and turn on when enabled? Best Regards

Member Avatar
Member Avatar
+0 forum 1

![63e834471f9c1463ee1caed517a7fbf1](/attachments/small/1/63e834471f9c1463ee1caed517a7fbf1.jpg "align-right") I'm working on an a windows phone project where I need to support fully transparent backgrounds in my controls to overlay ontop of dynamic image. I want to use this "new item" path I created to show how many updates an item has. I attached an image showing the effect I'm trying to create. The number needs to be dynamic. I've trying combinding geometries, but I'm having trouble figuring out how to even get started converting both my xaml defined path and text into geometries, and then combinding them with a xor to create the exclusion. It seems …

Member Avatar
Member Avatar
+0 forum 1

Hi, I'm not sure if this is the correct section to post my question in, but since my problem refers to xaml scripting I guess so. I added a listview in my win store app from which the user can choose among several elements and click the one she wants to expand in another box. The problem is that when you click and therefore highlight an item, its name is kinda cut off showing part of the first letter and than the others (for example, if you see Æþelstan and click on it, it'll only show Eþelstan). I tried to …

Member Avatar
+0 forum 0

I do not see the Application.Resource in app.xaml file in a windows store app.What could be the reason please?

Member Avatar
+0 forum 0

I am using the BusyIndicator from the WPF Toolkit in my WPF application. I am trying to access the label (artistLabel) from the C# code behind. Unfortunately I cannot access the label if it is inside the busy indicator. I am sure that it's some kind of binding or scope issue. Any help would be appreciated. Thanks! <wpfx:BusyIndicator Name="BusyBar" IsBusy="True"> <wpfx:BusyIndicator.BusyContentTemplate> <DataTemplate> <StackPanel Margin="4"> <TextBlock Text="Adding music to library" FontWeight="Bold" HorizontalAlignment="Center" Padding="0,0,0,10"/> <Grid> <Grid.RowDefinitions> <RowDefinition/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <Label Content="Artist: " Grid.Column="0" Grid.Row="0"></Label> This line----> <Label Grid.Column="1" Grid.Row="0" Name="artistLabel" ></Label> </Grid> <StackPanel Margin="4"> <ProgressBar Value="80" Height="15"/> </StackPanel> <Grid> …

Member Avatar
Member Avatar
+0 forum 7

Hey guys, I am setting my viewmodel as datacontext in my xaml but I override it to my view to make few functions work however to achieve the visibility on some grids and I have a property in my VM can I override my datacontext back to my VM? If so how? I have a stackpanel that has datacontext overriden as my grid and within that stackpanel I need to change the datacontext for a button. Any help will be appreciated thanks

Member Avatar
Member Avatar
+0 forum 1

I have been looking into event handling with C# and Silverlight and I can't seem to grasp it. I'm simply trying to get this adding event handlers in managed code example to compile from [url]http://msdn.microsoft.com/en-us/library/cc189018(v=vs.95).aspx[/url] I keep getting the errors "The name 'TextBlock_MouseEnter' does not exist in the current context. & "The name 'TextBlock_MouseLeave' does not exist in the current context. Please help! Thanks in advance. [CODE]<UserControl x:Class="EventHandlingInSilverLight.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <Grid x:Name="Layoutroot" Loaded="LayoutRoot_Loaded"> <StackPanel> <TextBlock Name="textBlock1"> Put the mouse over this text</TextBlock> </StackPanel> </Grid> </UserControl> [/CODE] [CODE] using System; using System.Collections.Generic; using System.Linq; using System.Net; …

Member Avatar
Member Avatar
+0 forum 1

Hi, I´ve got following code for a office 2010 like tabcontrol in .NET 4.0 [CODE]<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ControlTemplate x:Key="OfficeTabControl" TargetType="{x:Type TabControl}"> <ControlTemplate.Resources> <Style TargetType="{x:Type TabItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type TabItem}"> <Grid SnapsToDevicePixels="True"> <VisualStateManager.VisualStateGroups> <VisualStateGroup Name="CommonStates"> <VisualState Name="MouseOver"> <Storyboard> <DoubleAnimation Storyboard.TargetName="hoverShape" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:.1"/> </Storyboard> </VisualState> <VisualState Name="Normal"> <Storyboard> <DoubleAnimation Storyboard.TargetName="hoverShape" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:.1"/> </Storyboard> </VisualState> </VisualStateGroup> <VisualStateGroup Name="SelectionStates"> <VisualState Name="Selected"> <Storyboard> <DoubleAnimation Storyboard.TargetName="buttonShape" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:.3"/> <DoubleAnimation Storyboard.TargetName="buttonBackgroundShape" Storyboard.TargetProperty="Opacity" To="1" Duration="0"/> <DoubleAnimation Storyboard.TargetName="hoverShape" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:.1"/> <ColorAnimation Storyboard.TargetName="buttonText" Storyboard.TargetProperty="(TextBlock.Foreground).(Color)" To="White" Duration="0:0:.1" /> </Storyboard> </VisualState> <VisualState Name="Unselected"> <Storyboard> <DoubleAnimation Storyboard.TargetName="buttonShape" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:.1"/> <DoubleAnimation Storyboard.TargetName="buttonBackgroundShape" Storyboard.TargetProperty="Opacity" To="0" Duration="0"/> <DoubleAnimation Storyboard.TargetName="hoverShape" …

Member Avatar
Member Avatar
+0 forum 1

Hi, Can anyone get the translation of this xaml code to c# code? In order words, I am trying to set listbox items to be displayed in the textblock encapsulated by stackpanel, datatemplate and within listbox.itemtemplate. I am trying to do this from the back end and not using databinding. Any help is appreciated. XAML [CODE] <ListBox Name="listBox2" Width="224" Height="268" Margin="0,0,0,5" IsSynchronizedWithCurrentItem="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Style="{StaticResource ListBoxStyle1}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Height="35" Background="#181818"> <TextBlock Background="Black" Margin="1" FontWeight="Bold" Padding="7" Height="33" Width="184" Foreground="#D0D0D0"> </TextBlock> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> [/CODE]

Member Avatar
+0 forum 0

Hi, I have a window (Window1) with a ListBox (list1) bound to an xml file and a button that calls another page (Page1). Page1 implements methods to append to or alter the xml file however the control list1 is not recognized on Page1. So far I have referenced Window1 in the xaml file of Page1 as such [CODE]xmlns:local="clr-namespace:RecipeApp"[/CODE] How can I get List on Window1 inherited by Page1? Thanks

Member Avatar
+0 forum 0

Hi I have two windows (Window1 and Window2) and want to set Window1 as the owner of Window2. Furthermore I want the controls on Window1 to be inherited by Window2. For instance I have a listbox list1 on Window1 and I want list1 to be in context even in Window2. Any ideas? Thanks

Member Avatar
Member Avatar
+0 forum 3

Hi all, I have a textblock that is bound to an xml document. This displays the innertext of an xml-node element and the width of the textblock is fixed at "auto". The issue is that of the display as the innertext may exceed the width of the textblock and therefore it doesn't implement a newline operation automatically. For instance the textblock is in a grid bound to a the xml document: [CODE] <TextBlock Text="{Binding XPath=instructions}" Width="auto"/> [/CODE] The xml document is as such: [CODE] <recipetype> <instructions>(1) You will need 2 eggs, 1 tbspn butter, margarine and all that good stuff. …

Member Avatar
+0 forum 0

Hi, I have a question regarding navigating to a listbox item in C#. I have written code which populates a listbox from an xml file in xaml (thus bound to it). However I want to navigate to the selected item in the listbox using code in c#. I can navigate through the xml document without issues but how do I call the specific item that is selected in the listbox? For example, the listbox has items populated from the xml at node 1 and node 2 respectively: "Coffee" {i.e node1}, "Cream" {i.e node2}. By selecting 'Coffee', how can I specify …

Member Avatar
Member Avatar
+0 forum 2

Hi, I have a listbox that is bound to a textblock as target and also has an xml file as source. My problem now is the correct syntax for inserting another listbox in between the listbox and the xml file. My code is shown below... <Window x:Class="newTestApp.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="auto" Width="auto"> <Window.Resources> <XmlDataProvider x:Key="Recipes" Source="Recipe2.xml" XPath="/recipe/recipeList" /> <!--binds xml and node recipeList to entire window--> </Window.Resources> <Grid> <DockPanel Name="LargeUI" Height="auto" Width="auto" LastChildFill="True"> <!--Main Dock--> <DockPanel Name="TopDock" DockPanel.Dock="Top" Height="30" Background="LightGray"><!--TopDock--></DockPanel> <DockPanel Name="BottomDock" DockPanel.Dock="Bottom" Height="100" Background="LightGray" ><!--BottomDock--></DockPanel> <DockPanel Name="RightDock" DockPanel.Dock="Right" Width="100"><!--RightDock--></DockPanel> <DockPanel Name="LeftLeftDock" DockPanel.Dock="Left"> <!--LeftLeftDock--> <StackPanel Height="auto" Visibility="Visible" Margin="5,5,5,5"> <ListBox x:Name="lbRecipe" …

Member Avatar
+0 forum 0

Hi all, I am new to XAML however I have an understanding of XML. I am trying to bind a button to an XML file such that when the button is clicked, it the xml element is displayed within a listbox. Then I want the listbox selected item to be displayed in a textblock. So far I have been able to bind the listbox to the xml file as source but I need some examples concerning the afore mentioned matter. Any help is appreciated. Thanks

Member Avatar
+0 forum 0

Hi all, I am attempting data binding in WPF. I have a class Recipe and another called RecipeService. There seems a problem with the RecipeService class in terms of compatibility with the Recipe class as when I add its type to the ObjectDataProvider in the XAML file, I get an error that RecipeList type is not found. Any suggestions? Furthermore, I am using Visual Studio.Net and the "Recipe" text in "public List<Recipe> GetRecipeList()" should be highlighted to Blue if accurate, however it is not. Your suggestions are appreciated. The code is below... /*C# code*/ using System.Collections.Generic; namespace TestApp { public …

Member Avatar
Member Avatar
+0 forum 6

I am writing a flat-file database app using SQLite. That part works just fine, but the GUI not so much. The issues are arising in the bindings. I have a list of accounts displayed in a datagrid. The datagrid has its ItemsSource set to a List<Accounts> collection. That works fine. Only the basic information is displayed by the datagrid. I am using an accordion control to display the rest of the information for the selected account. I want everything to update automatically when the user selects a row on the datagrid. I would like it to do it with just …

Member Avatar
+0 forum 0

The End.