Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all 18858 articles
Browse latest View live

Communication between two usercontrols without using frameworks( Prism, MVVMLight etc..) with MVVM Pattern.

$
0
0

HI,

  I have two usercontrols UC1 (with a single text box ) and UC2 (with a single textBlock) and both the user controls are placed in the MAinwindow. UC1  and UC2 has its own corresponding View models (UC1VM and UC2VM).

My requirement is, when I type something in my UC1 textbox, I want it to be dispalyed in the UC2 textblock. so waht I did is had a text property in my UC1VM.

string myText;

        public string MyText
        {
            get { return myText; }
            set { myText = value;
                PropertyChanged(this, new PropertyChangedEventArgs("MyText")); }
        }


IN my UC2VM I had a Attached DP as show belwo (UC2VM inherits DependencyObject).

public static DependencyProperty StringDetailProperty = DependencyProperty.RegisterAttached("StringDetail", typeof(string), typeof(UC2VM), new PropertyMetadata(new PropertyChangedCallback(xyz)));


        public static void SetStringDetail(UIElement element, string value)
        {
            element.SetValue(StringDetailProperty, value);
        }
        public static string GetStringDetail(UIElement element)
        {
            return (string)element.GetValue(StringDetailProperty);
        }


        static void xyz(DependencyObject depObj, DependencyPropertyChangedEventArgs args)
        {
            .....
        }


My mainWindow XAML as follows.

<Window x:Class...<ucs:UC1  x:Name="uc1" ></ucs:UC1><ucs:UC2 ucs1:UC2VM.StringDetail="{Binding ElementName=uc1, Path=MyText}"  ></ucs:UC2></Window>

Whenever I change the textbox value in my UC1, the "MyText" property  gets updated, but hte function xyz written in UC2VM is not getting hit.  kindly help.  Not interested in using any frameworks like MVVMLight or prism etc... Like to know how ti can be achieved without using the frameworks.

Aslo one more question. Can I write a DP in my code behind file of a User control as per mvvm. 

Thanks,

Sanjay.


Testing tool to test number

$
0
0

Hi,

We have real trading application with grid with 100+ columns, and there are so many columns and all are numbers , which coming from different sources.

we want to test number , but did not find any tool which can help, or please suggest best way to perform number testing.

we have unit test case in our application , but not doing number matching,

please suggest how to do it?

Thanks

Ashok-


Jumpingboy

avoid inserting data in SQL

$
0
0
Hello. How can I forbide inserting more than one row in my SLQ Database table (*.sdf)?

Assembly Resource + selected item

$
0
0

Hello. I have this code

private void TreeViewItem_Selected(object sender, RoutedEventArgs e)
        {
             Assembly assembly = Assembly.GetExecutingAssembly();
             string NAME = "WpfApplication2.Res.Pages."+treeView1.Name+".xaml";

            using (Stream stream = assembly.GetManifestResourceStream(NAME))
            {
                FlowDocument document = (FlowDocument)XamlReader.Load(stream);
                flow.Document = document;
            }
        }

After compiling I choose item from treeView and get ArgumentNullException for this line

FlowDocument document = (FlowDocument)XamlReader.Load(stream);

I'm sure that issue called by 

string NAME = "WpfApplication2.Res.Pages."+treeView1.Name+".xaml"

I don't want to use switch method, because there's going to be over a hundred items in my app.

How to fix it? Thank you



Can I access a label from MainViewModel?

$
0
0

Say I have a very simple WPF application.

 public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            this.DataContext = new MainViewModel();
        }

There is a label, I want to display a text on it.

Connected to the server: xx.xx.xxx.xxx
xx.xx.xxx.xxx is a value from app.config, how to bind it? Also can I bind it from MainViewModel?

DataGrid in WPF and MSSQL

$
0
0

Hello,

I have a question about updating a datagrid with changes from a SQL server. I have a application (Multiple instances running across a network) that polls a server every so often and pulls data from a table to update a datagrid with changes that have been made to the table. The current implementation I have is as follows:

1.) Application Pulls data from server and creates new datatable
2.) Application records current selection in datagrid.
3.) Change datagrid ItemsSource to the new datatable that was retrieved.
4.) Set the selection back to the item that was selected before the itemsource was changed.

-This all is executed using a secondary thread as to not interrupt the UI thread.

It works flawless and the update process doesn't cause any flicker but I feel like there was a more direct approach without having to have as much code, also kinda nervous about it I have more than a few hundred rows if I will start noticing performance issues. (Which I should never have more than 50 rows at any given time giving consideration to how the application is being used, just want to plan ahead for the future.

Do you feel like what I currently have is sufficient enough? or could you point to a article on the best way to accomplish a way to synchronize two datatables (New one from server against the current one Im using to display the data in a datagrid).

WPF VB.net, Framework 4.0, Microsoft SQL Server 2008

External .otf font cannot be loaded to WPF application

$
0
0

Hi,

first off, i have checked other threads about similar issues and tried their solutions, yet i could not get it to work.

The problem: I want to write a string using the System.Windows. Media.DrawingContext.DrawText to a Visual in the fontfamily of TitilliumMaps which is a custom font. Unfortunately, this does not work as it prints the string always in the default font. The printing of the text is performed in a helper project and i have packed the custom font also in a separate project and set it's Build Option to Content and Copy to Output Directory to Copy Always (I have tried different combinations of these properties, but none seemed to work). Below you can see the source code for printing the text...

public readonly Typeface LogoTypeFaceNormal = new Typeface(new FontFamily(new Uri("pack://application:,,,/CustomFonts/"), "./#TitilliumMaps29L"), FontStyles.Normal, FontWeights.Bold, FontStretches.Normal);

drawingContext.DrawText(
                new FormattedText(
                    "The quick brown fox g...",
                    CultureInfo.InvariantCulture,
                    FlowDirection.LeftToRight,
                    LogoTypeFaceNormal,
                    ConversionUtils.PointsToPixels(10),
                    FooterTextBrush),
                    new Point(bounds.Left + 0, contentOriginY + 4));

Hope someone had already this issue and could help me with it. Thanks in advance!

Turning Border Red on InValid Date in DatePicker

$
0
0

I have a DatePicker Control for Date of Birth. I want to validate it when something invalid is entered.

For e.g. if for the first time i enter abcd3w in datepicker and tab out, the value gets clear and that's fine because it is a default behavior.

But i want to validate this and turn border red. I am using ValidationRule but it never gets fired in this scenario.

If I put a valid date and then again make it empty the validation gets fired. Thereafter if i put any invalid value as asdh33 the validation rule takes care of it and behaves fine.

Please suggest.

Thanks,

Abdi


WPF System Tray Application

$
0
0

G'Day

I'm trying to build a WPF application that will sit in the system tray until a specific event occurs which will cause a WPF window to magically appear.

I have googled and searched the forum for more information about using the NotifyIcon but cant seem to get it working.

Currently I have got my form set to ShowInTaskBar=False and I can make it invisible easily enough, however I just need to get an icon into the system tray so I can handle the activation events.

Any tips?

Converter: how to return several Hyperlinks for TextBlock ?

$
0
0

Hello, in a window, I have a TextBlock binded to a property of my object. This property is aList<Person>, and I'm using a converter to display names, separated by ;

class CollectionToSingleItem : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
         object myitem = new object();
         List<Person> mypers = (List<Person>)value;
         if (mypers.Count > 0)
         {
             foreach (Person p in mypers)
             {
                  myitem += p.FirstName + " " + p.Name + " ; ";
             }
          }
          return myitem;
    }
}

It works fine.

Now, I'd like to turn each name into an Hyperlink and that's the big problem...

I've tried this:

TextBlock tb = new TextBlock(); foreach (Person p in mypers) { Run myrun = new Run(p.FirstName + " " + p.Name); Hyperlink lnk = new Hyperlink(myrun); lnk.NavigateUri = new Uri("http://www.google.com"); //Just for test tb.Inlines.Add(lnk); } myitem = tb.Inlines; return myitem;

But nothing's displayed.

How could I achieve this ?



September 2014 TechNet Guru WPF Winners announced!

$
0
0

The September Guru results are posted!

http://blogs.technet.com/b/wikininjas/archive/2014/10/16/the-microsoft-technet-guru-awards-september-2014.aspx

Below are the highlights, just the medal winners. Please see the blog above for more entrants and comments, which had to be trimmed to fit into this 60,000 character forum limit. 

Guru Award BizTalk Technical Guru - September 2014  

Gold Award Winner

Johns-305 [boatseller]BizTalk: Working with Preserve Interchange EDI Xml – Part 1Mandi Ohlinger: "This is a great How To article with the steps and terms clearly defined. If you want to preserve interchanges, you need to read this."
TGN: "EDI is a big part of BizTalk, great wrap up, both articles."

Silver Award Winner

Verma.SumitBizTalk Server - Default PipelinesTGN: "Very nice article explaining the default pipelines "in-depth"."
Mandi Ohlinger: "Great detailed information on the XML pipelines. Very informative read. " 

Bronze Award Winner

Rahul_MadaanBizTalk Server - Debatching multiple message types using Envelope SchemaMandi Ohlinger: "A common task explained simply. Very effective."
TGN: "Very nice tutorial. I would love to see some better images though, and a little better elaboration on the different steps, but overall a very good article." 

  

Guru Award Exchange Server Technical Guru - September 2014  

Gold Award Winner

Rafael MantovaniExchange: Unable to Verify Information About Users AvailabilityEd Price: "This is a good article with some good images. This article was originally in English, but because it was posted on the Portuguese Wiki, it got translated into Portuguese! The English version should be pasted into a new article on the English Wiki. Here is the English version: http://social.technet.microsoft.com/wiki/pt-br/contents/articles/26759.nao-e-possivel-verificar-informacoes-de-disponibilidade-dos-usuarios/revision/7.aspx "

Guru Award Forefront Identity Manager Technical Guru - September 2014  

Gold Award Winner

Eihab Isaac (MVP)FIM 2010 R2: Coexistence Exchange Provisioning Scenario using PowerShell Management AgentAM: "Eihab, thank you for continuing to make excellent contributions to the community. This is a useful reference for anyone needing to meet similar requirements without the service and portal."
PG: "Nice article. Well designed!"
Søren Granfeldt: "Great overview on real world challenges with managing diffrent Exchange versions using FIM. Second part wil really complement this article."

Guru Award Microsoft Azure Technical Guru - September 2014  

Gold Award Winner

ChervinePredictive Analytics with Microsoft Azure Machine Learning

JH: "Love it! One of my favorite articles on the wiki from last month."

Ed Price: "Fantastic article! Incredibly well written with good details and helpful images. This Machine Learning topic is very important and timely right now!"

Silver Award Winner

Alex MangWhat Are Scoring Profiles In Azure Search?

JH: "Alex has done a tremendous job with his library. Love it that he shares update on the library on the wiki."

Ed Price: "Wow, I love all the explanations and detail. And this topic is incredibly valuable. Amazing job!"

Bronze Award Winner

saramgsilvaMicrosoft’s Windows App Studio Beta : Connecting a Menu App to Azure Mobile Service

JH: "Great article with a lot of pictures. A good one!"

Ed Price: "Great topic, Sara! Very thorough and well written!"


 

Guru Award Miscellaneous Technical Guru - September 2014  

Gold Award Winner

Brian NadjiwonHow to Create and Use Enums in PowershellEd Price: "Wow, what a detailed article! Great depth and use of images! I think it's time for a PowerShell category!"
TGN: "I LOVE ENUMS! Great explaining and a great article. Well done, Brian!"
PG: "Nice, practical solution, clear explanation."

Silver Award Winner

Adnan UmerUnderstanding GPU Usage tool in Visual Studio 2013 Update 4Ed Price: " A fantastic Visual Studio article with great details and vivid images!"
TGN: "Very valuable and a great toturiol on how to use the "GPU Usage tool"" 

Bronze Award Winner

Britt AdamsUnexplained High CPU Usage on Intel E5 ProcessorsEd Price: "Very thorough explanation! Great job! "
TGN: "Wow, computer science is fun. Nice wrap-up and how-to. I loved it!" 

  

Guru Award SharePoint 2010 / 2013 Technical Guru - September 2014  

Gold Award Winner

Vivek JaggaSharePoint, Office 365 or a Hybrid Deployment?Jinchun Chen: "Excellent!"
Margriet Bruggeman: "Nice, I can see this one coming in real handy in comparison studies"

Silver Award Winner

Inderjeet SinghCommon issue when using SharePoint 2013 Multi Tenant environment (Apps and User Profile Synchronization)Jinchun Chen: "Nice article."
Margriet Bruggeman: "Useful and not too much is written about this topics, which adds some bonus points"

Bronze Award Winner

Dan ChristianTips and Tricks to Resolve Poject 2010 Server Migration IssuesMargriet Bruggeman: "Extensive KB-type article in case you need it"

 

Guru Award Small Basic Technical Guru - September 2014  

Gold Award Winner

Philip MuntsSmall Basic: For Windows 8.1 Tablet

Michiel Van Hoorn: "Great article for those (1) want to make apps for tablet form factors and (2) are looking to package a SB app into a package."

Ed Price: "I love it! What an important topic!"

Silver Award Winner

Nonki TakahashiSmall Basic: Emoji

Michiel Van Hoorn: "Another entry from Nonki which opens up new possibilities. This time Emoji and the font editing."

Ed Price: "This is incredibly interesting!"

Bronze Award Winner

Nonki TakahashiSmall Basic: Dictionary

Michiel Van Hoorn: "Simple entry on a powerful feature"

Ed Price: "Great overview of the Dictionary Object! Good job integrating the Known Issues and the See Also section!"


 

Guru Award SQL BI and Power BI Technical Guru - September 2014  

Gold Award Winner

visakh16Finding SSIS Packages having References to a Table or ColumnRB: "Interesting subject, with a lot of practical usage"
Jinchun Chen: "Really helpful."
PT: "Good article that addresses a specific problem and offers a solution. Thank you"

Silver Award Winner

Ch. Rajen SinghSSIS: Export Multiple File With Fixed SizePT: "This is a good article, well-written and solves a real problem."
Jinchun Chen: "Nice article."
RB: "Interesting workaround for the fixed file size problem"

Bronze Award Winner

Ed Price - MSFTPower BI Community CouncilPT: "Great information about the purpose and composition of the Power BI Community Council to inform and raise awareness."


 

Guru Award SQL Server General and Database Engine Technical Guru - September 2014  

Gold Award Winner

ShankyAn Examination of Logging in Truncate Table Statement and Its Comparison With Delete Statement

Jinchun Chen: "Excellent" 
AM: "The best!"

Ed Price: "Wow, Shanky! What an amazingly thorough and detailed article!"

Silver Award Winner

Tulio RosaSQL Server Load Balancing

AM: "Also very good!"
Jinchun Chen: "Excellent"    

Ed Price: "Fantastic topic, good job on the diagram, and great use of TechNet Gallery! Plus a Portuguese translation!"

Bronze Award Winner

Ashwin MenonGet Notified when a database status changes

AM: "This is well explained"

Ed Price: "Very thorough article! Good References section!"

   

Guru Award System Center Technical Guru - September 2014  

Gold Award Winner

Mr XHow to upload new Drivers in SCCM 2012 R2 

Peter Laker: "Very nice, thanks Mr X"

Ed Price: "Wow. Great use of images to walk the reader through the process! Could benefit from a See Also and Additional Resources type of sections. Very thorough!"

Silver Award Winner

Mr XHow to create a new Boot Image using SCCM 2012 R2 

Peter Laker: "Another good article!"

Ed Price: "Short and sweet How To article! It's great to cover all these scenarios. Excellent addition to our System Center library of content!"

Guru Award Transact-SQL Technical Guru - September 2014  

Gold Award Winner

visakh16Full Outer Join - The Most Generic Join Statement

JS: "A good summary, though a bit generic and already available mutliple times on the internet. The sample (with data) could be a bit more crisp though."
Jinchun Chen: "Very helpful."

Ed Price: "I love the explanations at the top in the Context and Reasoning sections! And then the solution has a fantastic mix between explanations, illustrations, and the code snippets. And the links at the bottom help JOIN together the Join resources! Great job!"

Silver Award Winner

Praveen Rayan D'saDynamic pivot with column alias

Jinchun Chen: "Good."
JS: "Make sure no to use a parameter declaration without a size of the variable type, like in VARCHAR, better use Varchar(YourSizeHere)."

Ed Price: "Fantastic solution. Good job getting the references in there at the bottom!"

Bronze Award Winner

Saeid HasaniCalling Stored Procedures Using Transact-SQL

JS: "A good write up for getting the feet wet with procedure, though missing some depth." 

Ed Price: "Wow! I love your break out each section, explain it, and give the code snippet. It makes it very easy to read, understand, and get to the right section! To JS's point, it's probably better for beginners than advanced T-SQL gurus, but this content is still very valuable. Great example of the community giving advice and helping out with the content. Incredible article!"

 

Guru Award Visual C# Technical Guru - September 2014  

Gold Award Winner

João SousaASP.NET WebAPI - Basic RedisPeter Laker: "Nice WebAPI basics Joao!"
JM: "This is best"

Silver Award Winner

Jaliya UdagedaraPublishing and Subscribing using NServiceBusJM: "Close second IMO"
Peter Laker: "Great intro to NServiceBus! Thanks Jaliya!"

Bronze Award Winner

Adnan UmerCalculating Percentage Similarity of two Strings in C#JM: "I like this!"
Peter Laker: "Awesome snippet and explanation, thanks Adnan!"


 

Guru Award Windows Phone and Windows Store Apps Technical Guru - September 2014  

Gold Award Winner

Adnan UmerIntroducing ObjectGraphLibrary to visualize Stack and HeapJH: "Good article about stack and heap visualization."
TGN: "Hardcore stuff, but very valuable. Great article buddy!"

Silver Award Winner

saramgsilvaMicrosoft’s Windows App Studio Beta: Creating a BackOffice App for Menu AppJH: "Another great article by Sara! A lot of code snippets, pictures and explanations."
TGN: "Great tutorial, well explained. And a bunch of screenshots. I loved it!"

Bronze Award Winner

Muiz KhanUsing Speech Recognition without InternetTGN: "Nice one. I love articles that explain something in an easy understanding way. Great work Muiz!"
JH: "Good explanation of offline capabilities of speech recognition."

Guru Award Windows Presentation Foundation (WPF) Technical Guru - September 2014  

Gold Award Winner

Andy ONeillWPF: CollectionView TipsKJ: "wow cery thorough!"
Peter Laker: "Blindingly good article Andy!"

Silver Award Winner

Magnus (MM8)WPF/MVVM: Binding the DatePickerTextBox in WPFKJ: "useful tip - could see needing to do this and searching for this article and finding it"
Peter Laker: "Excellent work as always Magnus!"

Guru Award Wiki and Portals Technical Guru - September 2014  

Gold Award Winner

Durval RamosVisio Portal

Peter Laker: "Awe inspiring portal from a Wiki legend!"

Ed Price: "Great introduction, a lot of links, divided by sections, and it even has References and Return to Top links! Amazing article!"

  

Guru Award Windows Server Technical Guru - September 2014  

Gold Award Winner

Mr XGetting Started with KMS (Key Management Service)JM: "Another excellent article, great work."
Philippe Levesque: "Really good documentation."
Richard Mueller: "Good topic with good images to explain."
Mark Parris: "Good insights, would be good to higlight also the improvements in 2012 and 2012 R2."

Silver Award Winner

Kelly BushAuthentication Policies and Authentication Silos – Restricting Domain Controller AccessMark Parris: "Nice article, providing further insight into some of 2012 R2's capabilities."
Richard Mueller: "Great article with lots of detail. Could use TOC and See Also section."
JM: "An excellent article, thanks for the contribution!"
Philippe Levesque: "Good article, it explain some security that we don't see much."

Bronze Award Winner

FZBWindows Server: DNS Service - Negative CachingMark Parris: "useful tidbit, i have often seen shortttl zones for such records."
JM: "A good article, however it needs a rewrite for clarity."
Philippe Levesque: "Andy information to have, thanks for sharing !"
Richard Mueller: "Needs more explanation."


Congratulations to everyone who won a medal and thank you to everyone who entered! Your success will be entered into folklore and sung about for generations to come!

If you can do better, or simply wish to join our community and make a name for yourself, please enter this month's competition:

http://social.technet.microsoft.com/wiki/contents/articles/26994.technet-guru-contributions-october-2014.aspx

 

Regards,
Pete



#PEJL

Got any nice code? If you invest time in coding an elegant, novel or impressive answer on MSDN forums, why not copy it over to the one and onlyTechNet Wiki, for future generations to benefit from! You'll never get archived again!

If you are a member of any user groups, please make sure you list them in the Microsoft User Groups Portal. Microsoft are trying to help promote your groups, and collating them here is the first step.

Bubble up LostFocus event to the parent

$
0
0

I have WPF MVVM application and a UserControl and I am trying to bubble up a LostFocus event from a TextBox on the UserControl to the parent, but I can not find any examples, all I can find is ButtonClick event examples where the class inherits the Button class.  I don't want to inherit the Button class because I am inheriting another class already.  Can someone point me to an example of how to Bubble up the lost focus event to the parent ?  I know it's really simple if you know what you are doing. 

Thank You.


Peter

Passing content to other Window

$
0
0

 I need to make two Windows separatly. How to transfer selected treeView flowDocument from MainWindow to Window1. Here are codes:

MainWindow

namespaceWpfApplication1{publicpartialclassMainWindow:Window{publicTreeViewItem tvi;publicMainWindow(){InitializeComponent();}privatevoid treeView_Selected(object sender,RoutedEventArgs e){
            tvi = sender asTreeViewItem;Window1 w1 =newWindow1();
            w1.Show();}}}

Window1

namespaceWpfApplication1{publicpartialclassWindow1:Window{publicMainWindow win;publicWindow1(){InitializeComponent();}privatevoid flow_Initialized(object sender,EventArgs e){TreeViewItem tvi = sender asTreeViewItem;Assembly assembly =Assembly.GetExecutingAssembly();FlowDocument document =null;using(Stream stream = assembly.GetManifestResourceStream(assembly.GetName().Name+".g.resources")){using(var resourceReader =newResourceReader(stream)){foreach(DictionaryEntry resource in resourceReader){if(resource.Key.ToString().Equals("pages/"+ win.tvi.Name.ToLower()+".xaml")){
                             document =(FlowDocument)XamlReader.Load(resource.ValueasStream);}}}}
             flow.Document= document;}}}

In Window1 it'll going to be Exit button with Garbage Collection. When I click on item from MainWindow it gives me NullReferenceException for

if(resource.Key.ToString().Equals("pages/"+ win.tvi.Name.ToLower()+".xaml"))

Thanks

Lose of the tab-key control

$
0
0

Hi,

I have a WPF application that hosts a Win32 control in a WindowsFormsHost. Win32 is showing Explore to operate users files.

Issue: After the tab-key control has been moved to the Win32 within this application once, the Win32 will keep to handle the tab-key control.

Thereafter, the user becomes unable to operate by pressing the tab-key in all applications.

Id like to detect the tab-key control in the WPF application even after the control of the tab-key was moved to Win32 once.

Thanks for any ideas,

Hayato  (TKNET SERVICE LIMITED)


Hayato Takeda

How Would I Animate the ProgressBar Progress Indicator Color to go From Black at the Minimum Value to A Different Color at the Maximum Value

$
0
0

Hi,

 

I am using Visual Studio 2012 and Expression Blend.  I would like to create a custom progressbar that will have a starting foreground color (for example black) at the minimum value and transition to a different forground color (for example yelow) when the maximum value is reached. I've studied the template in Expression Blend. Within the "Part_Indicator" control part, there is a grid named "Foreground" that contains a rectangle named "Indicator". I believe I have to create an animation that changes the foreground color of "Indicator" from black to yellow as indicator grows from the minimum value to the maximum value (please correct me if I'm wrong). If the maximum value is not reached, the animation should pause at the last color value it had when the progress bar stopped. This would be the final color displayed in "Indicator".  It looks like the foreground property of "Indicator" is template bound. Should I reset the binding on Indicator's foreground color and use a ContolStoryBoardActin for the storyboard that shows the color transitions as the indicator grows? If I have to do this with animation, what trigger would I use for the ControlStoryboardAction to start the animation when the indicator starts to show progress?  How will I pause the storyboard animation when the Indicator stops showing progress? If I record a 10 second animation, will there be an issue if it takes longer than 10 seconds for the progress bar to reach its final position?

If there is a simpler way to achieve this, other than animation, I would love to hear about it.

Thanks


Check item on Checked List Box

$
0
0

hi 

i have a user control of checked list box.I have created this with list box and check box.

How can i check one item,based  on index 

Thanks 

Deepu Jose

How to add items to ComboBox, current script doesn't work.

$
0
0

http://oi60.tinypic.com/a0f8dw.jpg

What is wrong with this code? It is always considered as wrong. No matter where I place it, it is either half-wrong or fully wrong. I'm making Visual C# WPF on Visual Studio 2013 Professional Update 3.

ComboBox, does exist, error log gives total of 6 errors, but ComboBox is still empty, when started it tells me that there were errors when building and asks me if I want to continue, after I click on "Yes", it starts it, but ComboBox is still empty.

ComboBox frick = new ComboBox();
frick.Items.Add("E");
frick.SelectedIndex = ComboBox1.Items.Count - 1;
Doesn't work either.

<mytubeelement data="{"bundle":{"label_delimitor":":","percentage":"%","smart_buffer":"Smart Buffer","start_playing_when_buffered":"Start playing when buffered","sound":"Sound","desktop_notification":"Desktop Notification","continuation_on_next_line":"-","loop":"Loop","only_notify":"Only Notify","estimated_time":"Estimated Time","global_preferences":"Global Preferences","no_notification_supported_on_your_browser":"No notification style supported on your browser version","video_buffered":"Video Buffered","buffered":"Buffered","hyphen":"-","buffered_message":"The video has been buffered as requested and is ready to play.","not_supported":"Not Supported","on":"On","off":"Off","click_to_enable_for_this_site":"Click to enable for this site","desktop_notification_denied":"You have denied permission for desktop notification for this site","notification_status_delimitor":";","error":"Error","adblock_interferance_message":"Adblock (or similar extension) is known to interfere with SmartVideo. Please add this url to adblock whitelist.","calculating":"Calculating","waiting":"Waiting","will_start_buffering_when_initialized":"Will start buffering when initialized","will_start_playing_when_initialized":"Will start playing when initialized","completed":"Completed","buffering_stalled":"Buffering is stalled. Will stop.","stopped":"Stopped","hr":"Hr","min":"Min","sec":"Sec","any_moment":"Any Moment","popup_donate_to":"Donate to","extension_id":null},"prefs":{"desktopNotification":true,"soundNotification":true,"logLevel":0,"enable":true,"loop":false,"hidePopup":false,"autoPlay":false,"autoBuffer":true,"autoPlayOnBuffer":false,"autoPlayOnBufferPercentage":42,"autoPlayOnSmartBuffer":true,"quality":"default","fshd":false,"onlyNotification":false,"enableFullScreen":true,"saveBandwidth":false,"hideAnnotations":false,"turnOffPagedBuffering":false}}" event="preferencesUpdated" id="myTubeRelayElementToPage"></mytubeelement>

Task or timer for ooling status

$
0
0

Dear all,

I am building a WPF application in which I need to pool every minutes for a payement device status. By device status, the role is to be able to make a live monitoring in order to early identify its state and possible failures.

For that I am different approach and would love to hear from you.

Solution 1:

having a time which fire every minutes and then call the GetStatus method

Solution 2 :

having a Task.Run which sleep for a minute and then run the GetStatus method

Thanks for advise

regards

GetWidenedPathGeometry with flat pen stills rounds outter countour

$
0
0

Hello,

I am experiencing some problems while creating a widened PathGeometry from a simple Geometry. One of the resulting geometry figures, the outer one, contains rounded corners, even if I set the Pen to not do so.

Here is the code the reproduce the problem:

private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            StreamGeometry geom = new StreamGeometry();

            DrawLines(geom);

            Pen p = new Pen(Brushes.Black, 10);
            p.LineJoin = PenLineJoin.Miter;
            p.EndLineCap = PenLineCap.Flat;
            p.StartLineCap = PenLineCap.Flat;

            PathGeometry pathGeoWidened = geom.GetWidenedPathGeometry(p);
            PathGeometry pathGeom = pathGeoWidened.GetOutlinedPathGeometry();

            Path myPath = new Path();
            myPath.Stroke = Brushes.Black;
            myPath.Data = pathGeom;
            myCanvas.Children.Add(myPath);

        }

 private static void DrawLines(StreamGeometry geom)
        {
            using (var context = geom.Open())
            {
                context.BeginFigure(new Point(100, 100), true, true);
                context.LineTo(new Point(100, 200), true, true);
                context.LineTo(new Point(200, 200), true, true);
                context.LineTo(new Point(200, 100), true, true);
            }
        }

The resulting visual is this:

As you can see, the outer countour contains rounded corners. I need something flat, like the inside contour.

Any ideas,

Igor.


.NET Software developer for industrial internet and automation system.

Generating group name for radio buttons.

$
0
0

Hi Every one,

The RadioButton GroupName has become a pain in the neck for me and from what I read around, others are also facing issues with it.

When we give a GroupName, all radio buttons will belong to that group no matter which panel they are in etc, I dont know why an additional functionality was provided to limit this.

I have this:

  <ItemsControl.ItemTemplate>
                    <DataTemplate>

<RadioButton>

  </DataTemplate>

 <I/temsControl.ItemTemplate>
                  

This is how I generate radio buttons for a user control. When the user control is loaded it shows 3/4 radio buttons on it.

Now the problem is, when I give a group name, they all become part of one group. How do I give/generate group name so that I can differentiate the buttons from one user control to other?

Thank you.


Please Mark as Answered If this answers your question OrUnMark as Answered if it did not.
Happy to Help :)
My Site

Viewing all 18858 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>